diff mbox

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

Message ID CACUy__UHWuXaBtKTkhKUVtJZOPWG_1EHQ0oV_SuHkFUXJnGqqQ@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Daniel Schwierzeck Feb. 2, 2013, 5:51 p.m. UTC
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

 endif

Comments

Marek Vasut Feb. 2, 2013, 5:53 p.m. UTC | #1
Dear Daniel Schwierzeck,

> 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

UUuuuu, that's amazing. We're shifting from one kind of black magic onto another 
voodoo. But certainly, this KEEP() is much cleaner, I like it :)

Best regards,
Marek Vasut
diff mbox

Patch

--- 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