Skip to contentSkip to conversation

build/non-x86: fix symbol lookup in presence of build-id

PATCH In review Jan Beulich 4 participants 4 messages Jan 16 – Jan 26 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build/non-x86: fix symbol lookup in presence of build-id

It's not clear why only x86 had $(build_id_linker) applied to all three linking passes. Not doing so will alter symbol offsets between the 2nd and 3rd passes for, potentially, all of the symbols at higher addresses (intermediate alignment padding may mask this effect, though, so it will look as if problems appeared randomly).

Fixes a353cab905af ("build_id: Provide ld-embedded build-ids")
xen/arch/arm/Makefile +2 -2
@@ -87,13 +87,13 @@ endif
 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 	$(objtree)/tools/symbols $(all_symbols) --empty > $(dot-target).0.S
 	$(MAKE) $(build)=$(@D) $(dot-target).0.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
 	      $(dot-target).0.o -o $(dot-target).0
 	$(NM) -pa --format=sysv $(dot-target).0 \
 		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
 		> $(dot-target).1.S
 	$(MAKE) $(build)=$(@D) $(dot-target).1.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
 	    $(dot-target).1.o -o $(dot-target).1
 	$(NM) -pa --format=sysv $(dot-target).1 \
 		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
xen/arch/ppc/Makefile +2 -2
@@ -14,13 +14,13 @@ $(TARGET): $(TARGET)-syms
 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 	$(objtree)/tools/symbols $(all_symbols) --empty > $(dot-target).0.S
 	$(MAKE) $(build)=$(@D) $(dot-target).0.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
 	      $(dot-target).0.o -o $(dot-target).0
 	$(NM) -pa --format=sysv $(dot-target).0 \
 		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
 		> $(dot-target).1.S
 	$(MAKE) $(build)=$(@D) $(dot-target).1.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
 	    $(dot-target).1.o -o $(dot-target).1
 	$(NM) -pa --format=sysv $(dot-target).1 \
 		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
xen/arch/riscv/Makefile +2 -2
@@ -28,13 +28,13 @@ $(TARGET): $(TARGET)-syms
 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 	$(objtree)/tools/symbols $(all_symbols) --empty > $(dot-target).0.S
 	$(MAKE) $(build)=$(@D) $(dot-target).0.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
 	      $(dot-target).0.o -o $(dot-target).0
 	$(NM) -pa --format=sysv $(dot-target).0 \
 		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
 		> $(dot-target).1.S
 	$(MAKE) $(build)=$(@D) $(dot-target).1.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
 	    $(dot-target).1.o -o $(dot-target).1
 	$(NM) -pa --format=sysv $(dot-target).1 \
 		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jan Beulich

It's not clear why only x86 had $(build_id_linker) applied to all three linking passes. Not doing so will alter symbol offsets between the 2nd and 3rd passes for, potentially, all of the symbols at higher addresses (intermediate alignment padding may mask this effect, though, so it will look as if problems appeared randomly).

Fixes a353cab905af ("build_id: Provide ld-embedded build-ids")

We really need to make this step common between architectures.  It's entirely magic, but mostly common.

~Andrew

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 9 lines · Jan Beulich

It's not clear why only x86 had $(build_id_linker) applied to all three linking passes. Not doing so will alter symbol offsets between the 2nd and 3rd passes for, potentially, all of the symbols at higher addresses (intermediate alignment padding may mask this effect, though, so it will look as if problems appeared randomly).

Fixes a353cab905af ("build_id: Provide ld-embedded build-ids")

...

Quoted 8 lines
xen/arch/riscv/Makefile +1 -1
@@ -28,13 +28,13 @@ $(TARGET): $(TARGET)-syms
  $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
  	$(objtree)/tools/symbols $(all_symbols) --empty > $(dot-target).0.S
  	$(MAKE) $(build)=$(@D) $(dot-target).0.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \

xen/arch/riscv/Makefile $(TARGET): $(TARGET)-syms · line 40

Quoted 10 lines
xen/arch/riscv/Makefile +1 -1
  	      $(dot-target).0.o -o $(dot-target).0
  	$(NM) -pa --format=sysv $(dot-target).0 \
  		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
  		> $(dot-target).1.S
  	$(MAKE) $(build)=$(@D) $(dot-target).1.o
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
  	    $(dot-target).1.o -o $(dot-target).1
  	$(NM) -pa --format=sysv $(dot-target).1 \
  		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \

~ Oleksii

Acked-by on v1 1/1
#3 lore raw
In reply to Jan Beulich
Quoted 9 lines · Jan Beulich

It's not clear why only x86 had $(build_id_linker) applied to all three linking passes. Not doing so will alter symbol offsets between the 2nd and 3rd passes for, potentially, all of the symbols at higher addresses (intermediate alignment padding may mask this effect, though, so it will look as if problems appeared randomly).

Fixes a353cab905af ("build_id: Provide ld-embedded build-ids")

~Michal