diff options
| author | Pete Cooper <peter_cooper@apple.com> | 2016-01-07 21:10:06 +0000 |
|---|---|---|
| committer | Pete Cooper <peter_cooper@apple.com> | 2016-01-07 21:10:06 +0000 |
| commit | 03bb2e59314534c1e8094051ce578851aa672dfe (patch) | |
| tree | 9e69d27d914fe9446777e35656ae27f20f780c96 | |
| parent | ac03979000cd12513d84d258e5b2dd36ef9e80d5 (diff) | |
| download | bcm5719-llvm-03bb2e59314534c1e8094051ce578851aa672dfe.tar.gz bcm5719-llvm-03bb2e59314534c1e8094051ce578851aa672dfe.zip | |
Always generate the fixup content for unwindFDEToFunction as we no
longer emit it.
llvm-svn: 257100
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp | 14 | ||||
| -rw-r--r-- | lld/test/mach-o/do-not-emit-unwind-fde-arm64.yaml | 57 |
2 files changed, 56 insertions, 15 deletions
diff --git a/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp b/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp index 3f69cfa2547..778f6f4add7 100644 --- a/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp +++ b/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp @@ -687,10 +687,21 @@ void ArchHandler_arm64::applyFixupRelocatable(const Reference &ref, case delta64: *loc64 = ref.addend() + inAtomAddress - fixupAddress; return; + case unwindFDEToFunction: + // We don't emit unwindFDEToFunction in -r mode as they are implicitly + // generated from the data in the __eh_frame section. So here we need + // to use the targetAddress so that we can generate the full relocation + // when we parse again later. + *loc64 = targetAddress - fixupAddress; + return; case delta32: *loc32 = ref.addend() + inAtomAddress - fixupAddress; return; case negDelta32: + // We don't emit negDelta32 in -r mode as they are implicitly + // generated from the data in the __eh_frame section. So here we need + // to use the targetAddress so that we can generate the full relocation + // when we parse again later. *loc32 = fixupAddress - targetAddress + ref.addend(); return; case pointer64ToGOT: @@ -709,9 +720,6 @@ void ArchHandler_arm64::applyFixupRelocatable(const Reference &ref, case unwindInfoToEhFrame: llvm_unreachable("fixup implies __unwind_info"); return; - case unwindFDEToFunction: - // Do nothing for now - return; case invalid: // Fall into llvm_unreachable(). break; diff --git a/lld/test/mach-o/do-not-emit-unwind-fde-arm64.yaml b/lld/test/mach-o/do-not-emit-unwind-fde-arm64.yaml index 4a121252fc6..d306419bc5f 100644 --- a/lld/test/mach-o/do-not-emit-unwind-fde-arm64.yaml +++ b/lld/test/mach-o/do-not-emit-unwind-fde-arm64.yaml @@ -1,7 +1,7 @@ # RUN: lld -flavor darwin -arch arm64 -r -print_atoms %s -o %t | FileCheck %s # RUN: lld -flavor darwin -arch arm64 -r -print_atoms %t -o %t2 | FileCheck %s -# RUN: llvm-objdump -r -macho %t | FileCheck -check-prefix=CODE %s -# RUN: llvm-objdump -r -macho %t2 | FileCheck -check-prefix=CODE %s +# RUN: llvm-objdump -r -s -section="__eh_frame" -macho %t | FileCheck -check-prefix=CODE %s +# RUN: llvm-objdump -r -s -section="__eh_frame" -macho %t2 | FileCheck -check-prefix=CODE %s --- !mach-o @@ -77,10 +77,16 @@ sections: 0x1E, 0x0B, 0x00, 0xED, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x0C, 0x1F, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0E, 0x10, 0x9E, 0x01, 0x9D, 0x02 ] + - segment: __TEXT + section: __gcc_except_tab + type: S_REGULAR + attributes: [ ] + address: 0x00000000000000A0 + content: [ 0x00, 0x00, 0x00, 0x00 ] local-symbols: - name: ltmp0 type: N_SECT @@ -133,18 +139,29 @@ page-size: 0x00000000 # CHECK: type: c-string # CHECK: content: [ 48, 65, 6C, 6C, 6F, 20, 77, 6F, 72, 6C, 64, 00 ] # CHECK: merge: by-content +# CHECK: - ref-name: L{{[0-9]*}} # CHECK: type: unwind-cfi # CHECK: content: [ 1C, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 50, 4C, # CHECK: 52, 00, 01, 78, 1E, 0B, 00, ED, FF, FF, FF, FF, # CHECK: FF, FF, FF, 00, 10, 0C, 1F, 00 ] -# CHECK: alignment: 8 -# CHECK: - ref-name: L{{[0-9]*}} -# CHECK: type: unwind-cfi -# CHECK: content: [ 24, 00, 00, 00, 24, 00, 00, 00, 00, 00, 00, 00, -# CHECK: 00, 00, 00, 00, 20, 00, 00, 00, 00, 00, 00, 00, -# CHECK: 08, 00, 00, 00, 00, 00, 00, 00, 00, 48, 0E, 10, +# CHECK: - type: unwind-cfi +# CHECK: content: [ 24, 00, 00, 00, 24, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}}, +# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 20, 00, 00, 00, 00, 00, 00, 00, +# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 48, 0E, 10, # CHECK: 9E, 01, 9D, 02 ] -# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: negDelta32 +# CHECK: offset: 4 +# CHECK: target: L{{[0-9]*}} +# CHECK: - kind: unwindFDEToFunction +# CHECK: offset: 8 +# CHECK: target: __Z3fooi +# CHECK: - kind: unwindFDEToFunction +# CHECK: offset: 25 +# CHECK: target: L{{[0-9]*}} +# CHECK: - ref-name: L{{[0-9]*}} +# CHECK: type: unwind-lsda +# CHECK: content: [ 00, 00, 00, 00 ] # CHECK: - type: compact-unwind # CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 20, 00, 00, 00, # CHECK: 00, 00, 00, 03, 00, 00, 00, 00, 00, 00, 00, 00, @@ -172,4 +189,20 @@ page-size: 0x00000000 # CHECK: target: _puts # Make sure we don't have any relocations in the __eh_frame section -# CODE-NOT: __eh_frame
\ No newline at end of file +# CODE-NOT: RELOCATION RECORDS FOR [__eh_frame] + +# Also make sure the reloc for the FDE->function is the correct offset +# It should be the offset from the fixup location back to the address +# of the function we are referencing +# CODE: Contents of section __eh_frame: +# This is the CIE: +# CODE-NEXT: {{[0-9abcdef]*}} 1c000000 00000000 017a504c 52000178 +# CODE-NEXT: {{[0-9abcdef]*}} 1e0b00ed ffffffff ffffff00 100c1f00 +# This is the FDE: +# CODE-NEXT: {{[0-9abcdef]*}} 24000000 24000000 a8ffffff ffffffff +# This is the important offset for FDE->func ^~~~~~~~ ~~~~~~~~ + +# CODE-NEXT: {{[0-9abcdef]*}} 20000000 00000000 08c3ffff ffffffff +# And this is the offset for FDE->lsda ^~~~~~~~ ~~~~~~ +# CODE-NEXT: {{[0-9abcdef]*}} ff480e10 9e019d02 +# And this byte ^~ |

