llvm-project/llvm/tools/llvm-objcopy
Jake Ehrlich 6452b11fd8 [llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy
Some ELF files produced by lld may have zero-size segment placeholders as shown
below. Since GNU_STACK Offset is 0, the current code makes it the lowest used
offset, and relocates all the segments over the ELF header. The resulting
binary is total garbage.

This change fixes how llvm-objcopy handles PT_PHDR properlly by treating ELF
headers and the program header table as segments to allow the layout algorithm
decide where those should go.

Author: vit9696

Differential Revision: https://reviews.llvm.org/D42872

llvm-svn: 325189
2018-02-14 23:31:33 +00:00
..
CMakeLists.txt [tools] Add option to install binutils symlinks 2017-11-02 21:43:32 +00:00
LLVMBuild.txt Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy" 2017-08-04 21:09:26 +00:00
Object.cpp [llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy 2018-02-14 23:31:33 +00:00
Object.h [llvm-objcopy] Fix handling of zero-size segments in llvm-objcopy 2018-02-14 23:31:33 +00:00
llvm-objcopy.cpp [llvm-objcopy] Make modifications in-place if output is not specified 2018-02-09 23:33:31 +00:00
llvm-objcopy.h [llvm-objcopy] Refactor llvm-objcopy to use reader and writer objects 2018-01-25 22:46:17 +00:00