diff options
author | Fangrui Song <maskray@google.com> | 2019-09-26 17:10:09 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-09-26 17:10:09 +0000 |
commit | 9f862613b368fa8d35a67bc005e3360d1ccbb2e3 (patch) | |
tree | 56c126dbaaf3d545c7a38419885e624b5774bcd4 /test | |
parent | 1683917d99e0e7c1b922e961b5cd0f20fd55d00f (diff) |
[ELF] Set SectionBase::partition in processSectionCommands
Fixes PR43461 (regression caused by D67504)
The partition field of a SECTIONS-specified section is not set after
D67504. The 0 value affects findSection() which checks if the partition
field is 1.
So `Out::initArray = findSection(".init_array")` is null, and
DT_INIT_ARRAYSZ is not set.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D68087
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372996 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/ELF/linkerscript/dynamic.s | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/ELF/linkerscript/dynamic.s b/test/ELF/linkerscript/dynamic.s index d236fba77..c69e752f9 100644 --- a/test/ELF/linkerscript/dynamic.s +++ b/test/ELF/linkerscript/dynamic.s @@ -1,10 +1,14 @@ # REQUIRES: x86 + +## Test that DT_INIT_ARRAYSZ/DT_FINI_ARRAYSZ/DT_PREINIT_ARRAYSZ are computed +## correctly, no matter their associated sections are orphans or not. + # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o -# RUN: ld.lld -shared %t2.o -o %t2.so +# RUN: ld.lld -shared %t2.o -soname=so -o %t2.so -# RUN: echo "SECTIONS { }" > %t.script -# RUN: ld.lld %t1.o %t2.so -o %t +# RUN: echo "SECTIONS { .init_array : { *(.init_array) } }" > %t.script +# RUN: ld.lld -T %t.script %t1.o %t2.so -o %t # RUN: llvm-readobj --dynamic-table %t | FileCheck %s # CHECK: DynamicSection [ |