mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Refactor how -fno-semantic-interposition sets dso_local on default visibility external linkage definitions
The idea is that the CC1 default for ELF should set dso_local on default visibility external linkage definitions in the default -mrelocation-model pic mode (-fpic/-fPIC) to match COFF/Mach-O and make output IR similar. The refactoring is made available by 2820a2ca3a0e69c3f301845420e0067ffff2251b. Currently only x86 supports local aliases. We move the decision to the driver. There are three CC1 states: * -fsemantic-interposition: make some linkages interposable and make default visibility external linkage definitions dso_preemptable. * (default): selected if the target supports .Lfoo$local: make default visibility external linkage definitions dso_local * -fhalf-no-semantic-interposition: if neither option is set or the target does not support .Lfoo$local: like -fno-semantic-interposition but local aliases are not used. So references can be interposed if not optimized out. Add -fhalf-no-semantic-interposition to a few tests using the half-based semantic interposition behavior.
This commit is contained in:
parent
2eb058056b
commit
c7c5340c75
@ -855,7 +855,6 @@ public:
|
||||
|
||||
/// Returns whether semantic interposition is to be respected.
|
||||
bool getSemanticInterposition() const;
|
||||
bool noSemanticInterposition() const;
|
||||
|
||||
/// Set whether semantic interposition is to be respected.
|
||||
void setSemanticInterposition(bool);
|
||||
|
@ -483,10 +483,8 @@ MCSymbol *AsmPrinter::getSymbolPreferLocal(const GlobalValue &GV) const {
|
||||
if (TM.getTargetTriple().isOSBinFormatELF() && GV.canBenefitFromLocalAlias()) {
|
||||
const Module &M = *GV.getParent();
|
||||
if (TM.getRelocationModel() != Reloc::Static &&
|
||||
M.getPIELevel() == PIELevel::Default)
|
||||
if (GV.isDSOLocal() || (TM.getTargetTriple().isX86() &&
|
||||
GV.getParent()->noSemanticInterposition()))
|
||||
return getSymbolWithGlobalValueBase(&GV, "$local");
|
||||
M.getPIELevel() == PIELevel::Default && GV.isDSOLocal())
|
||||
return getSymbolWithGlobalValueBase(&GV, "$local");
|
||||
}
|
||||
return TM.getSymbol(&GV);
|
||||
}
|
||||
|
@ -601,13 +601,6 @@ void Module::setSemanticInterposition(bool SI) {
|
||||
addModuleFlag(ModFlagBehavior::Error, "SemanticInterposition", SI);
|
||||
}
|
||||
|
||||
bool Module::noSemanticInterposition() const {
|
||||
// Conservatively require an explicit zero value for now.
|
||||
Metadata *MF = getModuleFlag("SemanticInterposition");
|
||||
auto *Val = cast_or_null<ConstantAsMetadata>(MF);
|
||||
return Val && cast<ConstantInt>(Val->getValue())->getZExtValue() == 0;
|
||||
}
|
||||
|
||||
void Module::setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB) {
|
||||
OwnedMemoryBuffer = std::move(MB);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user