diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-14 21:05:04 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-14 21:05:04 +0000 |
commit | b2f46d1dc7bb055fcbd647b07d0c441b8e69edc5 (patch) | |
tree | 4ccb98a8712966b2f738495d38398924dad292ae /llvm/test/LTO/Resolution | |
parent | 06a47806eee3f1c306b32be72c17e4cfb985c67c (diff) | |
download | bcm5719-llvm-b2f46d1dc7bb055fcbd647b07d0c441b8e69edc5.tar.gz bcm5719-llvm-b2f46d1dc7bb055fcbd647b07d0c441b8e69edc5.zip |
[LTO] Fix commons handling
Previously the prevailing information was not honored, and commons
symbols could override a strong definition. This patch fixes it and
propose the following semantic for commons: the client should mark
as prevailing the commons that it expects the LTO implementation to
merge (i.e. take the maximum size and alignment).
It implies that commons are allowed to have multiple prevailing
definitions.
Differential Revision: https://reviews.llvm.org/D24545
llvm-svn: 281538
Diffstat (limited to 'llvm/test/LTO/Resolution')
-rw-r--r-- | llvm/test/LTO/Resolution/X86/Inputs/commons.ll | 4 | ||||
-rw-r--r-- | llvm/test/LTO/Resolution/X86/commons.ll | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/LTO/Resolution/X86/Inputs/commons.ll b/llvm/test/LTO/Resolution/X86/Inputs/commons.ll new file mode 100644 index 00000000000..9372600d03d --- /dev/null +++ b/llvm/test/LTO/Resolution/X86/Inputs/commons.ll @@ -0,0 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@x = global i32 42, align 4 diff --git a/llvm/test/LTO/Resolution/X86/commons.ll b/llvm/test/LTO/Resolution/X86/commons.ll new file mode 100644 index 00000000000..b3e504835af --- /dev/null +++ b/llvm/test/LTO/Resolution/X86/commons.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as -o %t1.bc %s +; RUN: llvm-as -o %t2.bc %p/Inputs/commons.ll +; RUN: llvm-lto2 %t1.bc -r=%t1.bc,x,l %t2.bc -r=%t2.bc,x,pl -o %t.out -save-temps +; RUN: llvm-dis -o - %t.out.0.0.preopt.bc | FileCheck %s + +; A strong definition should override the common +; CHECK: @x = global i32 42, align 4 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@x = common global i16 0, align 2 |