[PATCH] build: also exclude .data.rel.ro in $(cmd_obj_init_o)

Jan Beulich posted 1 patch 2 weeks, 3 days ago
[PATCH] build: also exclude .data.rel.ro in $(cmd_obj_init_o)
Posted by Jan Beulich 2 weeks, 3 days ago
.data.rel.ro really is merely a special case of .rodata: r/o data, but
with runtime relocations (not relevant to Xen), i.e. r/o only after
relocations were performed (by the dynamic loader).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
.*.local did already cover gcc's use of .data.rel.ro.local, but doesn't
cover Clang using e.g. .data.rel.ro..Lswitch.table.<function>.

Beyond exclusion being similarly (slightly) fragile as that of .rodata,
there's an extra naming issue here: A writable file scope variable named
"ro" with an initializer taking the address of another identifier would,
with -fdata-sections and -fpic, be put in .data.rel.ro by gcc (Clang uses
.data.ro irrespective of -fpic). See also
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127240.

--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -263,7 +263,7 @@ quiet_cmd_obj_init_o = INIT_O  $@
 define cmd_obj_init_o
     $(OBJDUMP) -h $< | while read idx name sz rest; do \
         case "$$name" in \
-        .*.local) ;; \
+        .*.local|.data.rel.ro|.data.rel.ro.*) ;; \
         .text|.text.*|.data|.data.*|.bss|.bss.*) \
             test $$(echo $$sz | sed 's,00*,0,') != 0 || continue; \
             echo "Error: size of $<:$$name is 0x$$sz" >&2; \
Re: [PATCH] build: also exclude .data.rel.ro in $(cmd_obj_init_o)
Posted by Andrew Cooper 2 weeks, 3 days ago
On 07/09/2026 1:18 pm, Jan Beulich wrote:
> .data.rel.ro really is merely a special case of .rodata: r/o data, but
> with runtime relocations (not relevant to Xen), i.e. r/o only after
> relocations were performed (by the dynamic loader).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>