mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Don't drop alignment info on local common symbols.
- On COFF the .lcomm directive has an alignment argument. - On ELF we fall back to .local + .comm Based on a patch by NAKAMURA Takumi. Fixes PR9337, PR9483 and PR10128. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -290,10 +290,10 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||
// Handle common and BSS local symbols (.lcomm).
|
||||
if (GVKind.isCommon() || GVKind.isBSSLocal()) {
|
||||
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
|
||||
unsigned Align = 1 << AlignLog;
|
||||
|
||||
// Handle common symbols.
|
||||
if (GVKind.isCommon()) {
|
||||
unsigned Align = 1 << AlignLog;
|
||||
if (!getObjFileLowering().getCommDirectiveSupportsAlignment())
|
||||
Align = 0;
|
||||
|
||||
@@ -307,17 +307,17 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||
const MCSection *TheSection =
|
||||
getObjFileLowering().SectionForGlobal(GV, GVKind, Mang, TM);
|
||||
// .zerofill __DATA, __bss, _foo, 400, 5
|
||||
OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
|
||||
OutStreamer.EmitZerofill(TheSection, GVSym, Size, Align);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MAI->hasLCOMMDirective()) {
|
||||
if (MAI->getLCOMMDirectiveType() != LCOMM::None &&
|
||||
(MAI->getLCOMMDirectiveType() != LCOMM::NoAlignment || Align == 1)) {
|
||||
// .lcomm _foo, 42
|
||||
OutStreamer.EmitLocalCommonSymbol(GVSym, Size);
|
||||
OutStreamer.EmitLocalCommonSymbol(GVSym, Size, Align);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned Align = 1 << AlignLog;
|
||||
if (!getObjFileLowering().getCommDirectiveSupportsAlignment())
|
||||
Align = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user