Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17c961f7 authored by Kees Cook's avatar Kees Cook Committed by H. Peter Anvin
Browse files

x86, relocs: Build separate 32/64-bit tools



Since the ELF structures and access macros change size based on 32 vs
64 bits, build a separate 32-bit relocs tool (for handling realmode
and 32-bit relocations), and a 64-bit relocs tool (for handling 64-bit
kernel relocations).

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/r/1365797627-20874-5-git-send-email-keescook@chromium.org


Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 946166af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE

targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs

CMD_RELOCS = arch/x86/tools/relocs
CMD_RELOCS = arch/x86/tools/relocs_$(BITS)
quiet_cmd_relocs = RELOCS  $@
      cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $<
$(obj)/vmlinux.relocs: vmlinux FORCE
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs
	$(call if_changed,objcopy)

quiet_cmd_relocs = RELOCS  $@
      cmd_relocs = arch/x86/tools/relocs --realmode $< > $@
      cmd_relocs = arch/x86/tools/relocs_32 --realmode $< > $@

targets += realmode.relocs
$(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
+2 −1
Original line number Diff line number Diff line
relocs
relocs_32*
relocs_64*
+18 −2
Original line number Diff line number Diff line
@@ -37,6 +37,22 @@ $(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/in

$(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c

HOSTCFLAGS_relocs_32.o += -DELF_BITS=32
HOSTCFLAGS_relocs_64.o += -DELF_BITS=64

quiet_cmd_cp_reloc = GEN     $@
      cmd_cp_reloc = cp $< $@

$(obj)/relocs_%.c: $(srctree)/arch/x86/tools/relocs.c
	$(call cmd,cp_reloc)

HOST_EXTRACFLAGS += -I$(srctree)/tools/include
hostprogs-y	+= relocs
relocs: $(obj)/relocs
hostprogs-y    += relocs_$(BITS)
relocs_binaries = relocs_$(BITS)
ifeq ($(CONFIG_64BIT),y)
	hostprogs-y  += relocs_32
	relocs_binaries += relocs_32
endif
relocs: $(relocs_binaries)
relocs_32: $(obj)/relocs_32
relocs_64: $(obj)/relocs_64