mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
WinCOFF: Emit common symbols as specified in the COFF spec
Summary: Local common symbols were properly inserted into the .bss section. However, putting external common symbols in the .bss section would give them a strong definition. Instead, encode them as undefined, external symbols who's symbol value is equivalent to their size. Reviewers: Bigcheese, rafael, rnk CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3324 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -755,7 +755,7 @@ const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
||||
static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
|
||||
if (Kind.isText())
|
||||
return ".text";
|
||||
if (Kind.isBSS ())
|
||||
if (Kind.isBSS())
|
||||
return ".bss";
|
||||
if (Kind.isThreadLocal())
|
||||
return ".tls$";
|
||||
@ -781,7 +781,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
// Section names depend on the name of the symbol which is not feasible if the
|
||||
// symbol has private linkage.
|
||||
if ((GV->isWeakForLinker() || EmitUniquedSection) &&
|
||||
!GV->hasPrivateLinkage()) {
|
||||
!GV->hasPrivateLinkage() && !Kind.isCommon()) {
|
||||
const char *Name = getCOFFSectionNameForUniqueGlobal(Kind);
|
||||
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
||||
|
||||
@ -802,7 +802,10 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
if (Kind.isReadOnly())
|
||||
return ReadOnlySection;
|
||||
|
||||
if (Kind.isBSS())
|
||||
// Note: we claim that common symbols are put in BSSSection, but they are
|
||||
// really emitted with the magic .comm directive, which creates a symbol table
|
||||
// entry but not a section.
|
||||
if (Kind.isBSS() || Kind.isCommon())
|
||||
return BSSSection;
|
||||
|
||||
return DataSection;
|
||||
|
Reference in New Issue
Block a user