2016-02-03 05:58:39 +08:00
|
|
|
## Different "echo" commands on Windows interpret quoted strings and
|
|
|
|
## wildcards in similar but different way (On Windows, ARGV tokenization
|
|
|
|
## and wildcard expansion are not done by the shell but by each command.)
|
|
|
|
## Because of that reason, this test fails on some Windows environment.
|
|
|
|
## We can't write quoted strings that are interpreted the same way
|
|
|
|
## by all echo commands. So, we don't want to run this on Windows.
|
|
|
|
|
|
|
|
# REQUIRES: shell
|
|
|
|
|
2016-02-03 04:27:59 +08:00
|
|
|
# RUN: mkdir -p %t.dir
|
|
|
|
|
2016-02-25 06:47:41 +08:00
|
|
|
## Note that we are using "cannot open no-such-file: " as a marker that the
|
|
|
|
## linker keep going when it found an error. That specific error message is not
|
|
|
|
## related to the linker script tests.
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo foobar > %t1
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t1 no-such-file 2>&1 | FileCheck -check-prefix=ERR1 %s
|
2016-08-18 12:34:27 +08:00
|
|
|
# ERR1: unexpected EOF
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR1: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "foo \"bar" > %t2
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t2 no-such-file 2>&1 | FileCheck -check-prefix=ERR2 %s
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR2: unclosed quote
|
|
|
|
# ERR2: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "/*" > %t3
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t3 no-such-file 2>&1 | FileCheck -check-prefix=ERR3 %s
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR3: unclosed comment
|
|
|
|
# ERR3: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "EXTERN (" > %t4
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t4 no-such-file 2>&1 | FileCheck -check-prefix=ERR4 %s
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR4: unexpected EOF
|
|
|
|
# ERR4: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "EXTERN (" > %t5
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t5 no-such-file 2>&1 | FileCheck -check-prefix=ERR5 %s
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR5: unexpected EOF
|
|
|
|
# ERR5: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "EXTERN xyz" > %t6
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t6 no-such-file 2>&1 | FileCheck -check-prefix=ERR6 %s
|
2016-02-03 04:27:59 +08:00
|
|
|
# ERR6: ( expected, but got xyz
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR6: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "INCLUDE /no/such/file" > %t7
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t7 no-such-file 2>&1 | FileCheck -check-prefix=ERR7 %s
|
2017-11-20 23:43:20 +08:00
|
|
|
# ERR7: cannot find linker script /no/such/file
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR7: cannot open no-such-file:
|
2016-02-03 04:27:59 +08:00
|
|
|
|
|
|
|
# RUN: echo "OUTPUT_FORMAT(x y z)" > %t8
|
2016-02-24 04:36:20 +08:00
|
|
|
# RUN: not ld.lld %t8 no-such-file 2>&1 | FileCheck -check-prefix=ERR8 %s
|
Add OUTPUT_FORMAT linker script directive support.
This patch adds a support for OUTPUT_FORMAT linker script directive.
Since I'm not 100% confident with BFD names you can use in the directive
for all architectures, I added only a few in this patch. We can add
other names for other archtiectures later.
We still do not support triple-style OUTPUT_FORMAT directive, namely,
OUTPUT_FORMAT(bfdname, big, little). If you pass -EL (little endian)
or -EB (big endian) to the linker, GNU linkers pick up big or little
as a BFD name, correspondingly, so that you can use a single linker
script for bi-endian processor. I'm not sure if we really need to
support that, so I'll leave it alone for now.
Note that -m takes precedence over OUTPUT_FORAMT, but we always parse
a BFD name given to OUTPUT_FORMAT for error checking. You cannot write
an invalid name in the OUTPUT_FORMAT directive.
Differential Revision: https://reviews.llvm.org/D53495
llvm-svn: 344952
2018-10-23 04:50:01 +08:00
|
|
|
# RUN: not ld.lld -m elf_amd64 %t8 no-such-file 2>&1 | FileCheck -check-prefix=ERR8 %s
|
2021-02-09 02:34:57 +08:00
|
|
|
# ERR8: , expected, but got y
|
2016-03-11 22:43:02 +08:00
|
|
|
# ERR8: cannot open no-such-file:
|
Add OUTPUT_FORMAT linker script directive support.
This patch adds a support for OUTPUT_FORMAT linker script directive.
Since I'm not 100% confident with BFD names you can use in the directive
for all architectures, I added only a few in this patch. We can add
other names for other archtiectures later.
We still do not support triple-style OUTPUT_FORMAT directive, namely,
OUTPUT_FORMAT(bfdname, big, little). If you pass -EL (little endian)
or -EB (big endian) to the linker, GNU linkers pick up big or little
as a BFD name, correspondingly, so that you can use a single linker
script for bi-endian processor. I'm not sure if we really need to
support that, so I'll leave it alone for now.
Note that -m takes precedence over OUTPUT_FORAMT, but we always parse
a BFD name given to OUTPUT_FORMAT for error checking. You cannot write
an invalid name in the OUTPUT_FORMAT directive.
Differential Revision: https://reviews.llvm.org/D53495
llvm-svn: 344952
2018-10-23 04:50:01 +08:00
|
|
|
|
|
|
|
# RUN: echo "OUTPUT_FORMAT(elf64-x86-64 y z)" > %t9
|
|
|
|
# RUN: not ld.lld %t9 no-such-file 2>&1 | FileCheck -check-prefix=ERR9 %s
|
|
|
|
# ERR9: , expected, but got y
|
|
|
|
# ERR9: cannot open no-such-file:
|