[Xen-devel,6/7] xen/libfdt: Put all libfdt in init

Message ID 20180605171237.30601-7-julien.grall@arm.com
State New
Headers show
Series
  • xen/arm: Shrink down Xen on Arm
Related show

Commit Message

Julien Grall June 5, 2018, 5:12 p.m.
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>
---
 xen/common/libfdt/Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Stefano Stabellini June 12, 2018, 7:37 p.m. | #1
On Tue, 5 Jun 2018, Julien Grall wrote:
> 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 | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile
> index 7578fe9c50..d81f54b6b8 100644
> --- a/xen/common/libfdt/Makefile
> +++ b/xen/common/libfdt/Makefile
> @@ -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 $@ $^
> -- 
> 2.11.0
>

Patch

diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile
index 7578fe9c50..d81f54b6b8 100644
--- a/xen/common/libfdt/Makefile
+++ b/xen/common/libfdt/Makefile
@@ -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 $@ $^