This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: target-specific way to make ld -N the default
- From: Joel Sherrill <joel dot sherrill at OARcorp dot com>
- To: Doug Evans <dje at transmeta dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 25 Sep 2002 18:20:56 -0500
- Subject: Re: target-specific way to make ld -N the default
- Organization: OAR Corporation
- References: <200209252215.PAA12032@casey.transmeta.com>
Doug Evans wrote:
>
> Is there already an approved way for making ld -N the default
> for a particular target?
> The default behaviour for the linker is to create demand paged
> executables. This has subtle hits to embedded toolchains (which
> was a constant source of customer problem reports at Cygnus IIRC).
I ran into this on hppa1.1-rtems (elf) and would like to use the
same solution. It prevented autoconf from being able to link
it's simple programs.
> I don't recall seeing an option that is the opposite of -N
> so in a multi-targeted ld changing the default would be problematic
> when using it for other targets (should such a day come).
> But for embedded systems, the current behaviour is more than
> a little annoying! Am I missing something?
>
> ---
> btw, this seems to be a bug. It sure gave me some grief while
> trying to understand "Not enough room for program headers".
> In embedded systems work one generally doesn't want the program headers
> being part of the first (or any) segment and thus shouldn't have to deal
> with "Not enough room for program headers" at all. [Really. News at 11. :-)]
>
> sources = current cvs
> target = i386-linux, but any elf toolchain will do (especially embedded)
>
> --- foo.S: ---
> .section ".sec1", "ax"
> foo1:
> .space 4096
>
> .section ".sec2", "aw"
> foo2:
> .space 4096
>
> --- foo.ld ---
> start = 30;
>
> SECTIONS
> {
> .sec1 : AT (start + 0) { *(.sec1) }
> .sec2 : AT (start + 4096) { *(.sec1) }
> }
>
> --- bar.ld ---
> start = 40;
>
> SECTIONS
> {
> .sec1 : AT (start + 0) { *(.sec1) }
> .sec2 : AT (start + 4096) { *(.sec1) }
> }
>
> bash$ gcc -c foo.S
> bash$ gcc -nostdlib -Tfoo.ld foo.o
> bash$ gcc -nostdlib -Tbar.ld foo.o
> /usr/bin/ld: a.out: Not enough room for program headers, try linking with -N
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
>
> I understand why there's difference. It's this line in
> elf.c:map_sections_to_segments:
>
> || sections[0]->lma < phdr_size
>
> phdr_size = 32
>
> But methinks this test is either a hack (which therefore needs an explanation)
> or needs to be rewritten/removed. Why is it there?
> Am I missing something?
--
Joel Sherrill, Ph.D. Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985