2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pe 2>&1 | FileCheck -check-prefix=X86 %s
|
2017-09-13 00:29:07 +08:00
|
|
|
X86: -out:a.exe
|
|
|
|
X86-SAME: -machine:x86
|
|
|
|
X86-SAME: -alternatename:__image_base__=___ImageBase
|
|
|
|
X86-SAME: foo.o
|
|
|
|
|
2019-06-11 04:10:10 +08:00
|
|
|
RUN: echo "-### foo.o -m i386pe" > %t.rsp
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld @%t.rsp 2>&1 | FileCheck -check-prefix=X86 %s
|
2019-06-11 04:10:10 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep 2>&1 | FileCheck -check-prefix=X64 %s
|
2017-09-13 00:29:07 +08:00
|
|
|
X64: -out:a.exe
|
|
|
|
X64-SAME: -machine:x64
|
|
|
|
X64-SAME: -alternatename:__image_base__=__ImageBase
|
|
|
|
X64-SAME: foo.o
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m thumb2pe 2>&1 | FileCheck -check-prefix=ARM %s
|
2017-09-13 00:29:07 +08:00
|
|
|
ARM: -out:a.exe
|
|
|
|
ARM-SAME: -machine:arm
|
|
|
|
ARM-SAME: -alternatename:__image_base__=__ImageBase
|
|
|
|
ARM-SAME: foo.o
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m arm64pe 2>&1 | FileCheck -check-prefix=ARM64 %s
|
2017-09-13 00:29:07 +08:00
|
|
|
ARM64: -out:a.exe
|
|
|
|
ARM64-SAME: -machine:arm64
|
|
|
|
ARM64-SAME: -alternatename:__image_base__=__ImageBase
|
|
|
|
ARM64-SAME: foo.o
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -shared 2>&1 | FileCheck -check-prefix=SHARED %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --shared 2>&1 | FileCheck -check-prefix=SHARED %s
|
2017-09-13 00:29:07 +08:00
|
|
|
SHARED: -out:a.dll
|
|
|
|
SHARED-SAME: -dll
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -shared foo.def 2>&1 | FileCheck -check-prefix=DEF1 %s
|
2017-09-15 02:33:09 +08:00
|
|
|
DEF1: -def:foo.def
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -shared FOO.DEF 2>&1 | FileCheck -check-prefix=DEF2 %s
|
2017-09-15 02:33:09 +08:00
|
|
|
DEF2: -def:FOO.DEF
|
2017-09-13 15:28:13 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -obar.exe 2>&1 | FileCheck -check-prefix=OUT %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -o bar.exe 2>&1 | FileCheck -check-prefix=OUT %s
|
2017-09-13 00:29:07 +08:00
|
|
|
OUT: -out:bar.exe
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --out-implib bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --out-implib=bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -out-implib bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -out-implib=bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
|
2017-09-15 03:45:22 +08:00
|
|
|
IMPLIB: -implib:bar
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -e bar 2>&1 | FileCheck -check-prefix=ENTRY %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -ebar 2>&1 | FileCheck -check-prefix=ENTRY %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -entry bar 2>&1 | FileCheck -check-prefix=ENTRY %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --entry bar 2>&1 | FileCheck -check-prefix=ENTRY %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -entry=bar 2>&1 | FileCheck -check-prefix=ENTRY %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --entry=bar 2>&1 | FileCheck -check-prefix=ENTRY %s
|
2017-09-13 00:29:07 +08:00
|
|
|
ENTRY: -entry:bar
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -mllvm bar -mllvm baz 2>&1 | FileCheck -check-prefix=MLLVM %s
|
2017-09-13 00:29:07 +08:00
|
|
|
MLLVM: -mllvm:bar -mllvm:baz
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -subsystem console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --subsystem console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -subsystem=console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --subsystem=console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
|
2017-09-13 00:29:07 +08:00
|
|
|
SUBSYSTEM: -subsystem:console
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-os-version 7 --minor-os-version 8 2>&1 | FileCheck -check-prefix=OS_VERSION %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-os-version=7 --minor-os-version=8 2>&1 | FileCheck -check-prefix=OS_VERSION %s
|
2020-10-04 16:52:36 +08:00
|
|
|
OS_VERSION: -osversion:7.8 -subsystem:default,6.0
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 7 --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_VERSION %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version=7 --minor-subsystem-version=8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_VERSION %s
|
2020-10-04 16:52:36 +08:00
|
|
|
SUBSYSTEM_VERSION: -osversion:6.0 -subsystem:default,7.8
|
2019-06-15 01:50:35 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_DEFAULT_MAJOR %s
|
2019-06-15 01:50:35 +08:00
|
|
|
SUBSYSTEM_DEFAULT_MAJOR: -subsystem:default,6.8
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 7 2>&1 | FileCheck -check-prefix=SUBSYSTEM_DEFAULT_MINOR %s
|
2020-10-04 16:52:36 +08:00
|
|
|
SUBSYSTEM_DEFAULT_MINOR: -subsystem:default,7.0
|
2019-06-15 01:50:35 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --subsystem windows --major-subsystem-version 7 --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 7 --minor-subsystem-version 8 --subsystem windows 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --subsystem windows:7.8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --subsystem windows:2.3 --major-subsystem-version 7 --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --subsystem windows:7.8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 2 --minor-subsystem-version 3 --subsystem windows:7.8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 2 --minor-subsystem-version 8 --subsystem windows:7 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
|
2019-06-15 01:50:35 +08:00
|
|
|
SUBSYSTEM_WINDOWS: -subsystem:windows,7.8
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -stack 4194304,8192 2>&1 | FileCheck -check-prefix=STACK %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --stack 4194304,8192 2>&1 | FileCheck -check-prefix=STACK %s
|
2021-08-02 04:26:25 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep --stack=4194304,8192 2>&1 | FileCheck -check-prefix=STACK %s
|
2017-09-13 00:29:07 +08:00
|
|
|
STACK: -stack:4194304,8192
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
|
2017-09-13 00:29:07 +08:00
|
|
|
VERBOSE: -verbose
|
2017-09-13 03:23:54 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -shared -m i386pe -e _DllMainCRTStartup@12 foo.o 2>&1 | FileCheck -check-prefix I386-ENTRY %s
|
2017-09-13 03:23:54 +08:00
|
|
|
I386-ENTRY: -entry:DllMainCRTStartup@12
|
2017-09-13 15:28:09 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --whole-archive bar.a --no-whole-archive baz.a 2>&1 | FileCheck -check-prefix WHOLE-ARCHIVE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -whole-archive bar.a -no-whole-archive baz.a 2>&1 | FileCheck -check-prefix WHOLE-ARCHIVE %s
|
2017-09-13 15:28:09 +08:00
|
|
|
WHOLE-ARCHIVE: foo.o -wholearchive:bar.a baz.a
|
2017-09-14 03:29:39 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix MINGW-FLAG %s
|
2021-06-18 19:29:55 +08:00
|
|
|
MINGW-FLAG: lld-link -lldmingw
|
2017-10-12 13:37:18 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --exclude-all-symbols 2>&1 | FileCheck -check-prefix EXCLUDE-ALL %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -exclude-all-symbols 2>&1 | FileCheck -check-prefix EXCLUDE-ALL %s
|
2019-02-20 05:57:49 +08:00
|
|
|
EXCLUDE-ALL: -exclude-all-symbols
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --export-all-symbols 2>&1 | FileCheck -check-prefix EXPORT-ALL %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -export-all-symbols 2>&1 | FileCheck -check-prefix EXPORT-ALL %s
|
2017-10-12 13:37:18 +08:00
|
|
|
EXPORT-ALL: -export-all-symbols
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --output-def out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --output-def=out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -output-def out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -output-def=out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
|
2017-10-12 13:37:18 +08:00
|
|
|
OUTPUT-DEF: -output-def:out.def
|
2017-11-03 15:18:37 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -Xlink=-lldmap 2>&1 | FileCheck -check-prefix XLINK %s
|
2017-11-03 15:18:37 +08:00
|
|
|
XLINK: -lldmap
|
2017-11-04 06:10:37 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix DEBUG %s
|
2017-11-04 06:10:37 +08:00
|
|
|
DEBUG: -debug:dwarf
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -s 2>&1 | FileCheck -check-prefix STRIP %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --strip-all 2>&1 | FileCheck -check-prefix STRIP %s
|
2017-11-04 06:10:37 +08:00
|
|
|
STRIP-NOT: -debug:dwarf
|
2017-11-15 16:18:06 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -S 2>&1 | FileCheck -check-prefix STRIP-DEBUG %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --strip-debug 2>&1 | FileCheck -check-prefix STRIP-DEBUG %s
|
2018-06-29 14:08:31 +08:00
|
|
|
STRIP-DEBUG: -debug:symtab
|
|
|
|
STRIP-DEBUG-NOT: -debug:dwarf
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -pdb out.pdb 2>&1 | FileCheck -check-prefix PDB %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -pdb=out.pdb 2>&1 | FileCheck -check-prefix PDB %s
|
2018-05-15 14:34:18 +08:00
|
|
|
PDB: -debug -pdb:out.pdb
|
|
|
|
PDB-NOT: -debug:dwarf
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -pdb= 2>&1 | FileCheck -check-prefix PDB-DEFAULT %s
|
2019-05-17 19:07:33 +08:00
|
|
|
PDB-DEFAULT: -debug
|
|
|
|
PDB-DEFAULT-NOT: -pdb:{{.*}}
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --large-address-aware 2>&1 | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
|
2017-11-15 16:18:06 +08:00
|
|
|
LARGE-ADDRESS-AWARE: -largeaddressaware
|
2017-11-15 16:18:11 +08:00
|
|
|
|
2021-08-12 04:41:24 +08:00
|
|
|
RUN: ld.lld -### -m i386pe foo.o --dynamicbase --no-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --dynamicbase --disable-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
|
2020-08-26 21:02:52 +08:00
|
|
|
DISABLE-DYNAMICBASE: -dynamicbase:no
|
2021-08-12 04:41:24 +08:00
|
|
|
RUN: ld.lld -### -m i386pe --disable-dynamicbase --dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep -dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
|
|
|
RUN: ld.lld -### -m thumb2pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
|
|
|
RUN: ld.lld -### -m arm64pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
2020-08-26 21:02:52 +08:00
|
|
|
# On arm, dynamicbase can't be disabled, so --no-dynamicbase is ignored
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m thumb2pe foo.o --no-dynamicbase 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
|
|
|
RUN: ld.lld -### -m arm64pe foo.o --no-dynamicbase 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
|
2020-08-26 21:02:52 +08:00
|
|
|
NO-DISABLE-DYNAMICBASE-NOT: -dynamicbase:no
|
2017-11-15 16:18:15 +08:00
|
|
|
|
2021-08-12 04:41:24 +08:00
|
|
|
RUN: ld.lld -### -m i386pe foo.o -high-entropy-va -disable-high-entropy-va 2>&1 | FileCheck -check-prefix DISABLE-HIGH-ENTROPY-VA %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --high-entropy-va --disable-high-entropy-va 2>&1 | FileCheck -check-prefix DISABLE-HIGH-ENTROPY-VA %s
|
|
|
|
DISABLE-HIGH-ENTROPY-VA: -highentropyva:no
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -disable-high-entropy-va -high-entropy-va 2>&1 | FileCheck -check-prefix NO-DISABLE-HIGH-ENTROPY-VA %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --disable-high-entropy-va --high-entropy-va 2>&1 | FileCheck -check-prefix NO-DISABLE-HIGH-ENTROPY-VA %s
|
|
|
|
NO-DISABLE-HIGH-ENTROPY-VA-NOT: -highentropyva:no
|
|
|
|
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -nxcompat -disable-nxcompat 2>&1 | FileCheck -check-prefix DISABLE-NXCOMPAT %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --nxcompat --disable-nxcompat 2>&1 | FileCheck -check-prefix DISABLE-NXCOMPAT %s
|
|
|
|
DISABLE-NXCOMPAT: -nxcompat:no
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -disable-nxcompat -nxcompat 2>&1 | FileCheck -check-prefix NO-DISABLE-NXCOMPAT %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --disable-nxcompat --nxcompat 2>&1 | FileCheck -check-prefix NO-DISABLE-NXCOMPAT %s
|
|
|
|
NO-DISABLE-NXCOMPAT-NOT: -nxcompat:no
|
|
|
|
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -tsaware -disable-tsaware 2>&1 | FileCheck -check-prefix DISABLE-TSAWARE %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --tsaware --disable-tsaware 2>&1 | FileCheck -check-prefix DISABLE-TSAWARE %s
|
|
|
|
DISABLE-TSAWARE: -tsaware:no
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -disable-tsaware -tsaware 2>&1 | FileCheck -check-prefix NO-DISABLE-TSAWARE %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --disable-tsaware --tsaware 2>&1 | FileCheck -check-prefix NO-DISABLE-TSAWARE %s
|
|
|
|
NO-DISABLE-TSAWARE-NOT: -tsaware:no
|
|
|
|
|
2022-06-10 15:57:40 +08:00
|
|
|
RUN: ld.lld -### -m i386pe foo.o -enable-reloc-section -disable-reloc-section 2>&1 | FileCheck -check-prefix DISABLE-RELOC-SECTION %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --enable-reloc-section --disable-reloc-section 2>&1 | FileCheck -check-prefix DISABLE-RELOC-SECTION %s
|
|
|
|
DISABLE-RELOC-SECTION: -fixed{{ }}
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -disable-reloc-section -enable-reloc-section 2>&1 | FileCheck -check-prefix NO-DISABLE-RELOC-SECTION %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --disable-reloc-section --enable-reloc-section 2>&1 | FileCheck -check-prefix NO-DISABLE-RELOC-SECTION %s
|
|
|
|
NO-DISABLE-RELOC-SECTION-NOT: -fixed
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
|
2021-08-02 16:44:04 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --image-base=0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
|
2017-11-15 16:18:15 +08:00
|
|
|
IMAGE-BASE: -base:0x1230000
|
2017-11-15 16:18:20 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-GC-SECTIONS %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --gc-sections --no-gc-sections 2>&1 | FileCheck -check-prefix NO-GC-SECTIONS %s
|
2017-11-15 16:18:20 +08:00
|
|
|
NO-GC-SECTIONS: -opt:noref
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --gc-sections 2>&1 | FileCheck -check-prefix GC-SECTIONS %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -gc-sections 2>&1 | FileCheck -check-prefix GC-SECTIONS %s
|
2017-11-15 16:18:20 +08:00
|
|
|
GC-SECTIONS: -opt:ref
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ICF-NONE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --icf=none 2>&1 | FileCheck -check-prefix ICF-NONE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -icf=none 2>&1 | FileCheck -check-prefix ICF-NONE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --icf=safe 2>&1 | FileCheck -check-prefix ICF-NONE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -icf=safe 2>&1 | FileCheck -check-prefix ICF-NONE %s
|
2017-11-15 16:18:20 +08:00
|
|
|
ICF-NONE: -opt:noicf
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --icf=all 2>&1 | FileCheck -check-prefix ICF %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -icf=all 2>&1 | FileCheck -check-prefix ICF %s
|
2021-08-02 16:44:04 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --icf all 2>&1 | FileCheck -check-prefix ICF %s
|
2017-11-15 16:18:20 +08:00
|
|
|
ICF: -opt:icf
|
2018-03-02 04:38:38 +08:00
|
|
|
|
2021-06-18 20:20:13 +08:00
|
|
|
RUN: ld.lld -### -m i386pep --start-group foo.o --end-group 2> /dev/null
|
2018-03-15 04:17:24 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pe -shared --kill-at 2>&1 | FileCheck -check-prefix=KILL-AT %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pe -shared -kill-at 2>&1 | FileCheck -check-prefix=KILL-AT %s
|
2018-03-15 04:17:24 +08:00
|
|
|
KILL-AT: -kill-at
|
2018-05-16 05:12:29 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pep -Map bar.map 2>&1 | FileCheck -check-prefix=MAP %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --Map bar.map 2>&1 | FileCheck -check-prefix=MAP %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -Map=bar.map 2>&1 | FileCheck -check-prefix=MAP %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --Map=bar.map 2>&1 | FileCheck -check-prefix=MAP %s
|
2018-05-16 05:12:29 +08:00
|
|
|
MAP: -lldmap:bar.map
|
2018-09-11 01:41:40 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pe -require-defined _foo --require-defined _bar -require-defined=_baz --require-defined=_foo2 2>&1 | FileCheck -check-prefix=REQUIRE-DEFINED %s
|
2018-09-11 01:41:40 +08:00
|
|
|
REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2
|
2018-10-10 17:00:03 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pe -u _foo --undefined _bar -undefined=_baz --undefined=_foo2 -u_foo3 2>&1 | FileCheck -check-prefix=UNDEFINED %s
|
2019-08-14 17:35:44 +08:00
|
|
|
UNDEFINED: -includeoptional:_foo -includeoptional:_bar -includeoptional:_baz -includeoptional:_foo2 -includeoptional:_foo3
|
2019-06-09 02:26:24 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -Llibpath 2>&1 | FileCheck -check-prefix LIBPATH %s
|
2018-10-10 17:00:03 +08:00
|
|
|
LIBPATH: -libpath:libpath
|
2019-02-05 16:16:06 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --reproduce=foo.tar 2>&1 | FileCheck -check-prefix REPRO %s
|
2019-10-04 15:27:45 +08:00
|
|
|
REPRO: -reproduce:foo.tar
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp 2>&1 | FileCheck -check-prefix NOTIMESTAMP %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --insert-timestamp --no-insert-timestamp 2>&1 | FileCheck -check-prefix NOTIMESTAMP %s
|
2019-02-05 16:16:06 +08:00
|
|
|
NOTIMESTAMP: -timestamp:0
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp --insert-timestamp 2>&1 | FileCheck -check-prefix TIMESTAMP %s
|
2019-02-07 05:05:29 +08:00
|
|
|
TIMESTAMP-NOT: -timestamp:0
|
2019-04-19 21:50:43 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -appcontainer 2>&1 | FileCheck -check-prefix APPCONTAINER %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --appcontainer 2>&1 | FileCheck -check-prefix APPCONTAINER %s
|
2019-04-19 21:50:43 +08:00
|
|
|
APPCONTAINER: -appcontainer
|
2019-05-17 19:07:42 +08:00
|
|
|
|
2019-08-14 17:35:36 +08:00
|
|
|
RUN: ld.lld -m i386pep --version 2>&1 | FileCheck -check-prefix=VERSION %s
|
|
|
|
RUN: ld.lld -m i386pep -v 2>&1 | FileCheck -check-prefix=VERSION %s
|
|
|
|
RUN: not ld.lld -m i386pep -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
|
|
|
|
VERSION: LLD {{.*}} (compatible with GNU linkers)
|
|
|
|
|
|
|
|
RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
|
|
|
|
HELP: USAGE:
|
|
|
|
HELP: --enable-auto-import
|
2019-08-05 19:57:06 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -delayload user32.dll --delayload shell32.dll 2>&1 | FileCheck -check-prefix DELAYLOAD %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -delayload=user32.dll --delayload=shell32.dll 2>&1 | FileCheck -check-prefix DELAYLOAD %s
|
2019-08-05 19:57:06 +08:00
|
|
|
DELAYLOAD: -delayload:user32.dll -delayload:shell32.dll
|
2019-10-10 17:46:41 +08:00
|
|
|
|
|
|
|
RUN: not ld.lld -m i386pep -entry 2>&1 | FileCheck -check-prefix MISSING_ARG %s
|
|
|
|
MISSING_ARG: error: -entry: missing argument
|
|
|
|
|
|
|
|
RUN: not ld.lld -m i386pep --foo 2>&1 | FileCheck -check-prefix UNKNOWN_ARG %s
|
|
|
|
UNKNOWN_ARG: error: unknown argument: --foo
|
|
|
|
|
|
|
|
RUN: not ld.lld -m i386pep 2>&1 | FileCheck -check-prefix NO_INPUT_FILES %s
|
|
|
|
NO_INPUT_FILES: error: no input files
|
2020-04-26 05:49:44 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --disable-auto-import --enable-auto-import 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -enable-auto-import 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s
|
2020-04-26 05:49:44 +08:00
|
|
|
ENABLE_AUTO_IMPORT: -auto-import{{ }}
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --disable-auto-import 2>&1 | FileCheck -check-prefix DISABLE_AUTO_IMPORT %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -disable-auto-import 2>&1 | FileCheck -check-prefix DISABLE_AUTO_IMPORT %s
|
2020-04-26 05:49:44 +08:00
|
|
|
DISABLE_AUTO_IMPORT: -auto-import:no
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ENABLE_RUNTIME_PSEUDO_RELOC %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --disable-runtime-pseudo-reloc --enable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix ENABLE_RUNTIME_PSEUDO_RELOC %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -enable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix ENABLE_RUNTIME_PSEUDO_RELOC %s
|
2020-04-26 05:49:44 +08:00
|
|
|
ENABLE_RUNTIME_PSEUDO_RELOC: -runtime-pseudo-reloc{{ }}
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --disable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix DISABLE_RUNTIME_PSEUDO_RELOC %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -disable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix DISABLE_RUNTIME_PSEUDO_RELOC %s
|
2020-04-26 05:49:44 +08:00
|
|
|
DISABLE_RUNTIME_PSEUDO_RELOC: -runtime-pseudo-reloc:no
|
2020-05-24 17:29:16 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### foo.o -m i386pe --thinlto-cache-dir=_foo 2>&1 | FileCheck -check-prefix=THINLTO_CACHEDIR %s
|
2020-05-24 17:29:16 +08:00
|
|
|
THINLTO_CACHEDIR: -lldltocache:_foo
|
2020-07-14 05:12:13 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --file-alignment 0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -file-alignment 0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --file-alignment=0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -file-alignment=0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
|
2020-07-14 05:12:13 +08:00
|
|
|
FILEALIGN: -filealign:0x1000
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --section-alignment 0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -section-alignment 0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --section-alignment=0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -section-alignment=0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
|
2020-07-14 05:12:13 +08:00
|
|
|
ALIGN: -align:0x2000
|
2020-07-28 04:44:41 +08:00
|
|
|
|
2021-08-12 04:41:24 +08:00
|
|
|
RUN: ld.lld -### -m i386pe foo.o -disable-no-seh -no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --disable-no-seh --no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o -no-seh -disable-no-seh 2>&1 | FileCheck -check-prefix DISABLE-NOSEH %s
|
|
|
|
RUN: ld.lld -### -m i386pe foo.o --no-seh --disable-no-seh 2>&1 | FileCheck -check-prefix DISABLE-NOSEH %s
|
2020-07-28 04:44:41 +08:00
|
|
|
NOSEH: -noseh
|
2021-08-12 04:41:24 +08:00
|
|
|
DISABLE-NOSEH-NOT: -noseh
|
2020-08-26 14:25:52 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --no-allow-multiple-definition --allow-multiple-definition 2>&1 | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -no-allow-multiple-definition -allow-multiple-definition 2>&1 | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
|
2020-08-26 14:25:52 +08:00
|
|
|
ALLOW_MULTIPLE_DEFINITION: -force:multiple
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o --allow-multiple-definition --no-allow-multiple-definition 2>&1 | FileCheck -check-prefix NO_ALLOW_MULTIPLE_DEFINITION %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -allow-multiple-definition -no-allow-multiple-definition 2>&1 | FileCheck -check-prefix NO_ALLOW_MULTIPLE_DEFINITION %s
|
2020-08-26 14:25:52 +08:00
|
|
|
NO_ALLOW_MULTIPLE_DEFINITION-NOT: -force:multiple
|
2020-10-06 18:54:49 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -wrap foo1 --wrap foo2 2>&1 | FileCheck -check-prefix WRAP %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -wrap=foo1 --wrap=foo2 2>&1 | FileCheck -check-prefix WRAP %s
|
2020-10-06 18:54:49 +08:00
|
|
|
WRAP: -wrap:foo1 -wrap:foo2
|
2020-12-31 05:02:01 +08:00
|
|
|
|
2022-07-19 04:43:02 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -exclude-symbols sym1,sym2 --exclude-symbols sym3 2>&1 | FileCheck -check-prefix EXCLUDE_SYMBOLS %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -exclude-symbols=sym1,sym2 --exclude-symbols=sym3 2>&1 | FileCheck -check-prefix EXCLUDE_SYMBOLS %s
|
|
|
|
EXCLUDE_SYMBOLS: -exclude-symbols:sym1,sym2 -exclude-symbols:sym3
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix DEMANGLE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -demangle 2>&1 | FileCheck -check-prefix DEMANGLE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --demangle 2>&1 | FileCheck -check-prefix DEMANGLE %s
|
2020-12-31 05:02:01 +08:00
|
|
|
DEMANGLE: -demangle{{ }}
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -no-demangle 2>&1 | FileCheck -check-prefix NO-DEMANGLE %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --no-demangle 2>&1 | FileCheck -check-prefix NO-DEMANGLE %s
|
2020-12-31 05:02:01 +08:00
|
|
|
NO-DEMANGLE: -demangle:no
|
2021-05-17 15:39:59 +08:00
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o -fatal-warnings 2>&1 | FileCheck -check-prefix FATAL_WARNINGS %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --fatal-warnings 2>&1 | FileCheck -check-prefix FATAL_WARNINGS %s
|
2021-05-17 15:39:59 +08:00
|
|
|
FATAL_WARNINGS: -WX{{ }}
|
|
|
|
|
2021-06-18 19:33:28 +08:00
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-FATAL_WARNINGS %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o -no-fatal-warnings 2>&1 | FileCheck -check-prefix NO-FATAL_WARNINGS %s
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --no-fatal-warnings 2>&1 | FileCheck -check-prefix NO-FATAL_WARNINGS %s
|
2021-05-17 15:39:59 +08:00
|
|
|
NO-FATAL_WARNINGS: -WX:no
|
[LLD] [COFF] Fix up missing stdcall decorations in MinGW mode
If linking directly against a DLL without an import library, the
DLL export symbols might not contain stdcall decorations.
If we have an undefined symbol with decoration, and we happen to have
a matching undecorated symbol (which either is lazy and can be loaded,
or already defined), then alias it against that instead.
This matches what's done in reverse, when we have a def file
declaring to export a symbol without decoration, but we only have
a defined decorated symbol. In that case we do a fuzzy match
(SymbolTable::findMangle). This case is more straightforward; if we
have a decorated undefined symbol, just strip the decoration and look
for the corresponding undecorated symbol name.
Add warnings and options for either silencing the warning or disabling
the whole feature, corresponding to how ld.bfd does it.
(This feature works for any symbol decoration mismatch, not only when
linking against a DLL directly; ld.bfd also tolerates it anywhere,
and also fixes up mismatches in the other direction, like
SymbolTable::findMangle, for any symbol, not only exports. But in
practice, at least for lld, it would primarily end up used for linking
against DLLs.)
Differential Revision: https://reviews.llvm.org/D104532
2021-06-18 02:51:37 +08:00
|
|
|
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-FIXUP %s
|
|
|
|
NO-FIXUP-NOT: -stdcall-fixup
|
|
|
|
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --enable-stdcall-fixup --disable-stdcall-fixup 2>&1 | FileCheck -check-prefix DISABLE-FIXUP %s
|
|
|
|
DISABLE-FIXUP: -stdcall-fixup:no
|
|
|
|
|
|
|
|
RUN: ld.lld -### -m i386pep foo.o --disable-stdcall-fixup --enable-stdcall-fixup 2>&1 | FileCheck -check-prefix ENABLE-FIXUP %s
|
|
|
|
ENABLE-FIXUP: -stdcall-fixup{{ }}
|
2022-01-30 05:36:50 +08:00
|
|
|
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep -heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
|
|
|
|
RUN: ld.lld -### foo.o -m i386pep --heap=8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
|
|
|
|
HEAP: -heap:8388608,16384
|