Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lld/test/ELF/lto/comdat-nodeduplicate.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; REQUIRES: x86, shell
; REQUIRES: x86

;; Keep __profd_foo in a nodeduplicate comdat, despite a comdat of the same name
;; in a previous object file.
Expand Down Expand Up @@ -36,19 +36,25 @@

; RUN: ld.lld --thinlto-index-only --save-temps -u foo %t/a.bc %t/b.bc -o %t/ab
; RUN: FileCheck %s --check-prefix=RESOL_AB < %t/ab.resolution.txt
; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_AB
; RUN: llvm-dis < %t/b.bc > %t.out
; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
; RUN: FileCheck %s --check-prefix=IR_AB --input-file %t.out
; RUN: ld.lld -u foo %t/a.bc %t/b.bc -o %t/ab
; RUN: llvm-readelf -x .data %t/ab | FileCheck %s --check-prefix=DATA

; RUN: ld.lld --thinlto-index-only --save-temps -u foo %t/a.bc --start-lib %t/b.bc --end-lib -o %t/ab
; RUN: FileCheck %s --check-prefix=RESOL_AB < %t/ab.resolution.txt
; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_AB
; RUN: llvm-dis < %t/b.bc > %t.out
; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
; RUN: FileCheck %s --check-prefix=IR_AB --input-file %t.out
; RUN: ld.lld -u foo %t/a.bc --start-lib %t/b.bc --end-lib -o %t/ab
; RUN: llvm-readelf -x .data %t/ab | FileCheck %s --check-prefix=DATA

; RUN: ld.lld --thinlto-index-only --save-temps -u foo -u c %t/a.bc --start-lib %t/b.bc %t/c.bc --end-lib -o %t/abc
; RUN: FileCheck %s --check-prefix=RESOL_ABC < %t/abc.resolution.txt
; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_ABC
; RUN: llvm-dis < %t/b.bc > %t.out
; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
; RUN: FileCheck %s --check-prefix=IR_ABC --input-file %t.out
; RUN: ld.lld -u foo %t/a.bc --start-lib %t/b.bc %t/c.bc --end-lib -o %t/abc
; RUN: llvm-readelf -x .data %t/abc | FileCheck %s --check-prefix=DATA

Expand Down
89 changes: 50 additions & 39 deletions lld/test/MachO/stabs.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# REQUIRES: x86, shell
# REQUIRES: x86
# UNSUPPORTED: system-windows
# RUN: rm -rf %t; split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
Expand All @@ -9,71 +9,79 @@
# RUN: env TZ=GMT touch -t "197001010000.32" %t/foo.o
# RUN: llvm-ar rcsU %t/foo.a %t/foo.o

# RUN: ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
# RUN: env ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out

## Check that we emit the right modtime even when the object file is in an
## archive.
# RUN: ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
# RUN: env ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out

## Check that we don't emit modtimes if ZERO_AR_DATE is set.
# RUN: env ZERO_AR_DATE=1 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o \
# RUN: -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
# RUN: env %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o \
# RUN: -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
# RUN: env %lld -lSystem %t/test.o %t/no-debug.o \
# RUN: -all_load %t/foo.a -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
# RUN: env %lld -lSystem %t/test.o %t/no-debug.o \
# RUN: -force_load %t/foo.a -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
# RUN: env ZERO_AR_DATE=0 %lld -lSystem -reproducible %t/test.o %t/foo.o \
# RUN: %t/no-debug.o -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out

## Check that we emit absolute paths to the object files in our OSO entries
## even if our inputs are relative paths.
# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -o test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -o test
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out

## Check that we emit relative path to object files in OSO entries
## when -oso_prefix <path> is used.
# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
# RUN: dsymutil -s %t/test-rel | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH
# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t/" -o %t/test-rel
# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t/" -o %t/test-rel
# RUN: dsymutil -s %t/test-rel | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH-NO-SLASH
# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
# RUN: dsymutil -s %t/test-rel-dot | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o %t/test-rel-dot
# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o %t/test-rel-dot
# RUN: dsymutil -s %t/test-rel-dot | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT-EXPLICIT

## Check that symlinks are not expanded when -oso_prefix . is used.
# RUN: mkdir -p %t/private/var/folders/tmp && ln -s private/var %t/var
# RUN: cp %t/test.o %t/foo.o %t/no-debug.o %t/private/var/folders/tmp
# RUN: env TZ=GMT touch -t "197001010000.16" %t/private/var/folders/tmp/test.o
# RUN: env TZ=GMT touch -t "197001010000.32" %t/private/var/folders/tmp/foo.o
# RUN: cd %t/var/folders/tmp && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o test-rel-symlink
# RUN: cd %t/var/folders/tmp && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o test-rel-symlink
# RUN: dsymutil -s %t/private/var/folders/tmp/test-rel-symlink | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
# RUN: cd %t/var/folders/tmp && ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o test-rel-symlink
# RUN: cd %t/var/folders/tmp && env ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o test-rel-symlink
# RUN: dsymutil -s %t/private/var/folders/tmp/test-rel-symlink | grep 'N_OSO' | FileCheck %s -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT-EXPLICIT

## Check that we don't emit DWARF or stabs when -S is used
Expand All @@ -82,10 +90,11 @@
## expect to not find any entries which requires the exit code to be negated.
# RUN: llvm-nm -ap %t/test-no-debug | not grep -e ' - '

# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.a no-debug.o -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.a no-debug.o -o %t/test
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out

# CHECK: Sections:
# CHECK-NEXT: Idx Name
Expand Down Expand Up @@ -159,7 +168,9 @@
## when forming N_SO.
# RUN: llvm-mc -filetype obj -triple=x86_64-apple-darwin %t/abs-path.s -o %t/abs-path.o
# RUN: %lld %t/abs-path.o -o %t/test
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | FileCheck %s --check-prefix=ABS-PATH
# RUN: llvm-objdump --section-headers %t/test > %t.out
# RUN: dsymutil -s %t/test >> %t.out
# RUN: FileCheck %s --check-prefix=ABS-PATH --input-file %t.out
# ABS-PATH: (N_SO ) 00 0000 0000000000000000 '/foo.cpp'

#--- test.s
Expand Down
Loading