diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-15 21:33:11 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-15 21:33:11 +0000 |
commit | 7ce1bc71f477b4ff8afc40e0cb766f85a139a1a1 (patch) | |
tree | af2a30ed50aca6759f664f59e2722a3e337d5706 | |
parent | 367635d94aab470827d4dab267848d13579d141e (diff) | |
download | bcm5719-llvm-7ce1bc71f477b4ff8afc40e0cb766f85a139a1a1.tar.gz bcm5719-llvm-7ce1bc71f477b4ff8afc40e0cb766f85a139a1a1.zip |
Document an interesting LTO case.
This is a reduction from the only symbol in a build of clang that the
gold plugin internalizes but lld does not.
llvm-svn: 272845
-rw-r--r-- | lld/test/ELF/lto/Inputs/unnamed-addr-lib.s | 6 | ||||
-rw-r--r-- | lld/test/ELF/lto/unnamed-addr-lib.ll | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lld/test/ELF/lto/Inputs/unnamed-addr-lib.s b/lld/test/ELF/lto/Inputs/unnamed-addr-lib.s new file mode 100644 index 00000000000..e6ebce024f0 --- /dev/null +++ b/lld/test/ELF/lto/Inputs/unnamed-addr-lib.s @@ -0,0 +1,6 @@ + .protected foo + .global foo +foo: + + .global bar +bar: diff --git a/lld/test/ELF/lto/unnamed-addr-lib.ll b/lld/test/ELF/lto/unnamed-addr-lib.ll new file mode 100644 index 00000000000..c1c31f84bc8 --- /dev/null +++ b/lld/test/ELF/lto/unnamed-addr-lib.ll @@ -0,0 +1,21 @@ +; REQUIRES: x86 +; RUN: llvm-as %s -o %t.o +; RUN: llvm-mc %p/Inputs/unnamed-addr-lib.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux +; RUN: ld.lld %t2.o -shared -o %t2.so +; RUN: ld.lld -m elf_x86_64 %t.o %t2.so -o %t.so -save-temps -shared +; RUN: llvm-dis %t.so.lto.bc -o - | FileCheck %s + +; This documents a small limitation of lld's internalization logic. We decide +; that bar should be in the symbol table because if it is it will preempt the +; one in the shared library. +; We could add one extra bit for ODR so that we know that preemption is not +; necessary, but that is probably not worth it. + +; CHECK: @foo = internal unnamed_addr constant i8 42 +; CHECK: @bar = weak_odr unnamed_addr constant i8 42 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@foo = linkonce_odr unnamed_addr constant i8 42 +@bar = linkonce_odr unnamed_addr constant i8 42 |