public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Question about ld script file behaviour
@ 2010-09-17 10:59 Matthew Gretton-Dann
  2010-09-17 11:38 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Gretton-Dann @ 2010-09-17 10:59 UTC (permalink / raw)
  To: binutils

All,

The following patch causes the ld-arm/script-type test to fail (target
any arm*-*-*):
    http://sourceware.org/ml/binutils/2010-08/msg00169.html

The test case defines some symbols in an object and then in a linker
script causes other symbols to be defined based upon those symbols:

SECTIONS {
  foo_a = bar_a;
  foo_t = bar_t;
  foo_o = bar_o;
  .text : { *(.text) }
  .ARM.attribues 0 : { *(.ARM.attributes) }
}

The currently expected output is:

Symbol table '.symtab' contains 13 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 SECTION LOCAL  DEFAULT    1 
     2: 00000000     0 SECTION LOCAL  DEFAULT    2 
     3: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 \$a
     4: 00000010     0 NOTYPE  LOCAL  DEFAULT    1 \$d
     5: 00000014     0 NOTYPE  LOCAL  DEFAULT    1 \$a
     6: 00000020     0 NOTYPE  LOCAL  DEFAULT    1 \$t
     7: 00000010     0 OBJECT  GLOBAL DEFAULT    1 bar_o
     8: 00000021     0 FUNC    GLOBAL DEFAULT    1 bar_t
     9: 00000000     0 FUNC    GLOBAL DEFAULT    1 foo_a
    10: 00000021     0 FUNC    GLOBAL DEFAULT    1 foo_t
    11: 00000010     0 OBJECT  GLOBAL DEFAULT    1 foo_o
    12: 00000000     0 FUNC    GLOBAL DEFAULT    1 bar_a

Following the above change foo_a, foo_t, and foo_o are now absolute
symbols so the appropriate rows of the symbol table look like this:

     9: 00000000     0 FUNC    GLOBAL DEFAULT  ABS foo_a
    10: 00000021     0 FUNC    GLOBAL DEFAULT  ABS foo_t
    11: 00000010     0 OBJECT  GLOBAL DEFAULT  ABS foo_o

From following the email thread associated with the above patch I
believe the change is valid, but don't understand linker scripts well
enough to be 100% sure.

So can someone who understands linker scripting please confirm the
change in output is expected and valid?

Thanks,

Matt


-- 
Matthew Gretton-Dann
Principal Engineer - PDSW Tools
ARM Ltd

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about ld script file behaviour
  2010-09-17 10:59 Question about ld script file behaviour Matthew Gretton-Dann
@ 2010-09-17 11:38 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2010-09-17 11:38 UTC (permalink / raw)
  To: Matthew Gretton-Dann; +Cc: binutils

On Fri, Sep 17, 2010 at 11:59:18AM +0100, Matthew Gretton-Dann wrote:
> The following patch causes the ld-arm/script-type test to fail (target
> any arm*-*-*):
>     http://sourceware.org/ml/binutils/2010-08/msg00169.html
> 
> The test case defines some symbols in an object and then in a linker
> script causes other symbols to be defined based upon those symbols:
> 
> SECTIONS {
>   foo_a = bar_a;
>   foo_t = bar_t;
>   foo_o = bar_o;
>   .text : { *(.text) }
>   .ARM.attribues 0 : { *(.ARM.attributes) }
> }
[snip]
> Following the above change foo_a, foo_t, and foo_o are now absolute
[snip]

Yes, that was a deliberate change, and the new values look correct to
me.  Assignments like the above will keep the original section if you
put them inside one of the output section statements.  eg.

SECTIONS {
  .text : {
    foo_a = bar_a;
    foo_t = bar_t;
    foo_o = bar_o;
    *(.text)
   }
  .ARM.attribues 0 : { *(.ARM.attributes) }
}

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-17 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-17 10:59 Question about ld script file behaviour Matthew Gretton-Dann
2010-09-17 11:38 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).