[llvm-bugs] [Bug 47819] New: Incorrect alignment of common symbol for mixed LTO + native object
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 13 06:13:21 PDT 2020
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: unassignedbugs at nondot.org
Reporter: jh7370.2008 at my.bristol.ac.uk
CC: llvm-bugs at lists.llvm.org, smithp352 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201013/2181d7d7/attachment.html>
More information about the llvm-bugs
mailing list