mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Revert Don't create new comdats in CodeGen
It breaks AddressSanitizer on Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226173 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -257,7 +257,8 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
|
||||
// If this global is linkonce/weak and the target handles this by emitting it
|
||||
// into a 'uniqued' section name, create and return the section now.
|
||||
if ((EmitUniquedSection && !Kind.isCommon()) || GV->hasComdat()) {
|
||||
if ((GV->isWeakForLinker() || EmitUniquedSection || GV->hasComdat()) &&
|
||||
!Kind.isCommon()) {
|
||||
StringRef Prefix = getSectionPrefixForGlobal(Kind);
|
||||
|
||||
SmallString<128> Name(Prefix);
|
||||
@ -265,9 +266,12 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
|
||||
StringRef Group = "";
|
||||
unsigned Flags = getELFSectionFlags(Kind);
|
||||
if (const Comdat *C = getELFComdat(GV)) {
|
||||
if (GV->isWeakForLinker() || GV->hasComdat()) {
|
||||
if (const Comdat *C = getELFComdat(GV))
|
||||
Group = C->getName();
|
||||
else
|
||||
Group = Name.substr(Prefix.size());
|
||||
Flags |= ELF::SHF_GROUP;
|
||||
Group = C->getName();
|
||||
}
|
||||
|
||||
return getContext().getELFSection(Name.str(),
|
||||
@ -797,7 +801,7 @@ const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
||||
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
||||
StringRef Name = GV->getSection();
|
||||
StringRef COMDATSymName = "";
|
||||
if (GV->hasComdat()) {
|
||||
if ((GV->isWeakForLinker() || GV->hasComdat()) && !Kind.isCommon()) {
|
||||
Selection = getSelectionForCOFF(GV);
|
||||
const GlobalValue *ComdatGV;
|
||||
if (Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE)
|
||||
@ -844,7 +848,12 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||
else
|
||||
EmitUniquedSection = TM.getDataSections();
|
||||
|
||||
if ((EmitUniquedSection && !Kind.isCommon()) || GV->hasComdat()) {
|
||||
// If this global is linkonce/weak and the target handles this by emitting it
|
||||
// into a 'uniqued' section name, create and return the section now.
|
||||
// Section names depend on the name of the symbol which is not feasible if the
|
||||
// symbol has private linkage.
|
||||
if ((GV->isWeakForLinker() || EmitUniquedSection || GV->hasComdat()) &&
|
||||
!Kind.isCommon()) {
|
||||
const char *Name = getCOFFSectionNameForUniqueGlobal(Kind);
|
||||
unsigned Characteristics = getCOFFSectionFlags(Kind);
|
||||
|
||||
|
Reference in New Issue
Block a user