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: [email protected]
ReportedBy: [email protected]
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.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils