================
@@ -2317,8 +2317,12 @@ bool X86AsmParser::ParseIntelInlineAsmIdentifier(
     if (!IsParsingOffsetOperator)
       InstInfo->AsmRewrites->emplace_back(AOK_Label, Loc, Identifier.size(),
                                           InternalName);
-    else
-      Identifier = InternalName;
+    else {
+      // When parsing the offset operator, we need to prepend
+      // PrivateLabelPrefix to match the AOK_Label rewrite at label definition.
+      StringRef Prefix = getContext().getAsmInfo().getPrivateLabelPrefix();
+      Identifier = getContext().getOrCreateSymbol(Twine(Prefix) + 
InternalName)->getName();
----------------
sonyps5201314 wrote:

> If you use the correct getOrCreate you shouldn't need to manually add the 
> prefix?

Upon investigation, `MCContext::getOrCreateSymbol()` does not automatically add 
a prefix (it simply looks up or creates the symbol using the exact name 
provided). Therefore, we still need to manually prepend the prefix. The 
advantage of using `getOrCreateSymbol(Prefix + InternalName)` is that it lets 
the MC layer know the symbol is referenced.

https://github.com/llvm/llvm-project/pull/199552
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to