Am 01.03.2010 09:00, schrieb Bao, Zheng:
What I keep trying to make everyone understand is not what the rules we should use to decide the stack size. What I worry is the bug in the crosstool will make the rule do the wrong thing, even if the rule is perfect. So far, no one seems to support me that there is a bug in the toolchain. I admit it seems ridiculous But the it is quite clear.
I looked a bit into it. According to the binutils documentation, expressions (which always lead to addresses) are either relative or absolute. They're relative when inside some section, absolute otherwise.
But most importantly, ld does not know about boolean values!
What I could think of (and validate with some tests) is that ld really messes up boolean operations within sections. I didn't find anything conclusive yet, but it could be that boolean operations, even intermediate values are "relative", and then evaluated to absolute addresses - in which case both "true" and "false" are (very likely) non-null values. I'm also not sure if that's the intended behaviour by the binutils developers, but it's probably fragile as the logical operations are also used for address manipulations. I guess for clarification this should be asked on the binutils mailing list.
Solution to that: Move operations on non-addresses and non-sizes out of sections (which you did in your patch)
However, this does not fix the bug in our stack size calculation. I'm not quite sure if the patch does the right thing, but it should be close.
Signed-off-by: Patrick Georgi patrick.georgi@coresystems.de