bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/18963] Addition is not commutative


From: amodra at gmail dot com
Subject: [Bug ld/18963] Addition is not commutative
Date: Wed, 16 Sep 2015 23:54:42 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18963

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amodra at gmail dot com

--- Comment #3 from Alan Modra <amodra at gmail dot com> ---
Yes, Nick has it right, that code in new_rel_from_abs is the trigger for this
failure.  But note that the truly bogus code is in fold_binary as described by
this comment:
          /* Arithmetic operators, bitwise AND, bitwise OR and XOR
             keep the section of one of their operands only when the
             other operand is a plain number.  Losing the section when
             operating on two symbols, ie. a result of a plain number,
             is required for subtraction and XOR.  It's justifiable
             for the other operations on the grounds that adding,
             multiplying etc. two section relative values does not
             really make sense unless they are just treated as
             numbers.
             The same argument could be made for many expressions
             involving one symbol and a number.  For example,
             "1 << x" and "100 / x" probably should not be given the
             section of x.  The trouble is that if we fuss about such
             things the rules become complex and it is onerous to
             document ld expression evaluation.  */

Fixing fold_binary is probably too risky in terms of destabilising people's odd
little linker scripts. 

The new_rel_from_abs change came in here:
https://sourceware.org/ml/binutils/2012-06/msg00155.html  It would be a shame
to lose the overall functionality of that change.  Absolute symbols a really
not handled well in other parts of the toolchain.  For example, glibc ld.so on
many targets doesn't treat them as absolute..
So I think that besides Nick's patch we also need another pass over linker
script symbols, to give them a section relative value.  If nothing else, this
is going to be less work than all the ld testsuite updates needed with Nick's
current patch.

-- 
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]