mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-04 07:32:13 +00:00
COFF: Don't oversize COMMON symbols when targeting BFD ld
COFF normally doesn't allow us to describe the alignment of COMMON symbols. It turns out that most linkers use the symbol size as a hint as to how aligned the symbol should be. However the BFD folks have added a .drectve command, which we now support as of r219229, that allows us to specify the alignment precisely. With this in mind, stop rounding sizes up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219281 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3d371bd84b
commit
1fa70c99dc
@ -185,14 +185,13 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
"Got non-COFF section in the COFF backend!");
|
"Got non-COFF section in the COFF backend!");
|
||||||
|
|
||||||
const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
|
const Triple &T = getContext().getObjectFileInfo()->getTargetTriple();
|
||||||
if (T.isKnownWindowsMSVCEnvironment())
|
if (T.isKnownWindowsMSVCEnvironment()) {
|
||||||
if (ByteAlignment > 32)
|
if (ByteAlignment > 32)
|
||||||
report_fatal_error("alignment is limited to 32-bytes");
|
report_fatal_error("alignment is limited to 32-bytes");
|
||||||
|
|
||||||
// Round size up to alignment so that we will honor the alignment request.
|
// Round size up to alignment so that we will honor the alignment request.
|
||||||
// TODO: We don't need to do this if we are targeting the bfd linker once we
|
Size = std::max(Size, static_cast<uint64_t>(ByteAlignment));
|
||||||
// add support for adding -aligncomm into the .drectve section.
|
}
|
||||||
Size = std::max(Size, static_cast<uint64_t>(ByteAlignment));
|
|
||||||
|
|
||||||
AssignSection(Symbol, nullptr);
|
AssignSection(Symbol, nullptr);
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ _a:
|
|||||||
.comm _s_4,4,2 # @s_3
|
.comm _s_4,4,2 # @s_3
|
||||||
.comm _s_8,4,3 # @s_4
|
.comm _s_8,4,3 # @s_4
|
||||||
|
|
||||||
|
.comm _small_but_overaligned,1,3 # @s_4
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.def _b
|
.def _b
|
||||||
@ -41,10 +43,15 @@ _b:
|
|||||||
# CHECK: Section: .text (1)
|
# CHECK: Section: .text (1)
|
||||||
# CHECK: }
|
# CHECK: }
|
||||||
# CHECK: Symbol {
|
# CHECK: Symbol {
|
||||||
|
# CHECK: Name: _small_but_overaligned
|
||||||
|
# CHECK-NEXT:Value: 1
|
||||||
|
# CHECK-NEXT:Section: IMAGE_SYM_UNDEFINED (0)
|
||||||
|
# CHECK: }
|
||||||
|
# CHECK: Symbol {
|
||||||
# CHECK: Name: _b
|
# CHECK: Name: _b
|
||||||
# CHECK: Section: .text (1)
|
# CHECK: Section: .text (1)
|
||||||
# CHECK: }
|
# CHECK: }
|
||||||
# CHECK: ]
|
# CHECK: ]
|
||||||
|
|
||||||
# CHECK: Directive(s): -aligncomm:"_s_2",1 -aligncomm:"_s_4",2 -aligncomm:"_s_8",3
|
# CHECK: Directive(s): -aligncomm:"_s_2",1 -aligncomm:"_s_4",2 -aligncomm:"_s_8",3 -aligncomm:"_small_but_overaligned",3
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user