-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suspected defect in TLS linker optimizations #1633
Comments
The source code uses |
This is just a example, but in this instance, I want to calculate: |
@ShayAviv
Starting with binutils 2.30 (more specifically commit Quoting part of the ChangeLog for that commit:
I'm not particularly familiar with the inner workings of the linker and also why this changed, but looks like in this case the linker replaces There may be a different way to accomplish what you need, but I'm not aware of it. |
What happens here looks exactly like what the comment says, except that the |
To add on what @segher said, the following linker TLS optimization would have made perfect sense, becuase it preserves the result: addis r3,r13,0
addi r3,r3,-28672 replaced with: nop
addi r3,r13,-28672 but I argue that in my case, this transformation does not apply. Instead, it should have been something like this: nop
addi r3,r4,-28672 |
You're correct, this is a defect. The linker warns, but it should disable the optimization. |
Fixed in FSF binutils with git commit 252dcdf432c6. |
@amodra Do you know if it's planned to backport the fix to the following binutils branches?
|
I've pushed the fix to 2.34 and 2.35. 2.31 is no longer an active branch (strictly speaking, neither is 2.34). |
@amodra thanks This means the fix will be available in the AT 13.0-3 and AT 14.0-1. |
My team has recently upgraded to AT12.0, and we've noticed a linker behavior which changes our register operands.
For example, this C code:
produces the following binary on AT7.0 (disassembled):
but produces a different binary on AT12.0 (disassembled, see in Compiler Explorer):
Note the change in the second operand of the
addi
instruction (r3
vs.r13
).We saw the different TLS code sequences that may be optimized by the linker in the following link: http://openpowerfoundation.org/wp-content/uploads/resources/leabi/content/dbdoclet.50655241_61284.html
However, our code sequence does not seem to fall under any of the mentioned cases.
Is it intentional? Can this behavior be locally disabled?
The text was updated successfully, but these errors were encountered: