Skip to contentSkip to conversation

x86: use constant flags for section .init.rodata

PATCH In review Roger Pau Monne 2 participants 2 messages Aug 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: use constant flags for section .init.rodata

LLVM 11 complains with:

<instantiation>:1:1: error: changed section flags for .init.rodata, expected: 0x2 .pushsection .init.rodata
^
<instantiation>:30:9: note: while in macro instantiation

        entrypoint 0
        ^
entry.S:979:9: note: while in macro instantiation
        .rept 256
        ^

And:

entry.S:1015:9: error: changed section flags for .init.rodata, expected: 0x2

        .section .init.rodata
        ^

Fix it by explicitly using the same flags and type in all the instances.

---
 xen/arch/x86/x86_64/entry.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/x86_64/entry.S +2 -2
index 8b57a00040..1e880eb9f6 100644
@@ -967,7 +967,7 @@ GLOBAL(trap_nop)
 GLOBAL(autogen_entrypoints)
         /* pop into the .init.rodata section and record an entry point. */
         .macro entrypoint ent
-        .pushsection .init.rodata
+        .pushsection .init.rodata, "a", @progbits
         .quad \ent
         .popsection
         .endm
@@ -1012,5 +1012,5 @@ autogen_stubs: /* Automatically generated stubs. */
         vec = vec + 1
         .endr
 
-        .section .init.rodata
+        .section .init.rodata, "a", @progbits
         .size autogen_entrypoints, . - autogen_entrypoints
Signature · 1 line
2.28.0
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Roger Pau Monne

LLVM 11 complains with:

<instantiation>:1:1: error: changed section flags for .init.rodata, expected: 0x2 .pushsection .init.rodata
^
<instantiation>:30:9: note: while in macro instantiation

        entrypoint 0
        ^
entry.S:979:9: note: while in macro instantiation
        .rept 256
        ^
Quoted 5 lines

And:

entry.S:1015:9: error: changed section flags for .init.rodata, expected: 0x2

        .section .init.rodata
        ^

Another quirk, I would say. Has this been reported to them?

Quoted 2 lines

Fix it by explicitly using the same flags and type in all the instances.

Indeed these look to be the only instances (in assembly files, I didn't check asm()-s in C ones), with the slight exception of the .fixup section specifications in x86_64/compat/entry.S (where @progbits is omitted). Fair enough to establish consistency here even without the specific issue above in mind.

Quoted 1 line