This is an archive of the discontinued LLVM Phabricator instance.

[AIX] use the original name as the input to create the new symbol for TLS symbol.
ClosedPublic

Authored by Esme on Aug 21 2022, 10:27 PM.

Details

Summary

Currently, an error was reported when a thread local symbol has an invalid name.
D100956 create a new symbol to prefix the TLS symbol name with a dot. When the symbol name is renamed, the error occurs.
This patch uses the original symbol name (name in the symbol table) as the input for the symbol for TOC entry.

Diff Detail

Event Timeline

Esme created this revision.Aug 21 2022, 10:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2022, 10:27 PM
Esme requested review of this revision.Aug 21 2022, 10:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2022, 10:27 PM
@@ -2601,19 +2603,27 @@ void PPCAIXAsmPrinter::emitEndOfAsmFile(Module &M) {
       SmallString<128> Name;
       StringRef Prefix = ".";
       Name += Prefix;
-      Name += I.first.first->getName();
+      Name += cast<MCSymbolXCOFF>(I.first.first)->getSymbolTableName();

Will this make more sense? I saw for normal global variables, we will use the original symbol name(name in the symbol table) as the input for the symbol for TOC entry. See function MCSection *TargetLoweringObjectFileXCOFF::getSectionForTOCEntry().

Esme updated this revision to Diff 454407.Aug 22 2022, 1:39 AM
Esme retitled this revision from [AIX] remove the error report for the symbol name startswith "_Renamed.." to [AIX] use the original name as the input to create the new symbol for TLS symbol..
Esme edited the summary of this revision. (Show Details)

Thanks @shchenz 's comments.

Esme added a comment.Aug 22 2022, 1:39 AM
@@ -2601,19 +2603,27 @@ void PPCAIXAsmPrinter::emitEndOfAsmFile(Module &M) {
       SmallString<128> Name;
       StringRef Prefix = ".";
       Name += Prefix;
-      Name += I.first.first->getName();
+      Name += cast<MCSymbolXCOFF>(I.first.first)->getSymbolTableName();

Will this make more sense? I saw for normal global variables, we will use the original symbol name(name in the symbol table) as the input for the symbol for TOC entry. See function MCSection *TargetLoweringObjectFileXCOFF::getSectionForTOCEntry().

Thanks! @shchenz It's much more reasonable than the previous fix. I did not notice that we can get the original name from the symbol table.

shchenz accepted this revision as: shchenz.Aug 22 2022, 6:48 PM

LGTM

This revision is now accepted and ready to land.Aug 22 2022, 6:48 PM
lkail accepted this revision as: lkail.Aug 23 2022, 5:38 PM

LG