brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 43b81ec Raw
49 lines · plain
1# REQUIRES: x862 3# RUN: rm -rf %t; split-file %s %t4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/3.s -o %t/3.o6# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/main.s -o %t/main.o7 8# RUN: %lld -lSystem -dylib -install_name %t/my_lib.dylib -o %t/mylib.dylib %t/2.o9# RUN: %lld -lSystem %t/2.o %t/main.o -o %t/main10# RUN: %lld -lSystem -bundle -bundle_loader %t/main -o %t/bundle.bundle %t/3.o %t/mylib.dylib11## Check bundle.bundle to ensure the `my_func` symbol is from executable12# RUN: llvm-nm -m %t/bundle.bundle | FileCheck %s --check-prefix BUNDLE13# BUNDLE: (undefined) external my_func (from executable)14# RUN: llvm-objdump  --macho --lazy-bind %t/bundle.bundle | FileCheck %s --check-prefix BUNDLE-OBJ15# BUNDLE-OBJ: segment  section             address            dylib                 symbol16# BUNDLE-OBJ: __DATA   __la_symbol_ptr     0x{{[0-9a-f]*}}    main-executable       my_fun17 18# RUN: %lld -lSystem -bundle -bundle_loader %t/main -o %t/bundle2.bundle %t/3.o %t/2.o19## Check bundle.bundle to ensure the `my_func` symbol is not from executable20# RUN: llvm-nm -m %t/bundle2.bundle | FileCheck %s --check-prefix BUNDLE221# BUNDLE2: (__TEXT,__text) external my_func22 23# Test that bundle_loader can only be used with MachO bundle output.24# RUN: not %lld -lSystem -bundle_loader %t/main -o %t/bundle3.bundle 2>&1 | FileCheck %s --check-prefix ERROR25# ERROR: -bundle_loader can only be used with MachO bundle output26 27#--- 2.s28# my_lib: This contains the exported function29.globl my_func30my_func:31  retq32 33#--- 3.s34# my_user.s: This is the user/caller of the35#            exported function36.text37my_user:38  callq my_func()39  retq40 41#--- main.s42# main.s: dummy exec/main loads the exported function.43# This is basically a way to say `my_user` should get44# `my_func` from this executable.45.globl _main46.text47 _main:48  retq49