xen/libfdt: Put all libfdt in init
authorJulien Grall <julien.grall@arm.com>
Mon, 2 Jul 2018 16:19:09 +0000 (17:19 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 11 Jul 2018 19:22:17 +0000 (12:22 -0700)
Libfdt is used for:
    - Unflatten the Flatten Device-Tree (FDT) blob
    - Create Device-Tree for the Hardware-Domain

Both use are done during the initialization of Xen. So move all the
libfdt to init.

Note that the runes was borrowed from libelf Makefile.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/libfdt/Makefile

index 7578fe9c50c82c7c2877cc93febb3fdd7dcdc57d..d81f54b6b8e19f21cd36e645ca95a8f936707f6f 100644 (file)
@@ -1,5 +1,13 @@
 include Makefile.libfdt
 
-obj-y += $(LIBFDT_OBJS)
+SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
+
+obj-y += libfdt.o
 
 CFLAGS += -I$(BASEDIR)/include/xen/libfdt/
+
+libfdt.o: libfdt-temp.o Makefile
+       $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+
+libfdt-temp.o: $(LIBFDT_OBJS)
+       $(LD) $(LDFLAGS) -r -o $@ $^