From 0c3e791be8ff43e23c5f8d4f39e2a6e5b32ef3d1 Mon Sep 17 00:00:00 2001 From: ZhouGuangyuan Date: Wed, 12 Aug 2026 23:41:58 +0800 Subject: [PATCH] [Go] Encode ABI0 in function symbol names Use a reserved suffix as the sole ABI0 function identity across IR declarations, definitions, MC symbols, and GoObj references. Strip the suffix while writing GoObj and preserve unsuffixed ABIInternal function names.\n\nRemove goobj.symbol.name and MC ABI override state. Late morestack calls acquire the ABI0 suffix, while unsuffixed late call relocations such as write barriers resolve as ABIInternal. --- llvm/include/llvm/BinaryFormat/GoObj.h | 4 ++ llvm/include/llvm/CodeGen/GoCallingConv.h | 8 +++ llvm/include/llvm/MC/MCContext.h | 29 +++-------- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 42 +++++++--------- llvm/lib/CodeGen/GoCallingConv.cpp | 11 ++++ llvm/lib/MC/GoObjObjectWriter.cpp | 50 +++++++++++++++---- llvm/lib/MC/MCContext.cpp | 3 +- .../AArch64/AArch64ExpandPseudoInsts.cpp | 1 - .../Target/AArch64/AArch64FrameLowering.cpp | 11 ++-- llvm/lib/Target/X86/X86ExpandPseudo.cpp | 1 - llvm/lib/Target/X86/X86FrameLowering.cpp | 11 ++-- llvm/test/CodeGen/AArch64/goobj-abi.ll | 10 ++-- llvm/test/CodeGen/AArch64/goobj-ir-config.ll | 2 +- llvm/test/CodeGen/AArch64/goobj-pcsp-cfg.ll | 2 +- .../AArch64/goobj-private-constants.ll | 2 +- .../AArch64/goobj-register-argument-homes.ll | 6 +-- .../AArch64/goobj-stack-growth-statepoint.ll | 6 +-- .../Generic/goobj-abi0-name-contract.ll | 29 +++++++++++ .../Generic/goobj-no-hosted-libcalls.ll | 2 +- ...tepoint-requires-stack-growth-attribute.ll | 2 +- .../goobj-toolexec-module/dep/answer.ll | 2 +- llvm/test/CodeGen/X86/go-callconv.ll | 12 ++--- llvm/test/CodeGen/X86/go-memset-inline.ll | 4 +- .../CodeGen/X86/goobj-data-relocations.ll | 2 +- llvm/test/CodeGen/X86/goobj-filetype.ll | 2 +- .../CodeGen/X86/goobj-function-abi-name.ll | 45 +++++++++++++++++ llvm/test/CodeGen/X86/goobj-function-abi.ll | 2 +- llvm/test/CodeGen/X86/goobj-pcsp-cfg.ll | 2 +- .../X86/goobj-stack-growth-metadata.ll | 8 +-- .../X86/goobj-stack-growth-statepoint.ll | 16 +++--- llvm/test/CodeGen/X86/goobj-symbol-name.ll | 29 ----------- .../X86/goobj-toolexec-go-toolchain.test | 6 +-- llvm/test/MC/GoObj/aarch64-relocations.s | 2 +- llvm/test/MC/GoObj/relocations.s | 2 +- 34 files changed, 221 insertions(+), 145 deletions(-) create mode 100644 llvm/test/CodeGen/Generic/goobj-abi0-name-contract.ll create mode 100644 llvm/test/CodeGen/X86/goobj-function-abi-name.ll delete mode 100644 llvm/test/CodeGen/X86/goobj-symbol-name.ll diff --git a/llvm/include/llvm/BinaryFormat/GoObj.h b/llvm/include/llvm/BinaryFormat/GoObj.h index cec22f1452ed3..c4a370aba1b00 100644 --- a/llvm/include/llvm/BinaryFormat/GoObj.h +++ b/llvm/include/llvm/BinaryFormat/GoObj.h @@ -19,6 +19,10 @@ namespace llvm { namespace GoObj { +// LLVM global names carry this suffix when they identify the ABI0 form of a +// Go function. GoObj serialization strips it and records ABI0 separately. +inline constexpr char ABI0SymbolSuffix[] = ""; + // "GoStackG" encoded as the stable statepoint identifier for the pre-frame // runtime.morestack slow path. inline constexpr uint64_t StackGrowthStatepointID = 0x476f537461636b47ULL; diff --git a/llvm/include/llvm/CodeGen/GoCallingConv.h b/llvm/include/llvm/CodeGen/GoCallingConv.h index c27d55de4a030..8666893bfd616 100644 --- a/llvm/include/llvm/CodeGen/GoCallingConv.h +++ b/llvm/include/llvm/CodeGen/GoCallingConv.h @@ -24,6 +24,8 @@ namespace llvm { class CallBase; +class MachineFunction; +class MachineInstrBuilder; class Type; namespace goabi { @@ -111,6 +113,12 @@ EntryArgsInfo computeEntryArgsInfo(ArrayRef ArgTys, bool isIntegerPiece(Type *Ty); bool isFloatingPiece(Type *Ty); +/// Add a late target-inserted call operand for the ABI0 form of \p SymbolName. +/// ABI0 identity is encoded directly in the MC symbol name; the GoObj writer +/// strips the reserved suffix and records ABI0 in the object symbol. +void addGoObjABI0Callee(MachineInstrBuilder &MIB, MachineFunction &MF, + StringRef SymbolName); + } // namespace goabi } // namespace llvm diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h index fe95a26e12b99..f9deff96daa40 100644 --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -242,11 +242,8 @@ class MCContext { /// Bindings of names to symbol table values. SymbolTable Symbols; - /// Go object symbol ABI overrides keyed by MC symbol. - DenseMap GoObjSymbolABIs; - - /// Go object linker names for MC symbols whose LLVM names were made unique. - DenseMap GoObjSymbolNames; + /// MC symbols known to denote Go functions, including declarations. + DenseSet GoObjFunctionSymbols; /// Package-local indices assigned to Go object definitions by the frontend. DenseMap GoObjPackageSymbolIndexes; @@ -692,26 +689,12 @@ class MCContext { /// inline assembly. LLVM_ABI void registerInlineAsmLabel(MCSymbol *Sym); - void setGoObjSymbolABI(const MCSymbol *Sym, uint16_t ABI) { - GoObjSymbolABIs[Sym] = ABI; - } - - std::optional getGoObjSymbolABI(const MCSymbol *Sym) const { - auto It = GoObjSymbolABIs.find(Sym); - if (It == GoObjSymbolABIs.end()) - return std::nullopt; - return It->second; + void setGoObjFunctionSymbol(const MCSymbol *Sym) { + GoObjFunctionSymbols.insert(Sym); } - void setGoObjSymbolName(const MCSymbol *Sym, StringRef Name) { - GoObjSymbolNames[Sym] = Name.str(); - } - - StringRef getGoObjSymbolName(const MCSymbol *Sym) const { - auto It = GoObjSymbolNames.find(Sym); - if (It == GoObjSymbolNames.end()) - return {}; - return It->second; + bool isGoObjFunctionSymbol(const MCSymbol *Sym) const { + return GoObjFunctionSymbols.contains(Sym); } void setGoObjPackageSymbolIndex(const MCSymbol *Sym, uint32_t Index) { diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f2c05d91389f1..7dbd2c879e3f3 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -601,14 +601,6 @@ bool AsmPrinter::doInitialization(Module &M) { if (Target.isOSBinFormatGoObj()) { collectGoObjModuleMetadata(*this, M); - for (const Function &F : M) { - if (!F.isDeclaration()) - continue; - if (goabi::isGoABIInternalCallingConv(F.getCallingConv())) - OutContext.setGoObjSymbolABI(getSymbol(&F), GoObj::SymABIInternal); - else if (goabi::isGoABI0CallingConv(F.getCallingConv())) - OutContext.setGoObjSymbolABI(getSymbol(&F), GoObj::SymABI0); - } } // On AIX, we delay emitting any section information until @@ -1049,17 +1041,26 @@ static void collectGoObjModuleMetadata(AsmPrinter &AP, const Module &M) { AP.OutContext.setGoObjImports(std::move(ParsedImports)); } - for (const GlobalObject &GO : M.global_objects()) { - const MDNode *MD = GO.getMetadata("goobj.symbol.name"); - if (!MD) + // The LLVM symbol name is the sole carrier of ABI0 object identity. Keep the + // calling convention as an independent lowering contract and reject stale + // metadata or mismatched names instead of trying to repair either one. + for (const GlobalObject &GO : M.global_objects()) + if (GO.getMetadata("goobj.symbol.name")) + report_fatal_error( + "!goobj.symbol.name is obsolete; encode ABI0 in the symbol name"); + + for (const Function &F : M) { + if (F.isIntrinsic()) continue; - if (MD->getNumOperands() != 1) - report_fatal_error("expected !goobj.symbol.name to have one operand"); - StringRef Name = - getGoObjMetadataString(MD->getOperand(0), "goobj.symbol.name"); - if (Name.empty()) - report_fatal_error("invalid !goobj.symbol.name attachment"); - AP.OutContext.setGoObjSymbolName(AP.getSymbol(&GO), Name); + bool HasABI0Suffix = F.getName().ends_with(GoObj::ABI0SymbolSuffix); + bool IsABI0 = goabi::isGoABI0CallingConv(F.getCallingConv()); + bool IsABIInternal = + goabi::isGoABIInternalCallingConv(F.getCallingConv()); + if (HasABI0Suffix != IsABI0) + report_fatal_error( + "Go ABI0 calling convention and symbol suffix disagree"); + if (IsABI0 || IsABIInternal) + AP.OutContext.setGoObjFunctionSymbol(AP.getSymbol(&F)); } for (const GlobalObject &GO : M.global_objects()) { @@ -3750,11 +3751,6 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { if (std::optional> Info = getGoObjFunctionInfo(F)) OutContext.setGoObjFunctionInfo(CurrentFnSym, Info->first, Info->second); - if (goabi::isGoABIInternalCallingConv(F.getCallingConv())) - OutContext.setGoObjSymbolABI(CurrentFnSym, GoObj::SymABIInternal); - else if (goabi::isGoABI0CallingConv(F.getCallingConv())) - OutContext.setGoObjSymbolABI(CurrentFnSym, GoObj::SymABI0); - const MachineFrameInfo &FrameInfo = MF.getFrameInfo(); uint64_t StackSize = FrameInfo.getStackSize() + FrameInfo.getUnsafeStackSize(); diff --git a/llvm/lib/CodeGen/GoCallingConv.cpp b/llvm/lib/CodeGen/GoCallingConv.cpp index 29f330005a87d..5b5dedf4b0b05 100644 --- a/llvm/lib/CodeGen/GoCallingConv.cpp +++ b/llvm/lib/CodeGen/GoCallingConv.cpp @@ -8,15 +8,26 @@ #include "llvm/CodeGen/GoCallingConv.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/Support/ErrorHandling.h" #include +#include using namespace llvm; namespace llvm::goabi { +void addGoObjABI0Callee(MachineInstrBuilder &MIB, MachineFunction &MF, + StringRef SymbolName) { + if (SymbolName.empty() || SymbolName.ends_with(GoObj::ABI0SymbolSuffix)) + report_fatal_error("invalid logical Go ABI0 symbol name"); + std::string StorageName = (SymbolName + GoObj::ABI0SymbolSuffix).str(); + MIB.addExternalSymbol(MF.createExternalSymbolName(StorageName)); +} + static bool isPaddingType(Type *Ty) { auto *ST = dyn_cast(Ty); if (!ST || !ST->hasName() || ST->getName() != PadTypeName) diff --git a/llvm/lib/MC/GoObjObjectWriter.cpp b/llvm/lib/MC/GoObjObjectWriter.cpp index 4975f49538867..f1252339a1abc 100644 --- a/llvm/lib/MC/GoObjObjectWriter.cpp +++ b/llvm/lib/MC/GoObjObjectWriter.cpp @@ -1512,9 +1512,26 @@ void GoObjObjectWriter::recordRelocation(const MCFragment &F, uint64_t GoObjObjectWriter::writeObject() { const uint64_t StartOffset = OS.tell(); + StringRef ABI0Suffix = GoObj::ABI0SymbolSuffix; + auto HasABI0Suffix = [&](const MCSymbol *Sym) { + return Sym && Sym->getName().ends_with(ABI0Suffix); + }; auto GetSymbolName = [&](const MCSymbol *Sym) -> StringRef { - StringRef Name = Asm->getContext().getGoObjSymbolName(Sym); - return Name.empty() ? Sym->getName() : Name; + StringRef Name = Sym->getName(); + if (!HasABI0Suffix(Sym)) + return Name; + Name = Name.drop_back(ABI0Suffix.size()); + if (Name.empty() || Name.ends_with(ABI0Suffix)) + report_fatal_error("invalid Go ABI0 symbol name"); + return Name; + }; + auto GetSymbolABI = [&](const MCSymbol *Sym, bool IsFunction) { + if (HasABI0Suffix(Sym)) { + if (!IsFunction) + report_fatal_error("Go ABI0 suffix requires a function symbol"); + return GoObj::SymABI0; + } + return IsFunction ? GoObj::SymABIInternal : GoObj::SymABI0; }; std::vector Symbols; @@ -1530,6 +1547,8 @@ uint64_t GoObjObjectWriter::writeObject() { for (const MCSymbol &Symbol : Asm->symbols()) { if (!Symbol.isCommon()) continue; + if (HasABI0Suffix(&Symbol)) + report_fatal_error("Go ABI0 suffix requires a function symbol"); GoObjSymbol GoSym; GoSym.Name = GetSymbolName(&Symbol).str(); GoSym.Symbol = &Symbol; @@ -1591,10 +1610,8 @@ uint64_t GoObjObjectWriter::writeObject() { Data = ArrayRef(Contents.data() + Begin, Size); } uint8_t Type = getGoObjSymbolType(&Section); - uint16_t ABI = MCSym - ? Asm->getContext().getGoObjSymbolABI(MCSym).value_or( - GoObj::SymABI0) - : GoObj::SymABI0; + uint16_t ABI = GetSymbolABI( + MCSym, MCSym && Asm->getContext().isGoObjFunctionSymbol(MCSym)); uint8_t Flag = 0; uint8_t Flag2 = 0; uint32_t Align = 0; @@ -2169,13 +2186,12 @@ uint64_t GoObjObjectWriter::writeObject() { std::vector NonPkgRefs; StringMap NonPkgRefIndexes; - auto GetNonPkgRefSymIdx = [&](const MCSymbol *Sym) { + auto GetNonPkgRefSymIdx = [&](const MCSymbol *Sym, bool IsFunction) { StringRef Name = GetSymbolName(Sym); if (Name.empty()) report_fatal_error("GoObj relocation target has an empty name"); - uint16_t ABI = - Asm->getContext().getGoObjSymbolABI(Sym).value_or(GoObj::SymABI0); + uint16_t ABI = GetSymbolABI(Sym, IsFunction); std::string Key = (Name + "#" + Twine(ABI)).str(); auto It = NonPkgRefIndexes.find(Key); if (It != NonPkgRefIndexes.end()) @@ -2279,7 +2295,21 @@ uint64_t GoObjObjectWriter::writeObject() { return GoObjSymRef{GoObj::PkgIdxBuiltin, Metadata->SymIdx}; } } - return GoObjSymRef{GoObj::PkgIdxNone, GetNonPkgRefSymIdx(Reloc.Symbol)}; + bool IsFunction; + switch (Reloc.Type) { + case GoObj::R_CALL: + case GoObj::R_CALLARM: + case GoObj::R_CALLARM64: + case GoObj::R_CALLPOWER: + case GoObj::R_CALLMIPS: + IsFunction = true; + break; + default: + IsFunction = Asm->getContext().isGoObjFunctionSymbol(Reloc.Symbol); + break; + } + return GoObjSymRef{GoObj::PkgIdxNone, + GetNonPkgRefSymIdx(Reloc.Symbol, IsFunction)}; } report_fatal_error( diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 6a41b5e406ed3..288de1173703e 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -166,8 +166,7 @@ void MCContext::reset() { MCSubtargetAllocator.DestroyAll(); InlineAsmUsedLabelNames.clear(); - GoObjSymbolABIs.clear(); - GoObjSymbolNames.clear(); + GoObjFunctionSymbols.clear(); GoObjPackageSymbolIndexes.clear(); GoObjCgoPragmas.clear(); GoObjNonPackageSymbols.clear(); diff --git a/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp b/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp index cc9068c6aec38..8a31bdb358593 100644 --- a/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp +++ b/llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp @@ -1346,7 +1346,6 @@ bool AArch64ExpandPseudoImpl::expandMI(MachineBasicBlock &MBB, if (MF.getTarget().getTargetTriple().isOSBinFormatGoObj()) { MCContext &Ctx = MF.getContext(); MCSymbol *Callee = Ctx.getOrCreateSymbol(WriteBarrierName); - Ctx.setGoObjSymbolABI(Callee, GoObj::SymABIInternal); Call.addSym(Callee); } else { Call.addExternalSymbol(WriteBarrierName); diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp index 9a9e768cc14b8..6e555ce21954a 100644 --- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp @@ -1275,13 +1275,13 @@ checkAArch64GoStackGrowthStatepointContract(const MachineFunction &MF) { static MachineInstrBuilder buildAArch64GoStackGrowthStatepoint( MachineFunction &MF, MachineBasicBlock &MBB, const DebugLoc &DL, - const AArch64InstrInfo &TII, const char *Callee) { + const AArch64InstrInfo &TII, StringRef CalleeName) { MachineInstrBuilder Statepoint = BuildMI(&MBB, DL, TII.get(TargetOpcode::STATEPOINT)) .addImm(goabi::StackGrowthStatepointID) .addImm(0) - .addImm(0) - .addExternalSymbol(Callee); + .addImm(0); + goabi::addGoObjABI0Callee(Statepoint, MF, CalleeName); auto AddConstant = [&](uint64_t Value) { Statepoint.addImm(StackMaps::ConstantOp).addImm(Value); }; @@ -1521,8 +1521,9 @@ static void emitAArch64GoStackCheck(MachineFunction &MF, MachineInstrBuilder Morestack = UseStackGrowthStatepoint ? buildAArch64GoStackGrowthStatepoint( MF, *MorestackMBB, DL, TII, MorestackName) - : BuildMI(MorestackMBB, DL, TII.get(AArch64::BL)) - .addExternalSymbol(MorestackName); + : BuildMI(MorestackMBB, DL, TII.get(AArch64::BL)); + if (!UseStackGrowthStatepoint) + goabi::addGoObjABI0Callee(Morestack, MF, MorestackName); Morestack.addReg(AArch64::X3, RegState::Implicit); if (HasClosureContext) Morestack.addReg(AArch64::X26, RegState::Implicit); diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp index 5caa8656dbdac..bb2294b7de622 100644 --- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp +++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp @@ -301,7 +301,6 @@ bool X86ExpandPseudoImpl::expandMI(MachineBasicBlock &MBB, if (MF.getTarget().getTargetTriple().isOSBinFormatGoObj()) { MCContext &Ctx = MF.getContext(); MCSymbol *Callee = Ctx.getOrCreateSymbol(WriteBarrierName); - Ctx.setGoObjSymbolABI(Callee, GoObj::SymABIInternal); Call.addSym(Callee); } else { Call.addExternalSymbol(WriteBarrierName); diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index 40fc8405426ea..bc779ead6c3f3 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -247,13 +247,13 @@ static MachineInstrBuilder buildGoStackGrowthStatepoint(MachineFunction &MF, MachineBasicBlock &MBB, const DebugLoc &DL, const X86InstrInfo &TII, - const char *Callee) { + StringRef CalleeName) { MachineInstrBuilder Statepoint = BuildMI(&MBB, DL, TII.get(TargetOpcode::STATEPOINT)) .addImm(goabi::StackGrowthStatepointID) .addImm(0) - .addImm(0) - .addExternalSymbol(Callee); + .addImm(0); + goabi::addGoObjABI0Callee(Statepoint, MF, CalleeName); auto AddConstant = [&](uint64_t Value) { Statepoint.addImm(StackMaps::ConstantOp).addImm(Value); }; @@ -421,8 +421,9 @@ static void emitGoStackCheck(MachineFunction &MF, UseStackGrowthStatepoint ? buildGoStackGrowthStatepoint(MF, *MorestackMBB, DL, TII, MorestackName) - : BuildMI(MorestackMBB, DL, TII.get(X86::CALL64pcrel32)) - .addExternalSymbol(MorestackName); + : BuildMI(MorestackMBB, DL, TII.get(X86::CALL64pcrel32)); + if (!UseStackGrowthStatepoint) + goabi::addGoObjABI0Callee(Morestack, MF, MorestackName); if (HasClosureContext) Morestack.addReg(X86::RDX, RegState::Implicit); emitGoRegSpills(MF, *MorestackMBB, Homes, /*Reload=*/true); diff --git a/llvm/test/CodeGen/AArch64/goobj-abi.ll b/llvm/test/CodeGen/AArch64/goobj-abi.ll index 66392c59e893b..12803449afa58 100644 --- a/llvm/test/CodeGen/AArch64/goobj-abi.ll +++ b/llvm/test/CodeGen/AArch64/goobj-abi.ll @@ -11,7 +11,7 @@ entry: ret i64 %sum } -define goabi0 i64 @stackadd(i64 %a, i64 %b) #0 { +define goabi0 i64 @"stackadd"(i64 %a, i64 %b) #0 { entry: %sum = add i64 %a, %b ret i64 %sum @@ -78,7 +78,7 @@ entry: ret %aggregate %result } -; ASM-LABEL: stackadd: +; ASM-LABEL: "stackadd": ; ASM: ldp x{{[0-9]+}}, x{{[0-9]+}}, [sp, #8] ; ASM: str x{{[0-9]+}}, [sp, #24] @@ -88,7 +88,7 @@ entry: ; ASM: cmp sp, x17 ; ASM: b.hi [[CALLS_BODY:.LBB[0-9_]+]] ; ASM: mov x3, x30 -; ASM: bl runtime.morestack_noctxt +; ASM: bl "runtime.morestack_noctxt" ; ASM-NEXT: b [[CALLS_CHECK]] ; ASM: [[CALLS_BODY]]: ; ASM: str x30, [sp, #-16]! @@ -126,7 +126,7 @@ entry: ; ASM: [[LARGE_MORESTACK]]: ; ASM: mov x3, x30 ; ASM: str x0, [sp, #8] -; ASM: bl runtime.morestack_noctxt +; ASM: bl "runtime.morestack_noctxt" ; ASM: ldr x0, [sp, #8] ; ASM-NEXT: b [[LARGE_CHECK]] ; ASM: [[LARGE_BODY]]: @@ -145,7 +145,7 @@ entry: ; ASM: b.hi [[CLOSURE_BODY:.LBB[0-9_]+]] ; ASM: [[CLOSURE_MORESTACK]]: ; ASM: mov x3, x30 -; ASM: bl runtime.morestack +; ASM: bl "runtime.morestack" ; ASM: b [[CLOSURE_CHECK]] ; ASM: [[CLOSURE_BODY]]: diff --git a/llvm/test/CodeGen/AArch64/goobj-ir-config.ll b/llvm/test/CodeGen/AArch64/goobj-ir-config.ll index c8a42c7367bbd..bcf1133f8b728 100644 --- a/llvm/test/CodeGen/AArch64/goobj-ir-config.ll +++ b/llvm/test/CodeGen/AArch64/goobj-ir-config.ll @@ -6,7 +6,7 @@ ; settings in the IR. llc must not need a matching set of -goobj-* flags. target triple = "aarch64-apple-darwin-goobj" -define void @main.main() { +define goabiinternal void @main.main() { entry: ret void } diff --git a/llvm/test/CodeGen/AArch64/goobj-pcsp-cfg.ll b/llvm/test/CodeGen/AArch64/goobj-pcsp-cfg.ll index e69d35fcedadb..90094e13195eb 100644 --- a/llvm/test/CodeGen/AArch64/goobj-pcsp-cfg.ll +++ b/llvm/test/CodeGen/AArch64/goobj-pcsp-cfg.ll @@ -42,7 +42,7 @@ attributes #0 = { "frame-pointer"="non-leaf" } ; ASM: ldr x30, [sp], #32 ; ASM: ret ; ASM: bl runtime.GC -; ASM: bl runtime.morestack_noctxt +; ASM: bl "runtime.morestack_noctxt" ; The return occupies PC quanta 18-19. The out-of-line then block at 19-23 ; restores the 32-byte frame depth before morestack restores the entry depth. diff --git a/llvm/test/CodeGen/AArch64/goobj-private-constants.ll b/llvm/test/CodeGen/AArch64/goobj-private-constants.ll index d075774c2e8e3..b9bf8ec273c76 100644 --- a/llvm/test/CodeGen/AArch64/goobj-private-constants.ll +++ b/llvm/test/CodeGen/AArch64/goobj-private-constants.ll @@ -5,7 +5,7 @@ @.str = private unnamed_addr constant [24 x i8] c"bad data want %d, got %d" @after = internal constant i64 84, section ".rodata", align 8 -define ptr @private_string_address() { +define goabiinternal ptr @private_string_address() { entry: ret ptr @.str } diff --git a/llvm/test/CodeGen/AArch64/goobj-register-argument-homes.ll b/llvm/test/CodeGen/AArch64/goobj-register-argument-homes.ll index 5f4d38c722a01..e337f0fd2a41c 100644 --- a/llvm/test/CodeGen/AArch64/goobj-register-argument-homes.ll +++ b/llvm/test/CodeGen/AArch64/goobj-register-argument-homes.ll @@ -33,7 +33,7 @@ entry: ; CHECK-DAG: offset: 8, size: 1 ; CHECK: STRBBui $w0, $sp, 8 ; CHECK-NEXT: STRHHui $w1, $sp, 5 -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt" ; CHECK: $w0 = LDRBBui $sp, 8 ; CHECK-NEXT: $w1 = LDRHHui $sp, 5 @@ -41,12 +41,12 @@ entry: ; CHECK: offset: 32776, size: 8 ; CHECK: $x27 = ADDXri $sp, 16, 0 ; CHECK-NEXT: STRXui $x0, $x27, 4095 -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt" ; CHECK: $x27 = ADDXri $sp, 16, 0 ; CHECK-NEXT: $x0 = LDRXui $x27, 4095 ; CHECK-LABEL: name: large_home_boundary ; CHECK: offset: 32760, size: 8 ; CHECK: STRXui $x0, $sp, 4095 -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt" ; CHECK: $x0 = LDRXui $sp, 4095 diff --git a/llvm/test/CodeGen/AArch64/goobj-stack-growth-statepoint.ll b/llvm/test/CodeGen/AArch64/goobj-stack-growth-statepoint.ll index cd36541be09fc..afb9de6d20cbc 100644 --- a/llvm/test/CodeGen/AArch64/goobj-stack-growth-statepoint.ll +++ b/llvm/test/CodeGen/AArch64/goobj-stack-growth-statepoint.ll @@ -39,7 +39,7 @@ entry: ; CHECK-LABEL: name: closure_morestack_statepoint ; CHECK-NOT: ANNOTATION_LABEL -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, ; CHECK-SAME: csr_aarch64_go, implicit-def $sp, ; CHECK-SAME: implicit-def dead early-clobber $lr, @@ -48,7 +48,7 @@ entry: ; CHECK-LABEL: name: pointer_morestack_statepoint ; CHECK: STRXui $x0, $sp, 1 -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 1, 1, 8, $sp, 8, ; CHECK-SAME: 2, 0, 2, 1, 0, 0, ; CHECK-SAME: csr_aarch64_go, implicit-def $sp, @@ -58,7 +58,7 @@ entry: ; CHECK-NOT: BL ; CHECK-LABEL: name: mixed_register_and_stack_pointer_args -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 2, ; CHECK-SAME: 1, 8, $sp, 16, 1, 8, $sp, 8, ; CHECK-SAME: 2, 0, 2, 2, 0, 0, 1, 1, diff --git a/llvm/test/CodeGen/Generic/goobj-abi0-name-contract.ll b/llvm/test/CodeGen/Generic/goobj-abi0-name-contract.ll new file mode 100644 index 0000000000000..8e1bdea8a9412 --- /dev/null +++ b/llvm/test/CodeGen/Generic/goobj-abi0-name-contract.ll @@ -0,0 +1,29 @@ +; RUN: split-file %s %t +; RUN: not --crash llc -mtriple=x86_64-unknown-linux-goobj -filetype=obj \ +; RUN: -o /dev/null %t/unsuffixed.ll 2>&1 | FileCheck %s --check-prefix=MISMATCH +; RUN: not --crash llc -mtriple=x86_64-unknown-linux-goobj -filetype=obj \ +; RUN: -o /dev/null %t/internal-suffix.ll 2>&1 | FileCheck %s --check-prefix=MISMATCH +; RUN: not --crash llc -mtriple=x86_64-unknown-linux-goobj -filetype=obj \ +; RUN: -o /dev/null %t/obsolete-metadata.ll 2>&1 | FileCheck %s --check-prefix=METADATA + +; MISMATCH: LLVM ERROR: Go ABI0 calling convention and symbol suffix disagree +; METADATA: LLVM ERROR: !goobj.symbol.name is obsolete; encode ABI0 in the symbol name + +;--- unsuffixed.ll +define goabi0 void @missing_suffix() { + ret void +} + +;--- internal-suffix.ll +define goabiinternal void @"wrong_suffix"() { + ret void +} + +;--- obsolete-metadata.ll +define goabiinternal void @obsolete_metadata() !goobj.symbol.name !0 { + ret void +} + +!0 = !{!"other_name"} + +; REQUIRES: x86-registered-target diff --git a/llvm/test/CodeGen/Generic/goobj-no-hosted-libcalls.ll b/llvm/test/CodeGen/Generic/goobj-no-hosted-libcalls.ll index 0957fe1dcb845..ebafe9f9db3b8 100644 --- a/llvm/test/CodeGen/Generic/goobj-no-hosted-libcalls.ll +++ b/llvm/test/CodeGen/Generic/goobj-no-hosted-libcalls.ll @@ -5,7 +5,7 @@ ; ELF: callq __udivti3 ; GOOBJ: LLVM ERROR: no runtime library implementation is available for this operation -define i128 @udiv_i128(i128 %dividend, i128 %divisor) { +define goabiinternal i128 @udiv_i128(i128 %dividend, i128 %divisor) { %quotient = udiv i128 %dividend, %divisor ret i128 %quotient } diff --git a/llvm/test/CodeGen/Generic/goobj-statepoint-requires-stack-growth-attribute.ll b/llvm/test/CodeGen/Generic/goobj-statepoint-requires-stack-growth-attribute.ll index db2d3dcb3878d..9df6561709bb7 100644 --- a/llvm/test/CodeGen/Generic/goobj-statepoint-requires-stack-growth-attribute.ll +++ b/llvm/test/CodeGen/Generic/goobj-statepoint-requires-stack-growth-attribute.ll @@ -8,7 +8,7 @@ ; function instead of allowing the preceding call's map to cover the raw ; runtime.morestack call. -declare void @callee() +declare goabiinternal void @callee() define goabiinternal void @missing_stack_growth_attribute() gc "statepoint-example" { diff --git a/llvm/test/CodeGen/X86/Inputs/goobj-toolexec-module/dep/answer.ll b/llvm/test/CodeGen/X86/Inputs/goobj-toolexec-module/dep/answer.ll index 8d67a7303fcee..36b5a84061ee3 100644 --- a/llvm/test/CodeGen/X86/Inputs/goobj-toolexec-module/dep/answer.ll +++ b/llvm/test/CodeGen/X86/Inputs/goobj-toolexec-module/dep/answer.ll @@ -79,7 +79,7 @@ entry: ret i64 %ret } -define goabi0 i64 @"example.com/goobjtoolexec/dep.StackAdd"(i64 %a, i64 %b) { +define goabi0 i64 @"example.com/goobjtoolexec/dep.StackAdd"(i64 %a, i64 %b) { entry: %sum = add i64 %a, %b ret i64 %sum diff --git a/llvm/test/CodeGen/X86/go-callconv.ll b/llvm/test/CodeGen/X86/go-callconv.ll index ae6154524045d..226f7007968ad 100644 --- a/llvm/test/CodeGen/X86/go-callconv.ll +++ b/llvm/test/CodeGen/X86/go-callconv.ll @@ -61,8 +61,8 @@ entry: ret { i64, %go.empty.carrier, i64 } %r1 } -define goabi0 i64 @abi0_second_int(i64 %a, i64 %b) { -; X86-LABEL: abi0_second_int: +define goabi0 i64 @"abi0_second_int"(i64 %a, i64 %b) { +; X86-LABEL: "abi0_second_int": ; X86: movq 16(%rsp), %rax ; X86: movq %rax, 24(%rsp) ; X86: retq @@ -70,16 +70,16 @@ entry: ret i64 %b } -define goabi0 i64 @abi0_call_second_int() { -; X86-LABEL: abi0_call_second_int: +define goabi0 i64 @"abi0_call_second_int"() { +; X86-LABEL: "abi0_call_second_int": ; X86: movq %rsp, %[[BASE:r[a-z0-9]+]] ; X86: movq $22, 8(%[[BASE]]) ; X86: movq $11, (%[[BASE]]) -; X86: callq abi0_second_int +; X86: callq "abi0_second_int" ; X86: movq %rsp, %[[RELOAD:r[a-z0-9]+]] ; X86: movq 16(%[[RELOAD]]), %rax entry: - %ret = call goabi0 i64 @abi0_second_int(i64 11, i64 22) + %ret = call goabi0 i64 @"abi0_second_int"(i64 11, i64 22) ret i64 %ret } diff --git a/llvm/test/CodeGen/X86/go-memset-inline.ll b/llvm/test/CodeGen/X86/go-memset-inline.ll index 3edde2491d121..378aec5f18ece 100644 --- a/llvm/test/CodeGen/X86/go-memset-inline.ll +++ b/llvm/test/CodeGen/X86/go-memset-inline.ll @@ -12,8 +12,8 @@ define goabiinternal void @constant_memset(ptr %dst) { ret void } -define goabi0 void @dynamic_memset(ptr %dst, i64 %size) { -; CHECK-LABEL: dynamic_memset: +define goabi0 void @"dynamic_memset"(ptr %dst, i64 %size) { +; CHECK-LABEL: "dynamic_memset": ; CHECK: rep ; CHECK-SAME: stosb ; CHECK-NOT: callq memset diff --git a/llvm/test/CodeGen/X86/goobj-data-relocations.ll b/llvm/test/CodeGen/X86/goobj-data-relocations.ll index 7f727cd6f2181..e6ef87989e548 100644 --- a/llvm/test/CodeGen/X86/goobj-data-relocations.ll +++ b/llvm/test/CodeGen/X86/goobj-data-relocations.ll @@ -19,7 +19,7 @@ i32 ptrtoint (ptr @method_type to i32) }>, section ".rodata", align 4, !goobj.relocs !2 -declare void @method_text() +declare goabiinternal void @method_text() !0 = !{!3} !1 = !{i32 0} diff --git a/llvm/test/CodeGen/X86/goobj-filetype.ll b/llvm/test/CodeGen/X86/goobj-filetype.ll index 008e6a284ff4b..ac38f940ba5f1 100644 --- a/llvm/test/CodeGen/X86/goobj-filetype.ll +++ b/llvm/test/CodeGen/X86/goobj-filetype.ll @@ -33,7 +33,7 @@ entry: ; CHECK-NEXT: hasheddef 0: abi=0 type=3 ; CHECK: nonpkgdef-count: 0 ; CHECK: nonpkgref-count: 1 -; CHECK-NEXT: nonpkgref 0: ext abi=0 type=0 size=0 +; CHECK-NEXT: nonpkgref 0: ext abi=1 type=0 size=0 ; CHECK: aux 0.0: type=funcinfo target= args=0 locals=0 ; CHECK-NEXT: aux 0.1: type=funcdata target= data=0100000000000000 ; CHECK-NEXT: aux 0.2: type=funcdata target= data=0100000000000000 diff --git a/llvm/test/CodeGen/X86/goobj-function-abi-name.ll b/llvm/test/CodeGen/X86/goobj-function-abi-name.ll new file mode 100644 index 0000000000000..a871246ffc7da --- /dev/null +++ b/llvm/test/CodeGen/X86/goobj-function-abi-name.ll @@ -0,0 +1,45 @@ +; RUN: llc -mtriple=x86_64-unknown-linux-goobj -goobj-package-path=main -filetype=obj < %s -o %t.o +; RUN: %python %S/../../MC/GoObj/Inputs/dump-goobj.py %t.o | FileCheck %s + +module asm ".goobj.cgo \22[[\\\22cgo_import_static\\\22,\\\22external_c\\\22]]\22" + +define goabi0 void @"same"() { +entry: + ret void +} + +define goabiinternal void @same() { +entry: + call goabi0 void @"same"() + ret void +} + +define goabi0 void @"suffix_only"() { +entry: + ret void +} + +declare goabi0 void @"external_abi0"() +declare goabiinternal void @external_internal() + +@abi0_function_ptr = global ptr @"external_abi0" +@internal_function_ptr = global ptr @external_internal +@external_c = global i8 0, !goobj.symbol.nonpackage !1 +@external_c_ptr = global ptr @external_c + +; CHECK: header: {{.*}}cgo_import_static{{.*}}external_c +; CHECK: symdef 0: same abi=0 type=1 +; CHECK-NEXT: symdef 1: same abi=1 type=1 +; CHECK-NEXT: symdef 2: suffix_only abi=0 type=1 +; CHECK-NEXT: symdef 3: abi0_function_ptr abi=0 type=7 +; CHECK-NEXT: symdef 4: internal_function_ptr abi=0 type=7 +; CHECK-NEXT: symdef 5: external_c_ptr abi=0 type=7 +; CHECK: nonpkgdef 0: external_c abi=0 type=9 +; CHECK: nonpkgref {{[0-9]+}}: external_abi0 abi=0 type=0 +; CHECK: nonpkgref {{[0-9]+}}: external_internal abi=1 type=0 +; CHECK: target=same +; CHECK: target=external_abi0 +; CHECK: target=external_internal +; CHECK: target=external_c + +!1 = !{i1 true} diff --git a/llvm/test/CodeGen/X86/goobj-function-abi.ll b/llvm/test/CodeGen/X86/goobj-function-abi.ll index 932b7b1b3237e..f6557ebf08f19 100644 --- a/llvm/test/CodeGen/X86/goobj-function-abi.ll +++ b/llvm/test/CodeGen/X86/goobj-function-abi.ll @@ -1,7 +1,7 @@ ; RUN: llc -mtriple=x86_64-unknown-linux-goobj -filetype=obj < %s -o %t.o ; RUN: %python %S/../../MC/GoObj/Inputs/dump-goobj.py %t.o | FileCheck %s -define goabi0 void @abi0_func() { +define goabi0 void @"abi0_func"() { entry: ret void } diff --git a/llvm/test/CodeGen/X86/goobj-pcsp-cfg.ll b/llvm/test/CodeGen/X86/goobj-pcsp-cfg.ll index fb2a0af3ca072..69795833b09c3 100644 --- a/llvm/test/CodeGen/X86/goobj-pcsp-cfg.ll +++ b/llvm/test/CodeGen/X86/goobj-pcsp-cfg.ll @@ -41,7 +41,7 @@ attributes #0 = { "frame-pointer"="non-leaf" } ; ASM: callq runtime.panicmem ; ASM: retq ; ASM: callq runtime.GC -; ASM: callq runtime.morestack_noctxt +; ASM: callq "runtime.morestack_noctxt" ; The return occupies PC quanta 57-58. The out-of-line then block at 59-66 ; restores the 24-byte frame depth before morestack restores the entry depth. diff --git a/llvm/test/CodeGen/X86/goobj-stack-growth-metadata.ll b/llvm/test/CodeGen/X86/goobj-stack-growth-metadata.ll index 3f6659d58be1c..6b46c8b4a98b3 100644 --- a/llvm/test/CodeGen/X86/goobj-stack-growth-metadata.ll +++ b/llvm/test/CodeGen/X86/goobj-stack-growth-metadata.ll @@ -88,7 +88,7 @@ join: ; ASM: cmpq 16(%r14), %r12 ; ASM: ja [[BIG_BODY:.LBB0_[0-9]+]] ; ASM: [[BIG_MORESTACK]]: -; ASM: callq runtime.morestack_noctxt +; ASM: callq "runtime.morestack_noctxt" ; ASM-NEXT: movq 8(%rsp), %rax ; ASM-NEXT: jmp [[BIG_CHECK]] ; ASM: [[BIG_BODY]]: @@ -96,7 +96,7 @@ join: ; ASM-LABEL: big_closure_frame: ; ASM: [[CLOSURE_CHECK:.LBB1_[0-9]+]]: -; ASM: callq runtime.morestack +; ASM: callq "runtime.morestack" ; ASM: jmp [[CLOSURE_CHECK]] ; ASM: retq @@ -112,11 +112,11 @@ join: ; PEI: fixedStack: ; PEI-NEXT: - { id: 0, type: spill-slot, offset: 0, size: 8 ; PEI: MOV64mr {{.*rsp}}, 1, {{.*noreg}}, 8, {{.*noreg}}, {{.*rax}} -; PEI: CALL64pcrel32 &runtime.morestack_noctxt +; PEI: CALL64pcrel32 &"runtime.morestack_noctxt" ; PEI: {{.*rax}} = MOV64rm {{.*rsp}}, 1, {{.*noreg}}, 8, {{.*noreg}} ; PEI-LABEL: name: big_closure_frame -; PEI: CALL64pcrel32 &runtime.morestack, {{.*}}implicit $rdx +; PEI: CALL64pcrel32 &"runtime.morestack", {{.*}}implicit $rdx ; PEI-LABEL: name: large_outgoing_frame ; PEI: stackSize: 0 diff --git a/llvm/test/CodeGen/X86/goobj-stack-growth-statepoint.ll b/llvm/test/CodeGen/X86/goobj-stack-growth-statepoint.ll index f194941e30360..005b774550eb6 100644 --- a/llvm/test/CodeGen/X86/goobj-stack-growth-statepoint.ll +++ b/llvm/test/CodeGen/X86/goobj-stack-growth-statepoint.ll @@ -21,7 +21,7 @@ entry: ret i64 %value } -define goabi0 void @abi0_pointer_arguments(ptr %first, ptr %second, ptr %third) +define goabi0 void @"abi0_pointer_arguments"(ptr %first, ptr %second, ptr %third) "frame-pointer"="non-leaf" "go-stack-growth-statepoint" { entry: call goabiinternal void @use_three_pointers( @@ -78,7 +78,7 @@ entry: ; CHECK-LABEL: name: morestack_statepoint ; CHECK-NOT: ANNOTATION_LABEL -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, ; CHECK-SAME: csr_64_go, implicit-def $rsp, implicit-def $ssp ; CHECK-NOT: CALL64pcrel32 @@ -90,12 +90,12 @@ entry: ; GoABI0 fixed homes retain their logical argument-area offsets, while loads ; and stack-map locations include the physical entry RSP return-address word. -; CHECK-LABEL: name: abi0_pointer_arguments +; CHECK-LABEL: name: 'abi0_pointer_arguments' ; CHECK: fixedStack: ; CHECK: offset: 16, size: 8 ; CHECK: offset: 8, size: 8 ; CHECK: offset: 0, size: 8 -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 23, 2, 0, 2, 0, 2, 3, ; CHECK-SAME: 1, 8, $rsp, 8, 1, 8, $rsp, 16, 1, 8, $rsp, 24, ; CHECK-SAME: 2, 0, 2, 3, 0, 0, 1, 1, 2, 2, @@ -106,7 +106,7 @@ entry: ; CHECK-LABEL: name: initialized_pointer_result ; CHECK: MOV64mr $rsp, 1, $noreg, 72, $noreg, $rax -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 1, ; CHECK-SAME: 1, 8, $rsp, 72, ; CHECK-SAME: 2, 0, 2, 1, 0, 0, @@ -115,21 +115,21 @@ entry: ; CHECK-LABEL: name: partial_aggregate_result ; CHECK: MOV64mr $rsp, 1, $noreg, 80, $noreg, $rax ; CHECK: MOV64mr $rsp, 1, $noreg, 88, $noreg, $rbx -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 2, ; CHECK-SAME: 1, 8, $rsp, 80, 1, 8, $rsp, 88, ; CHECK-SAME: 2, 0, 2, 2, 0, 0, 1, 1, ; CHECK-SAME: csr_64_go, implicit-def $rsp, implicit-def $ssp ; CHECK-LABEL: name: scalar_stack_argument -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 1, ; CHECK-SAME: 1, 8, $rsp, 64, ; CHECK-SAME: 2, 0, 2, 1, 0, 0, ; CHECK-SAME: csr_64_go, implicit-def $rsp, implicit-def $ssp ; CHECK-LABEL: name: aggregate_stack_argument -; CHECK: STATEPOINT 5147424658422983495, 0, 0, &runtime.morestack_noctxt, +; CHECK: STATEPOINT 5147424658422983495, 0, 0, &"runtime.morestack_noctxt", ; CHECK-SAME: 2, 22, 2, 0, 2, 0, 2, 2, ; CHECK-SAME: 1, 8, $rsp, 48, 1, 8, $rsp, 64, ; CHECK-SAME: 2, 0, 2, 2, 0, 0, 1, 1, diff --git a/llvm/test/CodeGen/X86/goobj-symbol-name.ll b/llvm/test/CodeGen/X86/goobj-symbol-name.ll deleted file mode 100644 index 895131c4dd658..0000000000000 --- a/llvm/test/CodeGen/X86/goobj-symbol-name.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: llc -mtriple=x86_64-unknown-linux-goobj -goobj-package-path=main -filetype=obj < %s -o %t.o -; RUN: %python %S/../../MC/GoObj/Inputs/dump-goobj.py %t.o | FileCheck %s - -module asm ".goobj.cgo \22[[\\\22cgo_import_static\\\22,\\\22external_c\\\22]]\22" - -define goabi0 void @"same.goallc.abi0"() !goobj.symbol.name !0 { -entry: - ret void -} - -define goabiinternal void @same() { -entry: - call goabi0 void @"same.goallc.abi0"() - ret void -} - -@external_c = global i8 0, !goobj.symbol.nonpackage !1 -@external_c_ptr = global ptr @external_c - -; CHECK: header: {{.*}}cgo_import_static{{.*}}external_c -; CHECK: symdef 0: same abi=0 type=1 -; CHECK-NEXT: symdef 1: same abi=1 type=1 -; CHECK-NEXT: symdef 2: external_c_ptr abi=0 type=7 -; CHECK: nonpkgdef 0: external_c abi=0 type=9 -; CHECK: target=same -; CHECK: target=external_c - -!0 = !{!"same"} -!1 = !{i1 true} diff --git a/llvm/test/CodeGen/X86/goobj-toolexec-go-toolchain.test b/llvm/test/CodeGen/X86/goobj-toolexec-go-toolchain.test index 281919e8f71bb..023e15cadc524 100644 --- a/llvm/test/CodeGen/X86/goobj-toolexec-go-toolchain.test +++ b/llvm/test/CodeGen/X86/goobj-toolexec-go-toolchain.test @@ -1,8 +1,8 @@ # This exercises a mixed Go/LLVM GoObj link through go build -toolexec. The # dependency package contains an LLVM IR file that llvm-goobj-toolexec discovers -# from the package source directory. The IR definitions use goabiinternal and goabi0, -# so their symabis declarations and GoObj symbol ABI records come directly from -# each function's IR calling convention. +# from the package source directory. Its IR uses plain ABIInternal names and +# -suffixed ABI0 names, exercising the same identity contract as the Go +# frontend for declarations, definitions, and GoObj records. # The test executes the linked binary, so it requires a native linux/amd64 host. # REQUIRES: x86-registered-target, x86_64-linux, native diff --git a/llvm/test/MC/GoObj/aarch64-relocations.s b/llvm/test/MC/GoObj/aarch64-relocations.s index fb3e032b0bbbb..c4d99c9154786 100644 --- a/llvm/test/MC/GoObj/aarch64-relocations.s +++ b/llvm/test/MC/GoObj/aarch64-relocations.s @@ -9,7 +9,7 @@ # CHECK: nonpkgdef 3: split_add abi=0 type=1 size=8 # CHECK: nonpkgdef 4: ptr abi=0 type=7 size=16 # CHECK: nonpkgdef 5: data abi=0 type=7 size=8 -# CHECK: nonpkgref 0: external.func abi=0 type=0 size=0 +# CHECK: nonpkgref 0: external.func abi=1 type=0 size=0 # CHECK: nonpkgref 1: external.data abi=0 type=0 size=0 # CHECK: reloc 0.0: off=0 size=4 type=9 add=0 target=callee # CHECK: reloc 0.1: off=4 size=4 type=9 add=0 target=external.func diff --git a/llvm/test/MC/GoObj/relocations.s b/llvm/test/MC/GoObj/relocations.s index 23aa93702da32..7f46123a446f4 100644 --- a/llvm/test/MC/GoObj/relocations.s +++ b/llvm/test/MC/GoObj/relocations.s @@ -8,7 +8,7 @@ # CHECK: nonpkgdef 2: ptr abi=0 type=7 size=16 # CHECK: nonpkgdef 3: data abi=0 type=7 size=8 # CHECK: nonpkgref-count: 2 -# CHECK: nonpkgref 0: external.func abi=0 type=0 size=0 +# CHECK: nonpkgref 0: external.func abi=1 type=0 size=0 # CHECK: nonpkgref 1: external.data abi=0 type=0 size=0 # CHECK: reloc 0.0: off=1 size=4 type=7 add=0 target=callee # CHECK: reloc 0.1: off=6 size=4 type=7 add=0 target=external.func