diff options
| author | Simon Atanasyan <simon@atanasyan.com> | 2014-07-15 17:17:30 +0000 |
|---|---|---|
| committer | Simon Atanasyan <simon@atanasyan.com> | 2014-07-15 17:17:30 +0000 |
| commit | 64c0ac2b35df65e38c966089f9a7ab9075bf7f58 (patch) | |
| tree | c2093bee27114d037493703dc539241db0ab021e /lld/test/LinkerScript | |
| parent | bc94c94be40d289948b4043fe4d973295061e484 (diff) | |
| download | bcm5719-llvm-64c0ac2b35df65e38c966089f9a7ab9075bf7f58.tar.gz bcm5719-llvm-64c0ac2b35df65e38c966089f9a7ab9075bf7f58.zip | |
[ELF] Implement parsing `-l` prefixed items in the `GROUP` linker script command.
There are two forms of `-l` prefixed expression:
* -l<libname>
* -l:<filename>
In the first case a linker should construct a full library name
`lib + libname + .[so|a]` and search this library as usual. In the second case
a linker should use the `<filename>` as is and search this file through library
search directories.
The patch reviewed by Shankar Easwaran.
llvm-svn: 213077
Diffstat (limited to 'lld/test/LinkerScript')
| -rw-r--r-- | lld/test/LinkerScript/libname-err-1.test | 11 | ||||
| -rw-r--r-- | lld/test/LinkerScript/libname-err-2.test | 11 | ||||
| -rw-r--r-- | lld/test/LinkerScript/linker-script.test | 6 |
3 files changed, 26 insertions, 2 deletions
diff --git a/lld/test/LinkerScript/libname-err-1.test b/lld/test/LinkerScript/libname-err-1.test new file mode 100644 index 00000000000..a31b35e93e3 --- /dev/null +++ b/lld/test/LinkerScript/libname-err-1.test @@ -0,0 +1,11 @@ +/* RUN: linker-script-test %s 2>&1 | FileCheck %s +*/ + +OUTPUT_ARCH(i386:x86_64) +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") +GROUP( -l### ) +ENTRY(init) + +/* +CHECK: test/LinkerScript/libname-err-1.test:6:10: error: expected ) +*/ diff --git a/lld/test/LinkerScript/libname-err-2.test b/lld/test/LinkerScript/libname-err-2.test new file mode 100644 index 00000000000..1e300947a96 --- /dev/null +++ b/lld/test/LinkerScript/libname-err-2.test @@ -0,0 +1,11 @@ +/* RUN: linker-script-test %s 2>&1 | FileCheck %s +*/ + +OUTPUT_ARCH(i386:x86_64) +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") +GROUP( -l ) +ENTRY(init) + +/* +CHECK: test/LinkerScript/libname-err-2.test:6:10: error: expected ) +*/ diff --git a/lld/test/LinkerScript/linker-script.test b/lld/test/LinkerScript/linker-script.test index a050c5637a5..4c6643566c7 100644 --- a/lld/test/LinkerScript/linker-script.test +++ b/lld/test/LinkerScript/linker-script.test @@ -3,7 +3,7 @@ OUTPUT_ARCH(i386:x86_64) OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") -GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) ) +GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) -lm -l:libgcc.a ) ENTRY(init) /* @@ -27,6 +27,8 @@ CHECK: kw_as_needed: AS_NEEDED CHECK: l_paren: ( CHECK: identifier: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 CHECK: r_paren: ) +CHECK: libname: m +CHECK: libname: :libgcc.a CHECK: r_paren: ) CHECK: kw_entry: ENTRY CHECK: l_paren: ( @@ -34,6 +36,6 @@ CHECK: identifier: init CHECK: r_paren: ) CHECK: eof: CHECK: OUTPUT_FORMAT(elf64-x86-64,elf64-x86-64,elf64-x86-64) -CHECK: GROUP(/lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED(/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)) +CHECK: GROUP(/lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED(/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) -lm -l:libgcc.a) CHECK: ENTRY(init) */ |

