brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · a088c25 Raw
90 lines · plain
1# REQUIRES: x862 3# RUN: rm -rf %t && split-file %s %t && cd %t4# RUN: llvm-mc -filetype=obj -triple=x86_64 main.s -o main.o5# RUN: llvm-mc -filetype=obj -triple=x86_64 def.s -o def.o6# RUN: llvm-mc -filetype=obj -triple=x86_64 def-hidden.s -o def-hidden.o7# RUN: llvm-mc -filetype=obj -triple=x86_64 ref.s -o ref.o8# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o && ld.lld -shared a.o -o a.so9# RUN: cp a.so b.so10# RUN: llvm-mc -filetype=obj -triple=x86_64 empty.s -o empty.o && ld.lld -shared empty.o -o empty.so11 12# RUN: ld.lld --allow-shlib-undefined main.o a.so13# RUN: not ld.lld --no-allow-shlib-undefined main.o a.so 2>&1 | FileCheck %s14## Executable linking defaults to --no-allow-shlib-undefined.15# RUN: not ld.lld main.o a.so 2>&1 | FileCheck %s16# RUN: ld.lld main.o a.so --noinhibit-exec 2>&1 | FileCheck %s --check-prefix=WARN17# RUN: ld.lld main.o a.so --warn-unresolved-symbols 2>&1 | FileCheck %s --check-prefix=WARN18## -shared linking defaults to --allow-shlib-undefined.19# RUN: ld.lld -shared main.o a.so20 21## DSO with undefines should link with or without any of these options.22# RUN: ld.lld -shared --allow-shlib-undefined a.o23# RUN: ld.lld -shared --no-allow-shlib-undefined a.o24 25## Perform checking even if an unresolved symbol is first seen in a regular object file.26# RUN: not ld.lld --gc-sections main.o ref.o a.so 2>&1 | FileCheck %s27 28## Check that the error is reported for each shared library where the symbol29## is referenced.30# RUN: not ld.lld main.o a.so empty.so b.so 2>&1 | FileCheck %s --check-prefix=CHECK231 32## Test some cases when a relocatable object file provides a non-exported definition.33# RUN: not ld.lld main.o a.so def-hidden.o 2>&1 | FileCheck %s --check-prefix=NONEXPORTED34# RUN: not ld.lld main.o def-hidden.o a.so 2>&1 | FileCheck %s --check-prefix=NONEXPORTED35# RUN: not ld.lld main.o a.so def-hidden.o -shared --no-allow-shlib-undefined 2>&1 | FileCheck %s --check-prefix=NONEXPORTED36# RUN: ld.lld main.o a.so def-hidden.o --allow-shlib-undefined --fatal-warnings37## Test a relocatable object file definition that is converted to STB_LOCAL.38# RUN: not ld.lld main.o a.so def-hidden.o --version-script=local.ver 2>&1 | FileCheck %s --check-prefix=NONEXPORTED39# RUN: not ld.lld main.o def-hidden.o a.so --version-script=local.ver 2>&1 | FileCheck %s --check-prefix=NONEXPORTED40 41## The section containing the definition is discarded, and we report an error.42# RUN: not ld.lld --gc-sections main.o a.so def-hidden.o 2>&1 | FileCheck %s43## The definition def.so is ignored.44# RUN: ld.lld -shared def.o -o def.so45# RUN: ld.lld --gc-sections main.o a.so def.so def-hidden.o --fatal-warnings46 47# CHECK-NOT:   error:48# CHECK:       error: undefined reference: x1{{$}}49# CHECK-NEXT:  >>> referenced by a.so (disallowed by --no-allow-shlib-undefined){{$}}50# CHECK-NOT:   {{.}}51 52# CHECK2-NOT:  error:53# CHECK2:      error: undefined reference: x154# CHECK2-NEXT: >>> referenced by a.so (disallowed by --no-allow-shlib-undefined)55# CHECK2:      error: undefined reference: x156# CHECK2-NEXT: >>> referenced by b.so (disallowed by --no-allow-shlib-undefined)57# CHECK2-NOT:  {{.}}58 59# WARN:        warning: undefined reference: x160# WARN-NEXT:   >>> referenced by a.so (disallowed by --no-allow-shlib-undefined)61 62# NONEXPORTED-NOT: error:63# NONEXPORTED:     error: non-exported symbol 'x1' in 'def-hidden.o' is referenced by DSO 'a.so'64# NONEXPORTED-NOT: {{.}}65 66#--- main.s67.globl _start68_start:69  callq shared@PLT70#--- ref.s71  callq x1@PLT72#--- def.s73.globl x174x1:75#--- def-hidden.s76.globl x177.hidden x178x1:79 80#--- a.s81.globl shared82.weak x283shared:84  callq x1@PLT85  movq x2@GOTPCREL(%rip), %rax86 87#--- empty.s88#--- local.ver89v1 { local: x1; };90