x86/boot: Prep work for 32bit object changes

Broken out of the subsequent patch for clarity.

 * Rename head-bin-objs to obj32
 * Use a .32.o suffix to distinguish these objects
 * Factor out $(LD32)

No functional change.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Frediano Ziglio authored and Jan Beulich committed 2024-10-15 14:24:25 +02:00
1 parent 2defb54490
commit 93af5cc4df
1 file changed
+15 -10
+15 -10
View File
@@ -1,15 +1,16 @@
obj-bin-y += head.o
head-bin-objs := cmdline.o reloc.o
obj32 := cmdline.32.o
obj32 += reloc.32.o
nocov-y += $(head-bin-objs)
noubsan-y += $(head-bin-objs)
targets += $(head-bin-objs)
nocov-y += $(obj32)
noubsan-y += $(obj32)
targets += $(obj32)
head-bin-objs := $(addprefix $(obj)/,$(head-bin-objs))
obj32 := $(addprefix $(obj)/,$(obj32))
$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
$(obj)/head.o: $(head-bin-objs:.o=.bin)
$(obj)/head.o: $(obj32:.32.o=.bin)
CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -18,16 +19,20 @@ CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS
CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
# override for 32bit binaries
$(head-bin-objs): CFLAGS_stack_boundary :=
$(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
$(obj32): CFLAGS_stack_boundary :=
$(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
$(obj)/%.32.o: $(src)/%.c FORCE
$(call if_changed_rule,cc_o_c)
LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
%.bin: %.lnk
$(OBJCOPY) -j .text -O binary $< $@
%.lnk: %.o $(src)/build32.lds
$(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o $@ $<
%.lnk: %.32.o $(src)/build32.lds
$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
clean-files := *.lnk *.bin
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.