[U-Boot] [PATCH v1] Refactor linker-generated arrays

Daniel Schwierzeck
2013-02-02T17:51:38Z

Hi Albert,

2013/2/2 Albert ARIBAUD <albert.u.boot@aribaud.net>:
> Refactor linker-generated array code so that symbols
> which were previously linker-generated are now compiler-
> generated. This causes relocation records of type
> R_ARM_ABS32 to become R_ARM_RELATIVE, which makes
> code which uses LGA able to run before relocation as
> well as after.
>
> Note: this affects more than ARM targets, as linker-
> lists span possibly all target architectures, notably
> PowerPC.
>
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---

for the MIPS part:
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

BTW: if we use

.u_boot_list : {
KEEP(*(SORT(.u_boot_list*)))
}

we can get rid of the undef magic in the final link of u-boot

--- a/Makefile
+++ b/Makefile
@@ -559,10 +559,8 @@ GEN_UBOOT = \
$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
else
GEN_UBOOT = \
- UNDEF_LST=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
- sed -n -e
's/.*\($(SYM_PREFIX)_u_boot_list_.*\)/-u\1/p'|sort|uniq`;\
cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
- $$UNDEF_LST $(__OBJS) \
+ $(__OBJS) \
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
-Map u-boot.map -o u-boot
endif

--
Best regards,
Daniel