Subject: Re: link_set_... sections and objcopy
To: Jason Thorpe <thorpej@wasabisystems.com>
From: Martin Husemann <martin@NetBSD.org>
List: port-arm
Date: 06/19/2004 14:56:59
On Tue, Apr 27, 2004 at 01:42:26PM -0700, Jason Thorpe wrote:
> 
> Yes.  Because explicitly listing the link sets in the linker script 
> defeats the purpose of them.  Any arbitrary code can define additional 
> link sets, which would then have to be listed here in the linker 
> script.

Since we have to live with objcopy lossage for now, how about dynamically
generating the ldscript?

The below simple script outputs the dynamic part from the kernel objects,
someone with awk knowledge could easily redo that and output the whole 
ldscript.

Martin

#! /bin/sh

SETS=`objdump -x *.o | fgrep "RELOCATION RECORDS FOR [link_set" | \
        sort -u | sed 's/^.*\[\(.*\)\]:$/\1/'`

for s in $SETS; do
        printf "  . = ALIGN(4);\n"
        printf "  PROVIDE (__start_%s = .);\n" $s
        printf "  *(%s)\n" $s
        printf "  PROVIDE (__stop_%s = .);\n" $s
done