diff --git a/lld/test/MachO/compact-unwind-generated.test b/lld/test/MachO/compact-unwind-generated.test --- a/lld/test/MachO/compact-unwind-generated.test +++ b/lld/test/MachO/compact-unwind-generated.test @@ -16,6 +16,6 @@ # RUN: %python %S/tools/generate-cfi-funcs.py --seed=johnnyapple >%t.s # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -o %t.o %t.s -# RUN: %lld -platform_version macos 10.15 11.0 -Z -L%S/Inputs/MacOSX.sdk/usr/lib -lSystem -o %t %t.o +# RUN: %lld -Z -L%S/Inputs/MacOSX.sdk/usr/lib -lSystem -o %t %t.o # RUN: llvm-objdump --unwind-info --syms %t %t.o >%t.dump # RUN: %python %S/tools/validate-unwind-info.py %t.dump diff --git a/lld/test/MachO/compact-unwind.s b/lld/test/MachO/compact-unwind.s --- a/lld/test/MachO/compact-unwind.s +++ b/lld/test/MachO/compact-unwind.s @@ -2,16 +2,16 @@ # RUN: rm -rf %t; split-file %s %t # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/my-personality.s -o %t/x86_64-my-personality.o # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %t/main.s -o %t/x86_64-main.o -# RUN: %lld -platform_version macos 10.15 11.0 -arch x86_64 -pie -lSystem -lc++ %t/x86_64-my-personality.o %t/x86_64-main.o -o %t/x86_64-personality-first +# RUN: %lld -arch x86_64 -pie -lSystem -lc++ %t/x86_64-my-personality.o %t/x86_64-main.o -o %t/x86_64-personality-first # RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -# RUN: %lld -platform_version macos 10.15 11.0 -arch x86_64 -pie -lSystem -lc++ %t/x86_64-main.o %t/x86_64-my-personality.o -o %t/x86_64-personality-second +# RUN: %lld -arch x86_64 -pie -lSystem -lc++ %t/x86_64-main.o %t/x86_64-my-personality.o -o %t/x86_64-personality-second # RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/x86_64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 %t/my-personality.s -o %t/arm64-my-personality.o # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin19.0.0 %t/main.s -o %t/arm64-main.o -# RUN: %lld -platform_version macos 10.15 11.0 -arch arm64 -pie -lSystem -lc++ %t/arm64-my-personality.o %t/arm64-main.o -o %t/arm64-personality-first +# RUN: %lld -arch arm64 -pie -lSystem -lc++ %t/arm64-my-personality.o %t/arm64-main.o -o %t/arm64-personality-first # RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-personality-first | FileCheck %s --check-prefixes=FIRST,CHECK -D#%x,BASE=0x100000000 -# RUN: %lld -platform_version macos 10.15 11.0 -arch arm64 -pie -lSystem -lc++ %t/arm64-main.o %t/arm64-my-personality.o -o %t/arm64-personality-second +# RUN: %lld -arch arm64 -pie -lSystem -lc++ %t/arm64-main.o %t/arm64-my-personality.o -o %t/arm64-personality-second # RUN: llvm-objdump --macho --unwind-info --syms --indirect-symbols --rebase %t/arm64-personality-second | FileCheck %s --check-prefixes=SECOND,CHECK -D#%x,BASE=0x100000000 # RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %t/my-personality.s -o %t/arm64-32-my-personality.o diff --git a/lld/test/MachO/export-trie.s b/lld/test/MachO/export-trie.s --- a/lld/test/MachO/export-trie.s +++ b/lld/test/MachO/export-trie.s @@ -15,9 +15,9 @@ # EXPORTS-DAG: [[#%x, HELLO_WORLD_ADDR:]] {{.*}} _hello_world # EXPORTS-DAG: [[#%x, HELLO_ITS_ME_ADDR:]] {{.*}} _hello_its_me # EXPORTS-DAG: [[#%x, HELLO_ITS_YOU_ADDR:]] {{.*}} _hello_its_you -# EXPORTS-DAG: {{0+}} g *ABS* __mh_execute_header +# EXPORTS-DAG: [[#%x, HEADER_ADDR:]] g F __TEXT,__text __mh_execute_header # EXPORTS-LABEL: Exports trie: -# EXPORTS-DAG: 0x{{0+}} __mh_execute_header [absolute] +# EXPORTS-DAG: 0x{{0*}}[[#%X, HEADER_ADDR]] __mh_execute_header # EXPORTS-DAG: 0x{{0*}}[[#%X, MAIN_ADDR]] _main # EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_ADDR]] _hello # EXPORTS-DAG: 0x{{0*}}[[#%X, HELLO_WORLD_ADDR]] _hello_world diff --git a/lld/test/MachO/internalize.ll b/lld/test/MachO/internalize.ll --- a/lld/test/MachO/internalize.ll +++ b/lld/test/MachO/internalize.ll @@ -36,7 +36,7 @@ ; SYMTAB-EMPTY: ;--- test.s -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" declare void @baz() @@ -60,7 +60,7 @@ } ;--- baz.s -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define void @baz() { diff --git a/lld/test/MachO/invalid/compact-unwind-bad-reloc.s b/lld/test/MachO/invalid/compact-unwind-bad-reloc.s --- a/lld/test/MachO/invalid/compact-unwind-bad-reloc.s +++ b/lld/test/MachO/invalid/compact-unwind-bad-reloc.s @@ -1,6 +1,6 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %s -o %t.o -# RUN: not %lld -platform_version macos 10.15 11.0 -pie -lSystem -lc++ %t.o -o %t 2>&1 | FileCheck %s -DFILE=%t.o +# RUN: not %lld -pie -lSystem -lc++ %t.o -o %t 2>&1 | FileCheck %s -DFILE=%t.o # CHECK: error: compact unwind references address in [[FILE]]:(__data) which is not in segment __TEXT .globl _main, _not_a_function diff --git a/lld/test/MachO/invalid/compact-unwind-personalities.s b/lld/test/MachO/invalid/compact-unwind-personalities.s --- a/lld/test/MachO/invalid/compact-unwind-personalities.s +++ b/lld/test/MachO/invalid/compact-unwind-personalities.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %s -o %t.o -# RUN: not %lld -platform_version macos 10.15 11.0 -pie -lSystem -lc++ %t.o -o %t 2>&1 | FileCheck %s --check-prefix=TOO-MANY -# RUN: not %lld -platform_version macos 10.15 11.0 -pie -lSystem %t.o -o %t 2>&1 | FileCheck %s --check-prefix=UNDEF +# RUN: not %lld -pie -lSystem -lc++ %t.o -o %t 2>&1 | FileCheck %s --check-prefix=TOO-MANY +# RUN: not %lld -pie -lSystem %t.o -o %t 2>&1 | FileCheck %s --check-prefix=UNDEF # TOO-MANY: error: too many personalities (4) for compact unwind to encode # UNDEF: error: undefined symbol: ___gxx_personality_v0 diff --git a/lld/test/MachO/invalid/invalid-relocation-length.yaml b/lld/test/MachO/invalid/invalid-relocation-length.yaml --- a/lld/test/MachO/invalid/invalid-relocation-length.yaml +++ b/lld/test/MachO/invalid/invalid-relocation-length.yaml @@ -52,7 +52,7 @@ - cmd: LC_BUILD_VERSION cmdsize: 24 platform: 1 - minos: 655360 + minos: 659200 sdk: 0 ntools: 0 - cmd: LC_SYMTAB diff --git a/lld/test/MachO/invalid/invalid-relocation-pcrel.yaml b/lld/test/MachO/invalid/invalid-relocation-pcrel.yaml --- a/lld/test/MachO/invalid/invalid-relocation-pcrel.yaml +++ b/lld/test/MachO/invalid/invalid-relocation-pcrel.yaml @@ -54,7 +54,7 @@ - cmd: LC_BUILD_VERSION cmdsize: 24 platform: 1 - minos: 655360 + minos: 659200 sdk: 0 ntools: 0 - cmd: LC_SYMTAB diff --git a/lld/test/MachO/lc-linker-option.ll b/lld/test/MachO/lc-linker-option.ll --- a/lld/test/MachO/lc-linker-option.ll +++ b/lld/test/MachO/lc-linker-option.ll @@ -28,7 +28,7 @@ # INVALID: error: -why_load is not allowed in LC_LINKER_OPTION #--- framework.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" !0 = !{!"-framework", !"CoreFoundation"} @@ -39,7 +39,7 @@ } #--- l.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" !0 = !{!"-lSystem"} @@ -51,7 +51,7 @@ #--- invalid.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" !0 = !{!"-why_load"} diff --git a/lld/test/MachO/linkonce.ll b/lld/test/MachO/linkonce.ll --- a/lld/test/MachO/linkonce.ll +++ b/lld/test/MachO/linkonce.ll @@ -12,7 +12,7 @@ #--- first.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define linkonce void @foo() section "__TEXT,first" { @@ -21,7 +21,7 @@ #--- second.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define linkonce void @foo() section "__TEXT,second" { diff --git a/lld/test/MachO/lit.local.cfg b/lld/test/MachO/lit.local.cfg --- a/lld/test/MachO/lit.local.cfg +++ b/lld/test/MachO/lit.local.cfg @@ -16,7 +16,7 @@ # Since most of our tests are written around x86_64, we give this platform the # shortest substitution of "%lld". -lld = ('ld64.lld -arch x86_64 -platform_version macos 10.0 11.0 -syslibroot ' + +lld = ('ld64.lld -arch x86_64 -platform_version macos 10.15 11.0 -syslibroot ' + os.path.join(config.test_source_root, "MachO", "Inputs", "MacOSX.sdk")) config.substitutions.append(('%lld', lld + ' -fatal_warnings')) config.substitutions.append(('%no_fatal_warnings_lld', lld)) diff --git a/lld/test/MachO/load-command-sequence.s b/lld/test/MachO/load-command-sequence.s --- a/lld/test/MachO/load-command-sequence.s +++ b/lld/test/MachO/load-command-sequence.s @@ -47,7 +47,7 @@ # DYLIB: cmd LC_ID_DYLIB # COMMON: cmd LC_UUID -# COMMON: cmd LC_VERSION_MIN_MACOSX +# COMMON: cmd LC_BUILD_VERSION # COMMON: cmd LC_LOAD_DYLIB .section __TEXT,__cstring diff --git a/lld/test/MachO/local-got.s b/lld/test/MachO/local-got.s --- a/lld/test/MachO/local-got.s +++ b/lld/test/MachO/local-got.s @@ -5,40 +5,37 @@ # RUN: %lld -lSystem -dylib -install_name \ # RUN: @executable_path/libhello.dylib %t/libhello.o -o %t/libhello.dylib # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o + # RUN: %lld -lSystem -o %t/test %t/test.o -L%t -lhello -# RUN: llvm-objdump --full-contents --rebase --bind %t/test | FileCheck %s --match-full-lines +# RUN: llvm-objdump --macho --full-contents --rebase --bind %t/test | FileCheck %s --check-prefixes=CHECK,PIE --match-full-lines +# RUN: %lld -no_pie -lSystem -o %t/test %t/test.o -L%t -lhello +# RUN: llvm-objdump --macho --full-contents --rebase --bind %t/test | FileCheck %s --check-prefixes=CHECK,NO-PIE --match-full-lines ## Check that the GOT references the cstrings. --full-contents displays the ## address offset and the contents at that address very similarly, so am using ## --match-full-lines to make sure we match on the right thing. # CHECK: Contents of section __TEXT,__cstring: -# CHECK-NEXT: 100000424 {{.*}} +# CHECK-NEXT: 100000434 {{.*}} ## 1st 8 bytes refer to the start of __cstring + 0xe, 2nd 8 bytes refer to the ## start of __cstring # CHECK: Contents of section __DATA_CONST,__got: -# CHECK-NEXT: [[#%X,ADDR:]] 32040000 01000000 24040000 01000000 {{.*}} +# CHECK-NEXT: [[#%X,ADDR:]] 42040000 01000000 34040000 01000000 {{.*}} # CHECK-NEXT: [[#ADDR + 16]] 00000000 00000000 {{.*}} ## Check that the rebase table is empty. -# CHECK: Rebase table: -# CHECK-NEXT: segment section address type - -## Check that a non-locally-defined symbol is still bound at the correct offset: -# CHECK-NEXT: Bind table: -# CHECK-NEXT: segment section address type addend dylib symbol -# CHECK-NEXT: __DATA_CONST __got 0x[[#ADDR+16]] pointer 0 libhello _hello_its_me +# NO-PIE: Rebase table: +# NO-PIE-NEXT: segment section address type -# RUN: %lld -pie -lSystem -o %t/test %t/test.o -L%t -lhello -# RUN: llvm-objdump --macho --rebase --bind %t/test | FileCheck %s --check-prefix=PIE --match-full-lines # PIE: Rebase table: # PIE-NEXT: segment section address type # PIE-NEXT: __DATA_CONST __got 0x[[#%X,ADDR:]] pointer # PIE-NEXT: __DATA_CONST __got 0x[[#ADDR + 8]] pointer -# PIE-NEXT: Bind table: -# PIE-NEXT: segment section address type addend dylib symbol -# PIE-NEXT: __DATA_CONST __got 0x[[#ADDR+16]] pointer 0 libhello _hello_its_me +## Check that a non-locally-defined symbol is still bound at the correct offset: +# CHECK-NEXT: Bind table: +# CHECK-NEXT: segment section address type addend dylib symbol +# CHECK-NEXT: __DATA_CONST __got 0x[[#ADDR+16]] pointer 0 libhello _hello_its_me .globl _main diff --git a/lld/test/MachO/lto-archive.ll b/lld/test/MachO/lto-archive.ll --- a/lld/test/MachO/lto-archive.ll +++ b/lld/test/MachO/lto-archive.ll @@ -30,7 +30,7 @@ ;--- foo.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define void @foo() { @@ -39,7 +39,7 @@ ;--- has-objc-symbol.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" %struct._class_t = type { i8 } @@ -47,7 +47,7 @@ ;--- has-objc-category.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" %struct._category_t = type { i8 } diff --git a/lld/test/MachO/lto-object-path.ll b/lld/test/MachO/lto-object-path.ll --- a/lld/test/MachO/lto-object-path.ll +++ b/lld/test/MachO/lto-object-path.ll @@ -19,7 +19,7 @@ ; CHECK-NEXT: 0000000000000000 - 01 0000 SO ; CHECK-NEXT: {{[0-9a-f]+}} T _main -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define void @main() #0 !dbg !4 { diff --git a/lld/test/MachO/lto-save-temps.ll b/lld/test/MachO/lto-save-temps.ll --- a/lld/test/MachO/lto-save-temps.ll +++ b/lld/test/MachO/lto-save-temps.ll @@ -31,7 +31,7 @@ ;--- foo.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define void @foo() { @@ -40,7 +40,7 @@ ;--- bar.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define void @bar() { diff --git a/lld/test/MachO/map-file.s b/lld/test/MachO/map-file.s --- a/lld/test/MachO/map-file.s +++ b/lld/test/MachO/map-file.s @@ -29,7 +29,7 @@ # CHECK-NEXT: [[#%x,MAIN:]] g F __TEXT,__text _main # CHECK-NEXT: [[#%x,NUMBER:]] g O __DATA,__common _number # CHECK-NEXT: [[#%x,FOO:]] g O __TEXT,obj _foo -# CHECK-NEXT: {{0+}} g *ABS* __mh_execute_header +# CHECK-NEXT: [[#%x,HEADER:]] g F __TEXT,__text __mh_execute_header # CHECK-NEXT: # Path: {{.*}}{{/|\\}}map-file.s.tmp/test-map # CHECK-NEXT: # Arch: x86_64 diff --git a/lld/test/MachO/mh-header-link.s b/lld/test/MachO/mh-header-link.s --- a/lld/test/MachO/mh-header-link.s +++ b/lld/test/MachO/mh-header-link.s @@ -8,7 +8,7 @@ ## Test that in a dylib, we can link against __mh_dylib_header ## (but not in other types of files) -# RUN: llvm-mc %t/dylib.s -triple=x86_64-apple-macos10.0 -filetype=obj -o %t/dylib.o +# RUN: llvm-mc %t/dylib.s -triple=x86_64-apple-macos10.15 -filetype=obj -o %t/dylib.o # RUN: %lld -pie -dylib %t/dylib.o -o %t/dylib.out # RUN: llvm-objdump -m --syms %t/dylib.out | FileCheck %s --check-prefix DYLIB @@ -20,7 +20,7 @@ # ERR-DYLIB: error: undefined symbol: __mh_dylib_header ## Test that in an executable, we can link against __mh_execute_header -# RUN: llvm-mc %t/main.s -triple=x86_64-apple-macos10.0 -filetype=obj -o %t/exec.o +# RUN: llvm-mc %t/main.s -triple=x86_64-apple-macos10.15 -filetype=obj -o %t/exec.o # RUN: %lld -pie %t/exec.o -o %t/exec.out ## But it would be an error trying to reference __mh_execute_header in a dylib diff --git a/lld/test/MachO/module-asm.ll b/lld/test/MachO/module-asm.ll --- a/lld/test/MachO/module-asm.ll +++ b/lld/test/MachO/module-asm.ll @@ -9,7 +9,7 @@ ; CHECK: <_main>: ; CHECK-NEXT: jmp {{.*}} <_foo> -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" module asm ".text" diff --git a/lld/test/MachO/objc.s b/lld/test/MachO/objc.s --- a/lld/test/MachO/objc.s +++ b/lld/test/MachO/objc.s @@ -32,7 +32,7 @@ # NO-OBJC-EMPTY: # NO-OBJC-NEXT: SYMBOL TABLE: # NO-OBJC-NEXT: g F __TEXT,__text _main -# NO-OBJC-NEXT: g *ABS* __mh_execute_header +# NO-OBJC-NEXT: g F __TEXT,__text __mh_execute_header # NO-OBJC-EMPTY: #--- has-objc-symbol.s diff --git a/lld/test/MachO/symtab.s b/lld/test/MachO/symtab.s --- a/lld/test/MachO/symtab.s +++ b/lld/test/MachO/symtab.s @@ -59,12 +59,12 @@ # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: __mh_execute_header (81) # CHECK-NEXT: Extern -# CHECK-NEXT: Type: Abs (0x2) -# CHECK-NEXT: Section: (0x0) +# CHECK-NEXT: Type: Section (0xE) +# CHECK-NEXT: Section: __text (0x1) # CHECK-NEXT: RefType: UndefinedNonLazy (0x0) # CHECK-NEXT: Flags [ (0x0) # CHECK-NEXT: ] -# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Value: 0x100000000 # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: dyld_stub_binder diff --git a/lld/test/MachO/t.s b/lld/test/MachO/t.s --- a/lld/test/MachO/t.s +++ b/lld/test/MachO/t.s @@ -33,7 +33,7 @@ #--- baz.ll -target triple = "x86_64-apple-macosx10.0.0" +target triple = "x86_64-apple-macosx10.15.0" target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" define void @baz() { diff --git a/lld/test/MachO/x86-64-reloc-unsigned.s b/lld/test/MachO/x86-64-reloc-unsigned.s --- a/lld/test/MachO/x86-64-reloc-unsigned.s +++ b/lld/test/MachO/x86-64-reloc-unsigned.s @@ -23,9 +23,6 @@ # CHECK-NEXT: 100001000 08100000 01000000 # CHECK: Contents of section __DATA,bar: # CHECK-NEXT: 100001008 011000f0 11211111 02000000 -# CHECK: Rebase table: -# CHECK-NEXT: segment section address type -# CHECK-EMPTY: # PIE: Rebase table: # PIE-NEXT: segment section address type diff --git a/lld/test/MachO/x86-64-relocs.s b/lld/test/MachO/x86-64-relocs.s --- a/lld/test/MachO/x86-64-relocs.s +++ b/lld/test/MachO/x86-64-relocs.s @@ -21,7 +21,7 @@ # RUN: llvm-objdump --section=__const --full-contents %t | FileCheck %s --check-prefix=NONPCREL # NONPCREL: Contents of section __DATA,__const: -# NONPCREL-NEXT: 100001000 08040000 01000000 08040000 01000000 +# NONPCREL-NEXT: 100001000 18040000 01000000 18040000 01000000 .section __TEXT,__text .globl _main, _f diff --git a/lld/test/MachO/x86-64-stubs.s b/lld/test/MachO/x86-64-stubs.s --- a/lld/test/MachO/x86-64-stubs.s +++ b/lld/test/MachO/x86-64-stubs.s @@ -1,5 +1,5 @@ # REQUIRES: x86 -# RUN: mkdir -p %t +# RUN: rm -rf %t; mkdir -p %t # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s \ # RUN: -o %t/libhello.o # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libgoodbye.s \ @@ -12,20 +12,21 @@ # RUN: -o %t/libgoodbye.dylib # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/dylink-lazy.o -# RUN: %lld -o %t/dylink-lazy \ +# RUN: %lld -no_pie -o %t/dylink-lazy-no-pie \ # RUN: -L%t -lhello -lgoodbye %t/dylink-lazy.o -lSystem ## When looking at the __stubs section alone, we are unable to easily tell which ## symbol each entry points to. So we call objdump twice in order to get the ## disassembly of __text and the bind tables first, which allow us to check for ## matching entries in __stubs. +# RUN: llvm-objdump -d --no-show-raw-insn --syms --rebase --bind --lazy-bind %t/dylink-lazy-no-pie > %t/objdump-no-pie +# RUN: llvm-objdump -D --no-show-raw-insn %t/dylink-lazy-no-pie >> %t/objdump-no-pie +# RUN: FileCheck %s --check-prefixes=CHECK,NO-PIE < %t/objdump-no-pie + +# RUN: %lld -o %t/dylink-lazy -L%t -lhello -lgoodbye %t/dylink-lazy.o -lSystem # RUN: llvm-objdump -d --no-show-raw-insn --syms --rebase --bind --lazy-bind %t/dylink-lazy > %t/objdump # RUN: llvm-objdump -D --no-show-raw-insn %t/dylink-lazy >> %t/objdump -# RUN: FileCheck %s < %t/objdump - -# RUN: %lld -pie -o %t/dylink-lazy-pie \ -# RUN: -L%t -lhello -lgoodbye %t/dylink-lazy.o -lSystem -# RUN: llvm-objdump --macho --rebase %t/dylink-lazy-pie | FileCheck %s --check-prefix=PIE +# RUN: FileCheck %s --check-prefixes=CHECK,PIE < %t/objdump # CHECK-LABEL: SYMBOL TABLE: # CHECK: {{0*}}[[#%x, IMGLOADER:]] l {{.*}} __DATA,__data __dyld_private @@ -35,8 +36,13 @@ # CHECK-NEXT: callq 0x[[#%x, GOODBYE_STUB:]] ## Check that the rebase table is empty. -# CHECK-LABEL: Rebase table: -# CHECK-NEXT: segment section address type +# NO-PIE-LABEL: Rebase table: +# NO-PIE-NEXT: segment section address type + +# PIE-LABEL: Rebase table: +# PIE-NEXT: segment section address type +# PIE-NEXT: __DATA __la_symbol_ptr 0x[[#%X, ADDR:]] pointer +# PIE-NEXT: __DATA __la_symbol_ptr 0x[[#ADDR + 8]] pointer # CHECK-NEXT: Bind table: # CHECK: __DATA_CONST __got 0x[[#%x, BINDER:]] pointer 0 libSystem dyld_stub_binder @@ -60,11 +66,6 @@ # CHECK-NEXT: pushq $21 # CHECK-NEXT: jmp 0x[[#STUB_HELPER_ENTRY]] -# PIE: Rebase table: -# PIE-NEXT: segment section address type -# PIE-NEXT: __DATA __la_symbol_ptr 0x[[#%X, ADDR:]] pointer -# PIE-NEXT: __DATA __la_symbol_ptr 0x[[#ADDR + 8]] pointer - .text .globl _main