llvm-project/lld/test/ELF/invalid-dynamic-list.test
Adhemerval Zanella 9df0720766 ELF: Implement --dynamic-list
This patch implements the --dynamic-list option, which adds a list of
global symbol that either should not be bounded by default definition
when creating shared libraries, or add in dynamic symbol table in the
case of creating executables.

The patch modifies the ScriptParserBase class to use a list of Token
instead of StringRef, which contains information if the token is a
quoted or unquoted strings. It is used to use a faster search for
exact match symbol name.

The input file follow a similar format of linker script with some
simplifications (it does not have scope or node names). It leads
to a simplified parser define in DynamicList.{cpp,h}.

Different from ld/gold neither glob pattern nor mangled names
(extern 'C++') are currently supported.

llvm-svn: 266227
2016-04-13 18:51:11 +00:00

38 lines
1.4 KiB
Plaintext

## 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
# RUN: mkdir -p %t.dir
# RUN: echo foobar > %t1
# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR1 %s
# ERR1: line 1: { expected, but got foobar
# RUN: echo "{ foobar;" > %t1
# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR2 %s
# ERR2: line 1: unexpected EOF
## Missing ';' before '}'
# RUN: echo "{ foobar }" > %t1
# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR3 %s
# ERR3: line 1: ; expected, but got }
## Missing final ';'
# RUN: echo "{ foobar; }" > %t1
# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR4 %s
# ERR4: line 1: unexpected EOF
## Missing \" in foobar definition
# RUN echo "{ \"foobar; };" > %t1
# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR5 %s
# ERR5: line 1: unexpected EOF
# RUN: echo "{ extern \"BOGUS\" { test }; };" > %t1
# RUN: not ld.lld --dynamic-list %t1 2>&1 | FileCheck -check-prefix=ERR6 %s
# ERR6: line 1: ; expected, but got BOGUS