sym->sy_value is not valid for struct local_symbol

Message ID 20190506065233.GN3195@bubble.grove.modra.org
State New
Headers show
Series
  • sym->sy_value is not valid for struct local_symbol
Related show

Commit Message

Alan Modra May 6, 2019, 6:52 a.m.
Fixes this mep-elf error:
gas/elf/dwarf2-19.s: Error: Unknown expression operator (enum 0)
gas/elf/dwarf2-19.s: Error: cannot convert expression symbol .L2 to complex relocation

Doesn't fix the test itself from failing though.  Alex, your latest
patch resulted in:
mep-elf  +FAIL: DWARF2 18
mep-elf  +FAIL: DWARF2 19

	* symbols.c (symbol_relc_make_sym): Do not access sym->sy_value
	directly.


-- 
Alan Modra
Australia Development Lab, IBM

Comments

Alexandre Oliva May 6, 2019, 7:29 a.m. | #1
On May  6, 2019, Alan Modra <amodra@gmail.com> wrote:

> Alex, your latest patch resulted in:

> mep-elf  +FAIL: DWARF2 18

> mep-elf  +FAIL: DWARF2 19


Thanks, I'll have a look.

-- 
Alexandre Oliva, freedom fighter  he/him   https://FSFLA.org/blogs/lxo
Be the change, be Free!                 FSF Latin America board member
GNU Toolchain Engineer                        Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás - Che GNUevara
Alexandre Oliva May 6, 2019, 10:48 a.m. | #2
On May  6, 2019, Alan Modra <amodra@gmail.com> wrote:

> mep-elf  +FAIL: DWARF2 18

> mep-elf  +FAIL: DWARF2 19


The problem is that the location views are being turned into complex
relocations rather than simplified to constants.  Ugh.

Any suggestion of how to arrange for location view expressions to be
recognized in use_complex_relocs_for so as to return zero for them?
Perhaps we could use a separate section or frag or something for them
that could be immediately identified, instead of attempting to match the
structure of the expression to the expected patterns?

-- 
Alexandre Oliva, freedom fighter  he/him   https://FSFLA.org/blogs/lxo
Be the change, be Free!                 FSF Latin America board member
GNU Toolchain Engineer                        Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás - Che GNUevara
Alan Modra May 6, 2019, 11:31 a.m. | #3
On Mon, May 06, 2019 at 07:48:10AM -0300, Alexandre Oliva wrote:
> On May  6, 2019, Alan Modra <amodra@gmail.com> wrote:

> 

> > mep-elf  +FAIL: DWARF2 18

> > mep-elf  +FAIL: DWARF2 19

> 

> The problem is that the location views are being turned into complex

> relocations rather than simplified to constants.  Ugh.


I'd be inclined to just xfail the tests, with a comment in the .d
file saying why.

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/gas/symbols.c b/gas/symbols.c
index 97867954fd..10d7b1c273 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -3288,7 +3288,7 @@  symbol_relc_make_sym (symbolS * sym)
      is defined as an expression or a plain value.  */
   if (   S_GET_SEGMENT (sym) == expr_section
       || S_GET_SEGMENT (sym) == absolute_section)
-    return symbol_relc_make_expr (& sym->sy_value);
+    return symbol_relc_make_expr (symbol_get_value_expression (sym));
 
   /* This may be a "fake symbol", referring to ".".
      Write out a special null symbol to refer to this position.  */