File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -1593,7 +1593,8 @@ uint32_t DynamicReloc::getSymIndex(SymbolTableBaseSection *symTab) const {
1593
1593
return 0 ;
1594
1594
1595
1595
size_t index = symTab->getSymbolIndex (sym);
1596
- assert ((index != 0 || type != target->gotRel && type != target->pltRel ) &&
1596
+ assert ((index != 0 || type != target->gotRel && type != target->pltRel ||
1597
+ !mainPart->dynSymTab ->getParent ()) &&
1597
1598
" GOT or PLT relocation must refer to symbol in dynamic symbol table" );
1598
1599
return index;
1599
1600
}
Original file line number Diff line number Diff line change
1
+ # REQUIRES: aarch64
2
+
3
+ ## We allow discarding .dynsym, check we don't crash.
4
+ # RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
5
+
6
+ # RUN: echo 'SECTIONS { /DISCARD/ : { *(.dynsym) } }' > %t.lds
7
+ # RUN: ld.lld -shared -T %t.lds %t.o -o %t.so
8
+ # RUN: llvm-readelf -r %t.so | FileCheck %s
9
+
10
+ # RUN: echo 'SECTIONS { /DISCARD/ : { *(.dynsym .dynstr) } }' > %t.lds
11
+ # RUN: ld.lld -shared -T %t.lds %t.o -o %t.so
12
+ # RUN: llvm-readelf -r %t.so | FileCheck %s
13
+
14
+ # CHECK: contains 2 entries:
15
+ # CHECK: R_AARCH64_RELATIVE [[#]]
16
+ # CHECK-NEXT: R_AARCH64_GLOB_DAT 0{{$}}
17
+
18
+ adrp x9, :got:var
19
+ ldr x9, [x9, :got_lo12:var]
20
+
21
+ .data
22
+ .align 8
23
+ foo:
24
+ .quad foo
Original file line number Diff line number Diff line change 11
11
# RUN: echo "SECTIONS { /DISCARD/ : { *(.dynamic) } }" > %t.script
12
12
# RUN: ld.lld -pie -o %t --script %t.script %t.o
13
13
14
- ## We allow discarding .dynsym, check we don't crash.
15
- # RUN: echo "SECTIONS { /DISCARD/ : { *(.dynsym) } }" > %t.script
16
- # RUN: ld.lld -pie -o %t --script %t.script %t.o
17
-
18
- ## We allow discarding .dynstr, check we don't crash.
19
- # RUN: echo "SECTIONS { /DISCARD/ : { *(.dynstr) } }" > %t.script
20
- # RUN: ld.lld -pie -o %t --script %t.script %t.o
21
-
22
14
# RUN: echo "SECTIONS { /DISCARD/ : { *(.rela.dyn) } }" > %t.script
23
15
# RUN: ld.lld -pie -o %t %t.o
24
16
# RUN: llvm-readobj -S %t | FileCheck --check-prefix=RELADYN %s
You can’t perform that action at this time.
0 commit comments