[llvm] [RISCV] Let -data-sections also work on sbss/sdata sections (PR #87040)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 03:53:05 PDT 2024
================
@@ -104,10 +104,34 @@ bool RISCVELFTargetObjectFile::isGlobalInSmallSection(
MCSection *RISCVELFTargetObjectFile::SelectSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
// Handle Small Section classification here.
- if (Kind.isBSS() && isGlobalInSmallSection(GO, TM))
- return SmallBSSSection;
- if (Kind.isData() && isGlobalInSmallSection(GO, TM))
- return SmallDataSection;
+ if (isGlobalInSmallSection(GO, TM)) {
+ // Emit to an unique sdata/sbss section when -fdata-section is set.
+ // However, if a symbol has an explicit sdata/sbss section, place it in that
+ // section.
+ bool EmitUniquedSection = TM.getDataSections() && !GO->hasSection();
----------------
lenary wrote:
Ah, I see what's going on.
https://github.com/llvm/llvm-project/pull/87040
More information about the llvm-commits
mailing list