1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Use isWeakForLinker() hook

llvm-svn: 53318
This commit is contained in:
Anton Korobeynikov 2008-07-09 13:27:59 +00:00
parent 3399dc61e5
commit 5ad0c235f1
3 changed files with 6 additions and 18 deletions

View File

@ -228,9 +228,7 @@ TargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
assert(0 && "Unexpected section kind!");
}
if (GV->hasLinkOnceLinkage() ||
GV->hasWeakLinkage() ||
GV->hasCommonLinkage())
if (GV->isWeakForLinker())
Flags |= SectionFlags::Linkonce;
}
@ -289,9 +287,7 @@ std::string
TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
if (GV->hasLinkOnceLinkage() ||
GV->hasWeakLinkage() ||
GV->hasCommonLinkage())
if (GV->isWeakForLinker())
return UniqueSectionForGlobal(GV, Kind);
else {
if (Kind == SectionKind::Text)

View File

@ -399,10 +399,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
if (shouldPrintStub(TM, Subtarget)) {
// Link-once, declaration, or Weakly-linked global variables need
// non-lazily-resolved stubs
if (GV->isDeclaration() ||
GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage() ||
GV->hasCommonLinkage()) {
if (GV->isDeclaration() || GV->isWeakForLinker()) {
// Dynamically-resolved functions need a stub for the function.
if (isCallOp && isa<Function>(GV)) {
FnStubs.insert(Name);
@ -802,8 +799,7 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
}
if (!GVar->isThreadLocal() &&
(GVar->hasInternalLinkage() || GVar->hasWeakLinkage() ||
GVar->hasLinkOnceLinkage() || GVar->hasCommonLinkage())) {
(GVar->hasInternalLinkage() || GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (TAI->getLCOMMDirective() != NULL) {

View File

@ -224,9 +224,7 @@ X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
std::string
X86DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
bool isWeak = GV->hasWeakLinkage() ||
GV->hasCommonLinkage() ||
GV->hasLinkOnceLinkage();
bool isWeak = GV->isWeakForLinker();
switch (Kind) {
case SectionKind::Text:
@ -435,9 +433,7 @@ X86ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
return UniqueSectionForGlobal(F, kind);
}
} else if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) {
if (GVar->hasCommonLinkage() ||
GVar->hasLinkOnceLinkage() ||
GVar->hasWeakLinkage())
if (GVar->isWeakForLinker()
return UniqueSectionForGlobal(GVar, kind);
else {
switch (kind) {