Skip to content

Commit 059e7cb

Browse files
linker script
1 parent 4eaff6c commit 059e7cb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lld/ELF/LinkerScript.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,22 @@ StringRef LinkerScript::getOutputSectionName(const InputSectionBase *s) const {
105105
return ".text";
106106
}
107107

108+
109+
if (isSectionPrefix(".rodata", s->name)) {
110+
// Map input sections' .rodata and rodata.hot into .rodata.hot in the output.
111+
// Map input sections' .rodata.unlikely into .rodata in the output.
112+
if (ctx.arg.zKeepTextSectionPrefix) {
113+
if (isSectionPrefix(".rodata.hot", s->name)) {
114+
return ".rodata.hot";
115+
}
116+
if (isSectionPrefix(".rodata.unlikely", s->name)) {
117+
return ".rodata";
118+
}
119+
return ".rodata.hot";
120+
}
121+
return ".rodata";
122+
}
123+
108124
for (StringRef v : {".data.rel.ro", ".data", ".rodata",
109125
".bss.rel.ro", ".bss", ".ldata",
110126
".lrodata", ".lbss", ".gcc_except_table",

0 commit comments

Comments
 (0)