bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/3163] New: Provide example of assignment to a symbol within a se


From: david dot cook at st dot com
Subject: [Bug ld/3163] New: Provide example of assignment to a symbol within a section in linker scripts
Date: 31 Aug 2006 18:44:59 -0000

It should be made clear by use of an example that assignment of an absolute
expression to a symbol within an output section description will result in the
symbol having the value ADDR(section) + (value of absolute expression) rather
than just the value.

This is the intended behaviour as noted by the response to this bug:
http://sourceware.org/bugzilla/show_bug.cgi?id=458.

Section 3.5.1 (Simple Assignments) would seem a good place to clarify this.  I
suggest changing the example from:
"     floating_point = 0;
     SECTIONS
     {
       .text :
         {
           *(.text)
           _etext = .;
         }
       _bdata = (. + 3) & ~ 3;
       .data : { *(.data) }
     }
   In this example, the symbol `floating_point' will be defined as
zero.  The symbol `_etext' will be defined as the address following the
last `.text' input section.  The symbol `_bdata' will be defined as the
address following the `.text' output section aligned upward to a 4 byte
boundary."

to:
"     floating_point = 0;
     SECTIONS
     {
       .text 0x50 :
         {
           _small_offset = 4;
           *(.text)
           _etext = .;
         }
       _absolute_value = 8;
       _bdata = (. + 3) & ~ 3;
       .data : { *(.data) }
     }
   In this example, the symbol `floating_point' will be defined as zero.  The
symbol '_small_offset' will be defined as 0x54 since it is relative to the start
of the '.text' output section.  The symbol `_etext' will be defined as the
address following the last `.text' input section.  The symbol '_absolute_value'
will be defined as 8.  The symbol `_bdata' will be defined as the address
following the `.text' output section aligned upward to a 4 byte boundary."

A change of this sort should prevent confusion/invalid bug reports.

-- 
           Summary: Provide example of assignment to a symbol within a
                    section in linker scripts
           Product: binutils
           Version: 2.17
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: david dot cook at st dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=3163

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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