2015-10-01 07:15:35 +08:00
|
|
|
# REQUIRES: x86
|
2015-10-11 11:28:42 +08:00
|
|
|
# RUN: mkdir -p %t.dir
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
2015-10-11 11:28:42 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/libsearch-st.s -o %t2.o
|
|
|
|
# RUN: rm -f %t.dir/libxyz.a
|
|
|
|
# RUN: llvm-ar rcs %t.dir/libxyz.a %t2.o
|
2015-10-01 07:15:35 +08:00
|
|
|
|
|
|
|
# RUN: echo "GROUP(" %t ")" > %t.script
|
2015-10-08 01:31:39 +08:00
|
|
|
# RUN: ld.lld2 -o %t2 %t.script
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
2015-10-11 09:31:57 +08:00
|
|
|
# RUN: echo "INPUT(" %t ")" > %t.script
|
|
|
|
# RUN: ld.lld2 -o %t2 %t.script
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
2015-10-11 11:28:42 +08:00
|
|
|
# RUN: echo "GROUP(" %t libxyz.a ")" > %t.script
|
|
|
|
# RUN: not ld.lld2 -o %t2 %t.script
|
|
|
|
# RUN: ld.lld2 -o %t2 %t.script -L%t.dir
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
|
|
|
# RUN: echo "GROUP(" %t =libxyz.a ")" > %t.script
|
|
|
|
# RUN: not ld.lld2 -o %t2 %t.script
|
|
|
|
# RUN: ld.lld2 -o %t2 %t.script --sysroot=%t.dir
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
|
|
|
# RUN: echo "GROUP(" %t -lxyz ")" > %t.script
|
|
|
|
# RUN: not ld.lld2 -o %t2 %t.script
|
|
|
|
# RUN: ld.lld2 -o %t2 %t.script -L%t.dir
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
|
|
|
# RUN: echo "GROUP(" %t libxyz.a ")" > %t.script
|
|
|
|
# RUN: not ld.lld2 -o %t2 %t.script
|
|
|
|
# RUN: ld.lld2 -o %t2 %t.script -L%t.dir
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
2015-10-01 23:45:41 +08:00
|
|
|
# RUN: echo "GROUP(" %t.script2 ")" > %t.script1
|
|
|
|
# RUN: echo "GROUP(" %t ")" > %t.script2
|
2015-10-08 01:31:39 +08:00
|
|
|
# RUN: ld.lld2 -o %t2 %t.script1
|
2015-10-01 23:45:41 +08:00
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
2015-10-08 14:48:38 +08:00
|
|
|
# RUN: echo "ENTRY(_label)" > %t.script
|
|
|
|
# RUN: ld.lld2 -o %t2 %t.script %t
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
|
|
|
# RUN: echo "ENTRY(_wrong_label)" > %t.script
|
|
|
|
# RUN: not lld -flavor gnu2 -o %t2 %t.script %t > %t.log 2>&1
|
|
|
|
# RUN: FileCheck -check-prefix=ERR-ENTRY %s < %t.log
|
|
|
|
|
|
|
|
# ERR-ENTRY: undefined symbol: _wrong_label
|
|
|
|
|
|
|
|
# -e has precedence over linker script's ENTRY.
|
|
|
|
# RUN: echo "ENTRY(_label)" > %t.script
|
|
|
|
# RUN: ld.lld2 -e _start -o %t2 %t.script %t
|
|
|
|
# RUN: llvm-readobj -file-headers -symbols %t2 | \
|
|
|
|
# RUN: FileCheck -check-prefix=ENTRY-OVERLOAD %s
|
|
|
|
|
|
|
|
# ENTRY-OVERLOAD: Entry: [[ENTRY:0x[0-9A-F]+]]
|
|
|
|
# ENTRY-OVERLOAD: Name: _start
|
|
|
|
# ENTRY-OVERLOAD-NEXT: Value: [[ENTRY]]
|
|
|
|
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: echo "OUTPUT_FORMAT(\"elf64-x86-64\") /*/*/ GROUP(" %t ")" > %t.script
|
2015-10-08 01:31:39 +08:00
|
|
|
# RUN: ld.lld2 -o %t2 %t.script
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
|
|
|
# RUN: echo "GROUP(AS_NEEDED(" %t "))" > %t.script
|
2015-10-08 01:31:39 +08:00
|
|
|
# RUN: ld.lld2 -o %t2 %t.script
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
2015-10-07 08:25:09 +08:00
|
|
|
# RUN: rm -f %t.out
|
|
|
|
# RUN: echo "OUTPUT(" %t.out ")" > %t.script
|
2015-10-08 01:31:39 +08:00
|
|
|
# RUN: ld.lld2 %t.script %t
|
2015-10-07 08:25:09 +08:00
|
|
|
# RUN: llvm-readobj %t.out > /dev/null
|
|
|
|
|
2015-10-09 01:51:41 +08:00
|
|
|
# RUN: echo "SEARCH_DIR(/lib/foo/blah)" > %t.script
|
|
|
|
# RUN: ld.lld2 %t.script %t
|
|
|
|
# RUN: llvm-readobj %t.out > /dev/null
|
|
|
|
|
2015-10-11 09:31:55 +08:00
|
|
|
# RUN: echo "INCLUDE " %t.script2 "OUTPUT(" %t.out ")" > %t.script1
|
|
|
|
# RUN: echo "GROUP(" %t ")" > %t.script2
|
|
|
|
# RUN: ld.lld2 %t.script1
|
|
|
|
# RUN: llvm-readobj %t2 > /dev/null
|
|
|
|
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: echo "FOO(BAR)" > %t.script
|
2015-10-09 04:57:29 +08:00
|
|
|
# RUN: not ld.lld2 -o foo %t.script > %t.log 2>&1
|
2015-10-01 07:15:35 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ERR1 %s < %t.log
|
|
|
|
|
|
|
|
# ERR1: unknown directive: FOO
|
|
|
|
|
2015-10-08 14:48:38 +08:00
|
|
|
.globl _start, _label;
|
2015-10-01 07:15:35 +08:00
|
|
|
_start:
|
|
|
|
mov $60, %rax
|
|
|
|
mov $42, %rdi
|
2015-10-08 14:48:38 +08:00
|
|
|
_label:
|
2015-10-01 07:15:35 +08:00
|
|
|
syscall
|