diff --git a/lld/test/MachO/headerpad.s b/lld/test/MachO/headerpad.s --- a/lld/test/MachO/headerpad.s +++ b/lld/test/MachO/headerpad.s @@ -8,10 +8,12 @@ ## just enforces a lower bound. We should consider implementing the same ## alignment behavior. +# RUN: rm -rf %t; mkdir -p %t + ################ Check default behavior -# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o -# RUN: %lld -o %t %t.o -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s --check-prefix=PADx +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o +# RUN: %lld -o %t/test %t/test.o +# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PADx # # PADx: magic {{.+}} ncmds sizeofcmds flags # PADx-NEXT: MH_MAGIC_64 {{.+}} [[#]] [[#%u, CMDSIZE:]] {{.*}} @@ -22,10 +24,10 @@ # PADx-NEXT: offset [[#%u, CMDSIZE + 0x20 + 0x20]] ################ Zero pad, no LCDylibs -# RUN: %lld -o %t %t.o -headerpad 0 -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s --check-prefix=PAD0 -# RUN: %lld -o %t %t.o -headerpad 0 -headerpad_max_install_names -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s --check-prefix=PAD0 +# RUN: %lld -o %t/test %t/test.o -headerpad 0 +# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD0 +# RUN: %lld -o %t/test %t/test.o -headerpad 0 -headerpad_max_install_names +# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD0 # # PAD0: magic {{.+}} ncmds sizeofcmds flags # PAD0-NEXT: MH_MAGIC_64 {{.+}} [[#]] [[#%u, CMDSIZE:]] {{.*}} @@ -36,12 +38,12 @@ # PAD0-NEXT: offset [[#%u, CMDSIZE + 0x20 + 0]] ################ Each lexical form of a hex number, no LCDylibs -# RUN: %lld -o %t %t.o -headerpad 11 -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s --check-prefix=PAD11 -# RUN: %lld -o %t %t.o -headerpad 0x11 -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s --check-prefix=PAD11 -# RUN: %lld -o %t %t.o -headerpad 0X11 -headerpad_max_install_names -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s --check-prefix=PAD11 +# RUN: %lld -o %t/test %t/test.o -headerpad 11 +# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD11 +# RUN: %lld -o %t/test %t/test.o -headerpad 0x11 +# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD11 +# RUN: %lld -o %t/test %t/test.o -headerpad 0X11 -headerpad_max_install_names +# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s --check-prefix=PAD11 # # PAD11: magic {{.+}} ncmds sizeofcmds flags # PAD11-NEXT: MH_MAGIC_64 {{.+}} [[#]] [[#%u, CMDSIZE:]] {{.*}} @@ -52,17 +54,17 @@ # PAD11-NEXT: offset [[#%u, CMDSIZE + 0x20 + 0x11]] ################ Each & all 3 kinds of LCDylib -# RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %T/null.o -# RUN: %lld -o %T/libnull.dylib %T/null.o -dylib \ +# RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/null.o +# RUN: %lld -o %t/libnull.dylib %t/null.o -dylib \ # RUN: -headerpad_max_install_names -# RUN: llvm-objdump --macho --all-headers %T/libnull.dylib | FileCheck %s --check-prefix=PADMAX -# RUN: %lld -o %T/libnull.dylib %T/null.o -dylib \ +# RUN: llvm-objdump --macho --all-headers %t/libnull.dylib | FileCheck %s --check-prefix=PADMAX +# RUN: %lld -o %t/libnull.dylib %t/null.o -dylib \ # RUN: -headerpad_max_install_names -lSystem -# RUN: llvm-objdump --macho --all-headers %T/libnull.dylib | FileCheck %s --check-prefix=PADMAX -# RUN: %lld -o %T/libnull.dylib %T/null.o -dylib \ +# RUN: llvm-objdump --macho --all-headers %t/libnull.dylib | FileCheck %s --check-prefix=PADMAX +# RUN: %lld -o %t/libnull.dylib %t/null.o -dylib \ # RUN: -headerpad_max_install_names \ # RUN: -lSystem -sub_library libSystem -# RUN: llvm-objdump --macho --all-headers %T/libnull.dylib | FileCheck %s --check-prefix=PADMAX +# RUN: llvm-objdump --macho --all-headers %t/libnull.dylib | FileCheck %s --check-prefix=PADMAX # # PADMAX: magic {{.+}} ncmds sizeofcmds flags # PADMAX-NEXT: MH_MAGIC_64 {{.+}} [[#%u, N:]] [[#%u, CMDSIZE:]] {{.*}} @@ -73,10 +75,10 @@ # PADMAX-NEXT: offset [[#%u, CMDSIZE + 0x20 + mul(0x400, N - 7)]] ################ All 3 kinds of LCDylib swamped by a larger override -# RUN: %lld -o %T/libnull.dylib %T/null.o -dylib \ +# RUN: %lld -o %t/libnull.dylib %t/null.o -dylib \ # RUN: -headerpad_max_install_names -headerpad 0x1001 \ # RUN: -lSystem -sub_library libSystem -# RUN: llvm-objdump --macho --all-headers %T/libnull.dylib | FileCheck %s --check-prefix=PADOVR +# RUN: llvm-objdump --macho --all-headers %t/libnull.dylib | FileCheck %s --check-prefix=PADOVR # # PADOVR: magic {{.+}} ncmds sizeofcmds flags # PADOVR-NEXT: MH_MAGIC_64 {{.+}} [[#%u, N:]] [[#%u, CMDSIZE:]] {{.*}}