[U-Boot] [PATCH 1/2] RFC: create u-boot-common.lds

Graeme Russ graeme.russ at gmail.com
Mon Feb 6 04:43:33 CET 2012


Hi Mike,

On Mon, Feb 6, 2012 at 2:24 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Sunday 05 February 2012 17:07:41 Graeme Russ wrote:
>> On Mon, Feb 6, 2012 at 8:01 AM, Mike Frysinger wrote:
>> > On Saturday 04 February 2012 22:02:45 Troy Kisky wrote:
>> >> --- /dev/null
>> >> +++ b/u-boot-common.lds
>> >>
>> >> +     . = ALIGN(4);
>> >> +     __u_boot_cmd_start = .;
>> >> +     .u_boot_cmd : {
>> >> +             KEEP(*(.u_boot_cmd))
>> >> +     }
>> >> +     __u_boot_cmd_end = .;
>> >
>> > rather than storing this in the top level dir, i'd suggest going the
>> > linux route and add a include/asm-generic/u-boot.lds.h header.  then we
>> > can migrate
>>
>> Except it's not a 'header' :)
>
> what Troy has posted isn't a header, but what i'm suggesting is.  Linux's
> vmlinux.lds.h does things like:
>        #define DISCARDS \
>                /DISCARDS/ : { \
>                EXIT_TEXT \
>                *(.discard) \
>                }
>
> and then the arch linker scripts just use:
>        DISCARDS

Ah, I see. So we could have

#define LDS_U_BOOT_CMD \
	__u_boot_cmd_start = .; \
	.u_boot_cmd : { \
		KEEP(*(.u_boot_cmd)) \
	} \
	__u_boot_cmd_end = .;

And each arch linker script would just have

	. = ALIGN(4);
	LDS_U_BOOT_CMD

Or some such


>> > people over time and piece by piece without having to worry about
>> > breaking everyone at once ...
>>
>> Here we go again ;) - Queue the 'what incentive will maintainers have to
>> migrate to the common case' discussion...
>
> it isn't just that.  i don't think a single u-boot.lds for every arch is
> feasible.  the kernel method allows all the common pieces to be in a common
> header, and then the arches to expand the specific pieces in the specific order.

I can't say I'm a fan of the 'common bits' approach - It really does reduce
the readability of the linker script IMHO. It took me long enough to deal
with the fact that the lds file is pre-processed for TEXT_BASE ;)

Regards,

Graeme


More information about the U-Boot mailing list