Skip to content

Commit 93af5cc

Browse files
freddy77jbeulich
authored andcommitted
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 <[email protected]> Signed-off-by: Andrew Cooper <[email protected]> Acked-by: Jan Beulich <[email protected]>
1 parent 2defb54 commit 93af5cc

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

xen/arch/x86/boot/Makefile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
obj-bin-y += head.o
22

3-
head-bin-objs := cmdline.o reloc.o
3+
obj32 := cmdline.32.o
4+
obj32 += reloc.32.o
45

5-
nocov-y += $(head-bin-objs)
6-
noubsan-y += $(head-bin-objs)
7-
targets += $(head-bin-objs)
6+
nocov-y += $(obj32)
7+
noubsan-y += $(obj32)
8+
targets += $(obj32)
89

9-
head-bin-objs := $(addprefix $(obj)/,$(head-bin-objs))
10+
obj32 := $(addprefix $(obj)/,$(obj32))
1011

1112
$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
12-
$(obj)/head.o: $(head-bin-objs:.o=.bin)
13+
$(obj)/head.o: $(obj32:.32.o=.bin)
1314

1415
CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
1516
$(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
1819
CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
1920

2021
# override for 32bit binaries
21-
$(head-bin-objs): CFLAGS_stack_boundary :=
22-
$(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
22+
$(obj32): CFLAGS_stack_boundary :=
23+
$(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
24+
25+
$(obj)/%.32.o: $(src)/%.c FORCE
26+
$(call if_changed_rule,cc_o_c)
2327

2428
LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
2529
LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
30+
LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
2631

2732
%.bin: %.lnk
2833
$(OBJCOPY) -j .text -O binary $< $@
2934

30-
%.lnk: %.o $(src)/build32.lds
31-
$(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o $@ $<
35+
%.lnk: %.32.o $(src)/build32.lds
36+
$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
3237

3338
clean-files := *.lnk *.bin

0 commit comments

Comments
 (0)