File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -459,7 +459,8 @@ class OffsetGetter {
459
459
// InputSectionBase.
460
460
class RelocationScanner {
461
461
public:
462
- template <class ELFT > void scanSection (InputSectionBase &s);
462
+ template <class ELFT >
463
+ void scanSection (InputSectionBase &s, bool isEH = false );
463
464
464
465
private:
465
466
InputSectionBase *sec;
@@ -1617,10 +1618,11 @@ void RelocationScanner::scan(Relocs<RelTy> rels) {
1617
1618
});
1618
1619
}
1619
1620
1620
- template <class ELFT > void RelocationScanner::scanSection (InputSectionBase &s) {
1621
+ template <class ELFT >
1622
+ void RelocationScanner::scanSection (InputSectionBase &s, bool isEH) {
1621
1623
sec = &s;
1622
1624
getter = OffsetGetter (s);
1623
- const RelsOrRelas<ELFT> rels = s.template relsOrRelas <ELFT>();
1625
+ const RelsOrRelas<ELFT> rels = s.template relsOrRelas <ELFT>(!isEH );
1624
1626
if (rels.areRelocsCrel ())
1625
1627
scan<ELFT>(rels.crels );
1626
1628
else if (rels.areRelocsRel ())
@@ -1658,7 +1660,7 @@ template <class ELFT> void elf::scanRelocations() {
1658
1660
RelocationScanner scanner;
1659
1661
for (Partition &part : partitions) {
1660
1662
for (EhInputSection *sec : part.ehFrame ->sections )
1661
- scanner.template scanSection <ELFT>(*sec);
1663
+ scanner.template scanSection <ELFT>(*sec, /* isEH= */ true );
1662
1664
if (part.armExidx && part.armExidx ->isLive ())
1663
1665
for (InputSection *sec : part.armExidx ->exidxSections )
1664
1666
if (sec->isLive ())
Original file line number Diff line number Diff line change 5
5
# RUN: ld.lld -pie a.o b.o -o out
6
6
# RUN: llvm-objdump -d out | FileCheck %s
7
7
# RUN: llvm-readelf -Srs out | FileCheck %s --check-prefix=RELOC
8
+ # RUN: llvm-dwarfdump --eh-frame out | FileCheck %s --check-prefix=UNWIND
8
9
9
10
# CHECK: <_start>:
10
11
# CHECK-NEXT: callq {{.*}} <foo>
18
19
19
20
# RELOC: {{0*}}[[#DATA+8]] 0000000000000008 R_X86_64_RELATIVE [[#%x,DATA+0x8000000000000000]]
20
21
22
+ # RELOC: 00000000000012f4 0 NOTYPE GLOBAL DEFAULT [[#]] _start
23
+ # RELOC-NEXT: 00000000000012fe 0 NOTYPE GLOBAL DEFAULT [[#]] foo
24
+
25
+ ## initial_location fields in FDEs are correctly relocated.
26
+ # UNWIND: 00000018 00000010 0000001c FDE cie=00000000 pc=000012f4...000012fe
27
+ # UNWIND: 0000002c 00000010 00000030 FDE cie=00000000 pc=000012fe...0000130c
28
+
21
29
# RUN: ld.lld -pie --emit-relocs a.o b.o -o out1
22
30
# RUN: llvm-objdump -dr out1 | FileCheck %s --check-prefix=CHECKE
23
31
# RUN: llvm-readelf -Sr out1 | FileCheck %s --check-prefix=RELOCE
You can’t perform that action at this time.
0 commit comments