resolve_symbol_value vs. .loc view resolution
authorAlan Modra <amodra@gmail.com>
Wed, 24 Apr 2019 01:56:51 +0000 (11:26 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 24 Apr 2019 13:30:17 +0000 (23:00 +0930)
commit1903f1385bff910861942743860d8577423bcb6c
tree64da109ffb42c711b2c37b4dc24f37ccbe19c876
parenta679f24ecc00ff7df02c5e6e4804fc9f19cbe595
resolve_symbol_value vs. .loc view resolution

In most cases we don't want expression symbols, such as that created
for an expression like "symbol + (1f - .)", resolved down to a
constant.  Instead we'd like to leave the expression as "symbol +
constant" once the "1f - ." part has been resolved, and let the
backend decide whether "symbol" can be reduced further.

However, that doesn't work when trying to resolve .loc view symbols
early.  We get expression symbols left as an O_symbol expression
pointing at an absolute symbol, and marked as sy_flags.sy_resolved.
That wouldn't really be a problem, but when one of those expression
symbols is used in further .loc view expressions, its value is taken
as zero.

This patch fixes the symbol value mistake, and stops creation of
O_symbol expression symbols pointing to absolute symbols.  Either of
these fixes would cure the .loc view usage.

PR 24444
* symbols.c (resolve_symbol_value): When handling symbols
marked as sy_flags.resolved, return correct value for the
case of expression symbols left as an O_symbol expression.
Merge O_symbol code handling undefined and common symbols with
code handling special cases of expression symbols.  Use
seg_left to test for undefined and common symbols.  Don't
leave an O_symbol expression when X_add_symbol resolves to
the absolute_section.  Init final_val later.
* testsuite/gas/mmix/basep-7.d: Adjust expected output.
gas/ChangeLog
gas/symbols.c
gas/testsuite/gas/mmix/basep-7.d
This page took 0.039214 seconds and 4 git commands to generate.