From 9030f4d6bd1ea0d27354c65c1b7c450c73a01667 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Wed, 27 Jan 2016 01:04:51 +0000 Subject: [PATCH] Revert "Change of UserLabelPrefix default value from "_" to """ This reverts commit r258504. This commit breaks (at least) sparc-rtems -- the OS (RTEMS) used to override UserLabelPrefix to "", despite the arch (SPARC) having set it to "_". Now, the OS doesn't override anymore, but the arch sets it to "_", resulting in the wrong value. I expect this probably breaks other OSes that overrode to "" before, as well. (Clearly we have some missing test cases, here...) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258894 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/TargetInfo.cpp | 2 +- lib/Basic/Targets.cpp | 53 +++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index 6a67f41fbb..1648a27d8b 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -72,7 +72,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) { DoubleFormat = &llvm::APFloat::IEEEdouble; LongDoubleFormat = &llvm::APFloat::IEEEdouble; DataLayoutString = nullptr; - UserLabelPrefix = ""; + UserLabelPrefix = "_"; MCountName = "mcount"; RegParmMax = 0; SSERegParmMax = 0; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 2f19b88e21..4bb77a01ec 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -102,7 +102,9 @@ protected: public: CloudABITargetInfo(const llvm::Triple &Triple) - : OSTargetInfo(Triple) {} + : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + } }; static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, @@ -240,7 +242,6 @@ public: this->TLSSupported = !Triple.isOSVersionLT(2); this->MCountName = "\01mcount"; - this->UserLabelPrefix = "_"; } std::string isValidSectionSpecifier(StringRef SR) const override { @@ -283,6 +284,8 @@ protected: public: DragonFlyBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + switch (Triple.getArch()) { default: case llvm::Triple::x86: @@ -324,6 +327,8 @@ protected: } public: FreeBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + switch (Triple.getArch()) { default: case llvm::Triple::x86: @@ -363,7 +368,9 @@ protected: } public: KFreeBSDTargetInfo(const llvm::Triple &Triple) - : OSTargetInfo(Triple) {} + : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + } }; // Minix Target @@ -385,7 +392,9 @@ protected: DefineStd(Builder, "unix", Opts); } public: - MinixTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) {} + MinixTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + } }; // Linux target @@ -458,6 +467,7 @@ protected: } public: NetBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; this->MCountName = "_mcount"; } }; @@ -478,6 +488,7 @@ protected: } public: OpenBSDTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; this->TLSSupported = false; switch (Triple.getArch()) { @@ -525,6 +536,7 @@ protected: } public: BitrigTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; this->MCountName = "__mcount"; } }; @@ -542,7 +554,9 @@ protected: Builder.defineMacro("__ELF__"); } public: - PSPTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) {} + PSPTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + } }; // PS3 PPU Target @@ -562,6 +576,7 @@ protected: } public: PS3PPUTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; this->LongWidth = this->LongAlign = 32; this->PointerWidth = this->PointerAlign = 32; this->IntMaxType = TargetInfo::SignedLongLong; @@ -589,6 +604,7 @@ public: // On PS4, TLS variable cannot be aligned to more than 32 bytes (256 bits). this->MaxTLSAlign = 256; + this->UserLabelPrefix = ""; switch (Triple.getArch()) { default: @@ -708,6 +724,7 @@ protected: public: NaClTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; this->LongAlign = 32; this->LongWidth = 32; this->PointerAlign = 32; @@ -761,6 +778,7 @@ public: explicit WebAssemblyOSTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { this->MCountName = "__mcount"; + this->UserLabelPrefix = ""; this->TheCXXABI.set(TargetCXXABI::WebAssembly); } }; @@ -798,7 +816,6 @@ public: SimdDefaultAlign = 128; LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble; - UserLabelPrefix = "_"; } /// \brief Flags for architecture specific defines. @@ -1614,7 +1631,6 @@ public: NoAsmVariants = true; // Set the default GPU to sm20 GPU = GK_SM20; - UserLabelPrefix = "_"; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -3655,8 +3671,6 @@ public: // FIXME: Check that we actually have cmpxchg8b before setting // MaxAtomicInlineWidth. (cmpxchg8b is an i586 instruction.) MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; - - UserLabelPrefix = "_"; } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::CharPtrBuiltinVaList; @@ -3868,6 +3882,7 @@ public: IntPtrType = SignedLong; PtrDiffType = SignedLong; ProcessIDType = SignedLong; + this->UserLabelPrefix = ""; this->TLSSupported = false; } void getTargetDefines(const LangOptions &Opts, @@ -3914,6 +3929,8 @@ protected: public: RTEMSTargetInfo(const llvm::Triple &Triple) : OSTargetInfo(Triple) { + this->UserLabelPrefix = ""; + switch (Triple.getArch()) { default: case llvm::Triple::x86: @@ -3940,6 +3957,7 @@ public: SizeType = UnsignedLong; IntPtrType = SignedLong; PtrDiffType = SignedLong; + this->UserLabelPrefix = ""; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -3987,8 +4005,6 @@ public: // x86-64 has atomics up to 16 bytes. MaxAtomicPromoteWidth = 128; MaxAtomicInlineWidth = 128; - - UserLabelPrefix = "_"; } BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::X86_64ABIBuiltinVaList; @@ -4044,6 +4060,7 @@ public: SizeType = UnsignedLongLong; PtrDiffType = SignedLongLong; IntPtrType = SignedLongLong; + this->UserLabelPrefix = ""; } void getTargetDefines(const LangOptions &Opts, @@ -4526,8 +4543,6 @@ public: // that follows it, `bar', `bar' will be aligned as the type of the // zero length bitfield. UseZeroLengthBitfieldAlignment = true; - - UserLabelPrefix = "_"; } StringRef getABI() const override { return ABI; } @@ -5105,6 +5120,7 @@ public: TLSSupported = false; WCharType = UnsignedShort; SizeType = UnsignedInt; + UserLabelPrefix = ""; } void getVisualStudioDefines(const LangOptions &Opts, MacroBuilder &Builder) const { @@ -5304,8 +5320,6 @@ public: // AArch64 targets default to using the ARM C++ ABI. TheCXXABI.set(TargetCXXABI::GenericAArch64); - - UserLabelPrefix = "_"; } StringRef getABI() const override { return ABI; } @@ -5830,9 +5844,7 @@ class SparcTargetInfo : public TargetInfo { bool SoftFloat; public: SparcTargetInfo(const llvm::Triple &Triple) - : TargetInfo(Triple), SoftFloat(false) { - UserLabelPrefix = "_"; - } + : TargetInfo(Triple), SoftFloat(false) {} bool handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) override { @@ -6133,7 +6145,6 @@ public: MinGlobalAlign = 16; DataLayoutString = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"; MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; - UserLabelPrefix = "_"; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -6293,7 +6304,6 @@ public: PtrDiffType = SignedInt; SigAtomicType = SignedLong; DataLayoutString = "e-m:e-p:16:16-i32:16:32-a:16-n8:16"; - UserLabelPrefix = "_"; } void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override { @@ -6390,7 +6400,6 @@ public: "-f64:32-v64:32-v128:32-a:0:32-n32"; AddrSpaceMap = &TCEOpenCLAddrSpaceMap; UseAddrSpaceMapMangling = true; - UserLabelPrefix = "_"; } void getTargetDefines(const LangOptions &Opts, @@ -6493,7 +6502,6 @@ public: IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) { TheCXXABI.set(TargetCXXABI::GenericMIPS); - UserLabelPrefix = "_"; } bool isNaN2008Default() const { @@ -7070,6 +7078,7 @@ class PNaClTargetInfo : public TargetInfo { public: PNaClTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) { BigEndian = false; + this->UserLabelPrefix = ""; this->LongAlign = 32; this->LongWidth = 32; this->PointerAlign = 32; -- 2.40.0