diff options
author | Fangrui Song <maskray@google.com> | 2019-09-05 14:25:57 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-09-05 14:25:57 +0000 |
commit | c3bc697974d2d7f3c151cb9853b40cc6bf73ba4b (patch) | |
tree | 84f1b811c199c8e32538cb219ea5b9cbc8db633d /llvm/test/Object | |
parent | 9cef6400014a3124880e4c87e32acaf0b4c7c415 (diff) | |
download | bcm5719-llvm-c3bc697974d2d7f3c151cb9853b40cc6bf73ba4b.tar.gz bcm5719-llvm-c3bc697974d2d7f3c151cb9853b40cc6bf73ba4b.zip |
[yaml2obj] Write the section header table after section contents
Linkers (ld.bfd/gold/lld) place the section header table at the very
end. This allows tools to strip it, which is optional in executable/shared objects.
In addition, if we add or section, the size of the section header table
will change. Placing the section header table in the end keeps section
offsets unchanged.
yaml2obj currently places the section header table immediately after the
program header. Follow what linkers do to make offset updating easier.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D67221
llvm-svn: 371074
Diffstat (limited to 'llvm/test/Object')
-rw-r--r-- | llvm/test/Object/invalid.test | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test index 8a75ecd3b77..397c948001e 100644 --- a/llvm/test/Object/invalid.test +++ b/llvm/test/Object/invalid.test @@ -315,7 +315,7 @@ FileHeader: # RUN: yaml2obj %s --docnum=16 -o %t16 # RUN: not llvm-readobj -r %t16 2>&1 | FileCheck -DFILE=%t16 --check-prefix=INVALID-REL-SYM %s -# INVALID-REL-SYM: error: '[[FILE]]': unable to access section [index 2] data at 0x18000180: offset goes past the end of file +# INVALID-REL-SYM: error: '[[FILE]]': unable to access section [index 2] data at 0x18000040: offset goes past the end of file --- !ELF FileHeader: @@ -565,7 +565,7 @@ Sections: # RUN: yaml2obj --docnum=26 %s -o %t26 # RUN: not llvm-readobj -h %t26 2>&1 | FileCheck -DFILE=%t26 --check-prefix=INVALID-SEC-NUM1 %s -# INVALID-SEC-NUM1: error: '[[FILE]]': invalid section header table offset (e_shoff = 0x40) or invalid number of sections specified in the first section header's sh_size field (0x3ffffffffffffff) +# INVALID-SEC-NUM1: error: '[[FILE]]': invalid section header table offset (e_shoff = 0x78) or invalid number of sections specified in the first section header's sh_size field (0x3ffffffffffffff) --- !ELF FileHeader: |