Bug 12578 - Alignment of a common symbol overridden by a definition
Summary: Alignment of a common symbol overridden by a definition
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-13 17:37 UTC by Dmitry Gorbachev
Modified: 2011-03-14 13:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Testcase (102 bytes, text/plain)
2011-03-13 17:38 UTC, Dmitry Gorbachev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Gorbachev 2011-03-13 17:37:50 UTC
(I don't know is it related to / a duplicate of PR12564.)

ld.bfd gives a warning: "/usr/bin/ld: Warning: alignment 4 of symbol `baz' in /tmp/ccEJaaP0.o is smaller than 16 in /tmp/ccs1dDrt.o"; ld.gold doesn't even warn.

I think the linker should choose the largest alignment, as it already does when merging multiple common symbols.
Comment 1 Dmitry Gorbachev 2011-03-13 17:38:56 UTC
Created attachment 5303 [details]
Testcase

Compile it with GCC 4.5 or later and `-O3 -march=pentium3' options.
Comment 2 H.J. Lu 2011-03-14 13:48:29 UTC
Linker can change alignment of a common symbol. But
it can't change alignment of a definition.