brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · 43ff21d Raw
92 lines · plain
1# REQUIRES: x862# UNSUPPORTED: system-windows3## FIXME: In principle this test should pass on Windows4# RUN: rm -rf %t; split-file %s %t5 6## This test verifies that we attempt to re-root absolute paths if -syslibroot7## is specified. Therefore we would like to be able to specify an absolute path8## without worrying that it may match an actual file on the system outside the9## syslibroot. `chroot` would do the job but isn't cross-platform, so I've used10## this %t/%:t hack instead.11# RUN: mkdir -p %t/%:t12 13# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o14# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/bar.s -o %t/bar.o15# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o16 17## bar.a is under %t/%:t, and so verifies that rerooting happens. foo.a isn't,18## and therefore verifies that we still fall back to the original path if no19## file exists at the rerooted path.20# RUN: llvm-ar rcs %t/foo.a %t/foo.o21# RUN: %lld -dylib %t/foo.o -o %t/libfoo.dylib22# RUN: llvm-ar rcs %t/%:t/bar.a %t/bar.o23# RUN: %lld -dylib %t/bar.o -o %t/%:t/libbar.dylib24 25## Test our various file-loading flags to make sure all bases are covered.26# RUN: %lld --reproduce %t/repro1.tar -lSystem -syslibroot %t %t/foo.a %t/bar.a %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"27# RUN: tar xf %t/repro1.tar -C %t28# RUN: cd %t/repro1; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"29 30# RUN: %lld --reproduce %t/repro2.tar -lSystem -syslibroot %t -force_load %t/foo.a -force_load %t/bar.a %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"31# RUN: tar xf %t/repro2.tar -C %t32# RUN: cd %t/repro2; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"33 34# RUN: %lld --reproduce %t/repro3.tar -lSystem -syslibroot %t %t/libfoo.dylib %t/libbar.dylib %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"35# RUN: tar xf %t/repro3.tar -C %t36# RUN: cd %t/repro3; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"37 38# RUN: %lld --reproduce %t/repro4.tar -lSystem -syslibroot %t -weak_library %t/libfoo.dylib -weak_library %t/libbar.dylib %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"39# RUN: tar xf %t/repro4.tar -C %t40# RUN: cd %t/repro4; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"41 42# RUN: %lld --reproduce %t/repro7.tar -lSystem -syslibroot %t -force_load %t/foo.a -force_load %t/bar.a %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"43# RUN: tar xf %t/repro7.tar -C %t44# RUN: cd %t/repro7; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"45 46# RUN: echo "%t/libfoo.dylib" > %t/filelist47# RUN: echo "%t/libbar.dylib" >> %t/filelist48# RUN: %lld --reproduce %t/repro5.tar -lSystem -syslibroot %t -filelist %t/filelist %t/test.o -o /dev/null -t | FileCheck %s -DDIR="%t/%:t"49# RUN: tar xf %t/repro5.tar -C %t50# RUN: cd %t/repro5; %no-arg-lld @response.txt | FileCheck %s -DDIR="%:t/%:t"51 52## The {{^}} ensures that we only match relative paths if DIR is relative.53# CHECK: {{^}}[[DIR]]/{{(lib)?}}bar54 55## Paths to object files don't get rerooted.56# RUN: mv %t/bar.o %t/%:t/bar.o57# RUN: not %lld -lSystem -syslibroot %t %t/foo.o %t/bar.o %t/test.o -o \58# RUN:   /dev/null 2>&1 | FileCheck %s --check-prefix=OBJ59# OBJ: error: cannot open {{.*[\\/]}}bar.o: {{[Nn]}}o such file or directory60 61## Now create a "decoy" libfoo.dylib under %t/%:t to demonstrate that the62## rerooted path takes precedence over the original path. We will get an63## undefined symbol error since we aren't loading %t/libfoo.dylib.64# RUN: cp %t/%:t/libbar.dylib %t/%:t/libfoo.dylib65# RUN: not %lld --reproduce %t/repro6.tar -lSystem -syslibroot %t %t/libfoo.dylib %t/libbar.dylib %t/test.o \66# RUN:   -o /dev/null -t 2> %t/error | FileCheck %s -DDIR="%t/%:t" --check-prefix=FOO67# RUN: FileCheck %s --check-prefix=UNDEF < %t/error68 69# RUN: tar xf %t/repro6.tar -C %t70# RUN: cd %t/repro6; not %no-arg-lld @response.txt 2> %t/error | FileCheck %s -DDIR="%:t/%:t" --check-prefix=FOO71# RUN: FileCheck %s --check-prefix=UNDEF < %t/error72 73# FOO: [[DIR]]/libfoo.dylib74# UNDEF: error: undefined symbol: _foo75 76#--- foo.s77.globl _foo78_foo:79 80#--- bar.s81.globl _bar82_bar:83 84#--- test.s85.text86.globl _main87 88_main:89  callq _foo90  callq _bar91  ret92