# 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
# 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
# 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
; 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()
}
;--- 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() {
# 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
# 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
- cmd: LC_BUILD_VERSION
cmdsize: 24
platform: 1
- minos: 655360
+ minos: 659200
sdk: 0
ntools: 0
- cmd: LC_SYMTAB
- cmd: LC_BUILD_VERSION
cmdsize: 24
platform: 1
- minos: 655360
+ minos: 659200
sdk: 0
ntools: 0
- cmd: LC_SYMTAB
# 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"}
}
#--- 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"}
#--- 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"}
#--- 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" {
#--- 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" {
# 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))
# 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
# 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
;--- 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() {
;--- 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 }
;--- 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 }
; 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 {
;--- 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() {
;--- 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() {
# 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
## 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
# 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
; 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"
# 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
# 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
#--- 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() {
# 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
# 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
# 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 \
# 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
# 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
# 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