diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h --- a/llvm/include/llvm/MC/MCObjectFileInfo.h +++ b/llvm/include/llvm/MC/MCObjectFileInfo.h @@ -66,6 +66,9 @@ /// constants. MCSection *ReadOnlySection = nullptr; + /// Same as the above but for infrequently used data. + MCSection *ReadOnlyColdSection = nullptr; + /// If exception handling is supported by the target, this is the section the /// Language Specific Data Area information is emitted to. MCSection *LSDASection = nullptr; @@ -255,6 +258,7 @@ MCSection *getDataSection() const { return DataSection; } MCSection *getBSSSection() const { return BSSSection; } MCSection *getReadOnlySection() const { return ReadOnlySection; } + MCSection *getReadOnlyColdSection() const { return ReadOnlyColdSection; } MCSection *getCompactUnwindSection() const { return CompactUnwindSection; } MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; } MCSection *getDwarfInfoSection() const { return DwarfInfoSection; } diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -359,6 +359,9 @@ ReadOnlySection = Ctx->getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC); + ReadOnlyColdSection = + Ctx->getELFSection(".rodata.cold", ELF::SHT_PROGBITS, ELF::SHF_ALLOC); + TLSDataSection = Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHF_TLS | ELF::SHF_WRITE);