bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/14973] New: Documentation: Simple-Assignments.html : Alignment (


From: jens at plustv dot dk
Subject: [Bug ld/14973] New: Documentation: Simple-Assignments.html : Alignment (Easy fix)
Date: Tue, 18 Dec 2012 11:59:09 +0000

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

             Bug #: 14973
           Summary: Documentation: Simple-Assignments.html : Alignment
                    (Easy fix)
           Product: binutils
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified


In the file binutils/docs-2.23.1/ld/Simple-Assignments.html, there is an
example on how to assign values to symbols.

The file is located at this address online:
http://sourceware.org/binutils/docs-2.23.1/ld/Simple-Assignments.html

The example looks as follows:


     floating_point = 0;
     SECTIONS
     {
       .text :
         {
           *(.text)
           _etext = .;
         }
       _bdata = (. + 3) & ~ 3;
       .data : { *(.data) }
     }

The description below the example says:
"The symbol `_bdata' will be defined as the address following the `.text'
output section aligned upward to a 4 byte boundary."

Thus the line...
       _bdata = (. + 3) & ~ 3;
...will produce an incorrect AND mask and is incorrect. It should read:

       _bdata = (. + 3) & ~4;

This is because -3 = 0b1111 1111 1111 1101 and -4 = 0b1111 1111 1111 1100

If the reader just copies the line, he/she will get periodic bugs, depending on
the code and some luck.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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