https://bugs.llvm.org/show_bug.cgi?id=47819
Bug ID: 47819
Summary: Incorrect alignment of common symbol for mixed LTO +
native object
Product: lld
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedb...@nondot.org
Reporter: jh7370.2...@my.bristol.ac.uk
CC: llvm-bugs@lists.llvm.org, smithp...@googlemail.com
If a bitcode file defines a common symbol with a larger size, but smaller
alignment, and a native object file defines a common symbol with a smaller
size, but larger alignment, the alignment from smaller symbol is ignored,
unlike the other possible resolution cases of bitcode + bitcode, object +
object, or bitcode + object where the object had the larger alignment.
The problem is because the compiled LTO output symbol unconditionally replaces
the symbol LLD already has internally in this case. Since the LTO output will
only have the alignment of the symbol from the bitcode, it has a smaller
alignment than the one in memory, and so the correct alignment is lost.
Example inputs:
; common.ll
target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@b = common global i64 0, align 4
# common2.s
.comm b,8,16
Result: b has size 8, and the .bss section has 4-byte alignment (it should be
size 8 and 16-byte alignment).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs