diff options
| author | Kees Cook <keescook@chromium.org> | 2013-04-12 16:13:45 -0400 |
|---|---|---|
| committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-04-16 18:22:01 -0400 |
| commit | 17c961f7702ff6037b66bb2e5f3ddd58de4ce7e5 (patch) | |
| tree | d6f5b5fb22ef8e49242917129e40ceb97775370a | |
| parent | 946166af95d1defacfbc21e7c902d0556a2a7660 (diff) | |
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: Kees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/r/1365797627-20874-5-git-send-email-keescook@chromium.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| -rw-r--r-- | arch/x86/boot/compressed/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86/realmode/rm/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86/tools/.gitignore | 3 | ||||
| -rw-r--r-- | arch/x86/tools/Makefile | 20 |
4 files changed, 22 insertions, 5 deletions
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 5ef205c5f37b..0dac17528099 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
| @@ -44,7 +44,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE | |||
| 44 | 44 | ||
| 45 | targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs | 45 | targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs |
| 46 | 46 | ||
| 47 | CMD_RELOCS = arch/x86/tools/relocs | 47 | CMD_RELOCS = arch/x86/tools/relocs_$(BITS) |
| 48 | quiet_cmd_relocs = RELOCS $@ | 48 | quiet_cmd_relocs = RELOCS $@ |
| 49 | cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $< | 49 | cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $< |
| 50 | $(obj)/vmlinux.relocs: vmlinux FORCE | 50 | $(obj)/vmlinux.relocs: vmlinux FORCE |
diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile index 88692871823f..2b1e4294b8b9 100644 --- a/arch/x86/realmode/rm/Makefile +++ b/arch/x86/realmode/rm/Makefile | |||
| @@ -56,7 +56,7 @@ $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs | |||
| 56 | $(call if_changed,objcopy) | 56 | $(call if_changed,objcopy) |
| 57 | 57 | ||
| 58 | quiet_cmd_relocs = RELOCS $@ | 58 | quiet_cmd_relocs = RELOCS $@ |
| 59 | cmd_relocs = arch/x86/tools/relocs --realmode $< > $@ | 59 | cmd_relocs = arch/x86/tools/relocs_32 --realmode $< > $@ |
| 60 | 60 | ||
| 61 | targets += realmode.relocs | 61 | targets += realmode.relocs |
| 62 | $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE | 62 | $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE |
diff --git a/arch/x86/tools/.gitignore b/arch/x86/tools/.gitignore index be0ed065249b..2b45d5f063ba 100644 --- a/arch/x86/tools/.gitignore +++ b/arch/x86/tools/.gitignore | |||
| @@ -1 +1,2 @@ | |||
| 1 | relocs | 1 | relocs_32* |
| 2 | relocs_64* | ||
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile index bae601f900ef..a8cb70c6b8a1 100644 --- a/arch/x86/tools/Makefile +++ b/arch/x86/tools/Makefile | |||
| @@ -37,6 +37,22 @@ $(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/in | |||
| 37 | 37 | ||
| 38 | $(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 | 38 | $(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 |
| 39 | 39 | ||
| 40 | HOSTCFLAGS_relocs_32.o += -DELF_BITS=32 | ||
| 41 | HOSTCFLAGS_relocs_64.o += -DELF_BITS=64 | ||
| 42 | |||
| 43 | quiet_cmd_cp_reloc = GEN $@ | ||
| 44 | cmd_cp_reloc = cp $< $@ | ||
| 45 | |||
| 46 | $(obj)/relocs_%.c: $(srctree)/arch/x86/tools/relocs.c | ||
| 47 | $(call cmd,cp_reloc) | ||
| 48 | |||
| 40 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include | 49 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include |
| 41 | hostprogs-y += relocs | 50 | hostprogs-y += relocs_$(BITS) |
| 42 | relocs: $(obj)/relocs | 51 | relocs_binaries = relocs_$(BITS) |
| 52 | ifeq ($(CONFIG_64BIT),y) | ||
| 53 | hostprogs-y += relocs_32 | ||
| 54 | relocs_binaries += relocs_32 | ||
| 55 | endif | ||
| 56 | relocs: $(relocs_binaries) | ||
| 57 | relocs_32: $(obj)/relocs_32 | ||
| 58 | relocs_64: $(obj)/relocs_64 | ||
