util: add rmodtool for parsing ELF files to rmodules
The current implementation of creating rmodules relies on invoking the linker in a certain manner with the relocations overlaid on the BSS section. It's not really surprising that the linker doesn't always behave the way one wants depending on the linker used and the architecture. Instead, introduce rmodtool which takes an ELF file as an input, parses it, and creates a new ELF file in the format the rmodule loader expects. Change-Id: I31ac2d327d450ef841c3a7d9740b787278382bef Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/5378 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
committed by
Aaron Durbin
parent
36be8135d7
commit
4fde5a66b4
@@ -17,10 +17,16 @@ cbfsobj += LzmaEnc.o
|
||||
cbfsobj += linux_trampoline.o
|
||||
cbfsobj += cbfs-payload-linux.o
|
||||
|
||||
CBFSTOOLFLAGS= -g
|
||||
rmodobj += rmodtool.o
|
||||
rmodobj += rmodule.o
|
||||
rmodobj += common.o
|
||||
rmodobj += elfheaders.o
|
||||
rmodobj += xdr.o
|
||||
|
||||
TOOLFLAGS= -g
|
||||
|
||||
ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32)
|
||||
CBFSTOOLFLAGS+=-mno-ms-bitfields
|
||||
TOOLFLAGS+=-mno-ms-bitfields
|
||||
endif
|
||||
|
||||
$(objutil)/cbfstool:
|
||||
@@ -28,17 +34,21 @@ $(objutil)/cbfstool:
|
||||
|
||||
$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c
|
||||
printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
|
||||
$(HOSTCC) $(CBFSTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
$(HOSTCC) $(TOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
|
||||
$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.c
|
||||
printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
|
||||
$(HOSTCC) $(CBFSTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
$(HOSTCC) $(TOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
|
||||
$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c
|
||||
printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
|
||||
$(HOSTCC) $(CBFSTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
$(HOSTCC) $(TOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
|
||||
|
||||
$(objutil)/cbfstool/cbfstool: $(objutil)/cbfstool $(addprefix $(objutil)/cbfstool/,$(cbfsobj))
|
||||
printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
|
||||
$(HOSTCC) $(CBFSTOOLFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj))
|
||||
$(HOSTCC) $(TOOLFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj))
|
||||
|
||||
$(objutil)/cbfstool/rmodtool: $(objutil)/cbfstool $(addprefix $(objutil)/cbfstool/,$(rmodobj))
|
||||
printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
|
||||
$(HOSTCC) $(TOOLFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj))
|
||||
|
||||
|
Reference in New Issue
Block a user