bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU ld bug


From: andrew . barber
Subject: GNU ld bug
Date: Wed, 20 Dec 2000 17:16:07 -0500 (EST)

GNU ld 2.10
Copyright 2000 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
  Supported emulations:
   elf32_sparc
   elf64_sparc


The documentation thus states:
> For example,
> .text . : { *(.text) }
>
> and
> .text : { *(.text) }
>
> are subtly different.  The first will set the address of the `.text'
> output section to the current value of the location counter.  The
> second will set it to the current value of the location counter aligned
> to the strictest alignment of a `.text' input section.


But in my example where
>       . = 0x1000;
>       user_text_0 .  :  { *(.user_text_0) }
>       . = 0x7000;
>       user_text_1 : { *(.user_text_1) }

Both user_text_0 and user_text_1 have alignments of 0x2000 and are
0x2008 bytes long. Also of interest,

> OUTPUT_FORMAT("elf64-sparc")
> OUTPUT_ARCH(sparc:v9a)



I get this from the linker
>user_text_0
>                0x0000000000001000     0x3008
> *(.user_text_0)
> *fill*         0x0000000000001000 0x100081010100
> user_text_0
>                0x0000000000002000     0x2008 converted.o
>                0x0000000000007000                .=0x7000
>
>user_text_1
>                0x0000000000008000     0x2008
> *(.user_text_1)
> user_text_1
>                0x0000000000008000     0x2008 converted.o


It was my understanding that the linker should have ignored the
alignment field for the input section in the case of user_text_0.
Instead, as you can see, it started the new output section at the
correct address but padded it up to the alignment and then inserted my
section.  Instead, I was expecting that my input section be copied into
the address range 0x1000-0x3008 without leading padding.

If this is not a bug, perhaps the behaviour should be described more
clearly in the documentation.

Interestingly enough, it seems that Sun's linker always ignores the
alignment field.

Thanks,
-- 
Andy Barber 
Sun Microelectronics - Chelmsford, MA
address@hidden
781-442-0726




reply via email to

[Prev in Thread] Current Thread [Next in Thread]