diff options
author | stephenpeckham <118857872+stephenpeckham@users.noreply.github.com> | 2023-12-04 17:35:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 17:35:47 -0600 |
commit | 4b1254e7d4c30c7e15669e8879f405814c1790ee (patch) | |
tree | 761de73a8697c32a007024cb2f0aeccd6011f0cc /llvm/lib/MC/MCObjectFileInfo.cpp | |
parent | 3d718d0ebac232f304a0a074610de2d9652ab21f (diff) | |
download | llvm-4b1254e7d4c30c7e15669e8879f405814c1790ee.zip llvm-4b1254e7d4c30c7e15669e8879f405814c1790ee.tar.gz llvm-4b1254e7d4c30c7e15669e8879f405814c1790ee.tar.bz2 |
[AIX] In assembly file, create a dummy text renamed to an empty string (#73052)
This works around an AIX assembler and linker bug. If the
-fno-integrated-as and -frecord-command-line options are used but
there's no actual code in the source file, the assembler creates an
object file with only an .info section. The AIX linker rejects such an
object file.
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectFileInfo.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 1b30645..a797595 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -933,10 +933,16 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) { // the ABI or object file format, but various tools rely on the section // name being empty (considering named symbols to be "user symbol names"). TextSection = Ctx->getXCOFFSection( - "", SectionKind::getText(), + "..text..", // Use a non-null name to work around an AIX assembler bug... + SectionKind::getText(), XCOFF::CsectProperties(XCOFF::StorageMappingClass::XMC_PR, XCOFF::XTY_SD), /* MultiSymbolsAllowed*/ true); + // ... but use a null name when generating the symbol table. + MCSectionXCOFF *TS = static_cast<MCSectionXCOFF *>(TextSection); + TS->getQualNameSymbol()->setSymbolTableName(""); + TS->setSymbolTableName(""); + DataSection = Ctx->getXCOFFSection( ".data", SectionKind::getData(), XCOFF::CsectProperties(XCOFF::StorageMappingClass::XMC_RW, XCOFF::XTY_SD), |