On mcore-elf, mcore_mark_dllimport generated
(gdb) call debug_tree (decl)
<function_decl 0x7fffe9941200 f1
type <function_type 0x7fffe981f000
type <void_type 0x7fffe98180a8 void VOID
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe98180a8
pointer_to_this <pointer_type 0x7fffe9818150>>
HI
size <integer_cst 0x7fffe9802738 constant 16>
unit-size <integer_cst 0x7fffe9802750 constant 2>
align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe981f000
arg-types <tree_list 0x7fffe980b988 value <void_type 0x7fffe98180a8 void>>
pointer_to_this <pointer_type 0x7fffe991b0a8>>
addressable used public external decl_5 SI /tmp/x.c:1:40 align:16 warn_if_not_align:0 context <translation_unit_decl 0x7fffe9955080 /tmp/x.c>
attributes <tree_list 0x7fffe9932708
purpose <identifier_node 0x7fffe9954000 dllimport>>
(mem:SI (mem:SI (symbol_ref:SI ("@i.__imp_f1")) [0 S4 A32]) [0 S4 A32]) chain <function_decl 0x7fffe9941300 f2>>
which caused:
(gdb) bt
file=0x2c0f1c8 "/export/gnu/import/git/sources/gcc-test/gcc/calls.cc",
line=3746, function=0x2c0f747 "expand_call")
at /export/gnu/import/git/sources/gcc-test/gcc/diagnostic.cc:1780
target=0x0, ignore=1)
at /export/gnu/import/git/sources/gcc-test/gcc/calls.cc:3746
...
(gdb) call debug_rtx (datum)
(mem:SI (symbol_ref:SI ("@i.__imp_f1")) [0 S4 A32])
(gdb)
Don't use gen_rtx_MEM in mcore_mark_dllimport to generate
(gdb) call debug_tree (fndecl)
<function_decl 0x7fffe9941200 f1
type <function_type 0x7fffe981f000
type <void_type 0x7fffe98180a8 void VOID
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe98180a8
pointer_to_this <pointer_type 0x7fffe9818150>>
HI
size <integer_cst 0x7fffe9802738 constant 16>
unit-size <integer_cst 0x7fffe9802750 constant 2>
align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe981f000
arg-types <tree_list 0x7fffe980b988 value <void_type 0x7fffe98180a8 void>>
pointer_to_this <pointer_type 0x7fffe991b0a8>>
addressable used public external decl_5 SI /tmp/x.c:1:40 align:16 warn_if_not_align:0 context <translation_unit_decl 0x7fffe9955080 /tmp/x.c>
attributes <tree_list 0x7fffe9932708
purpose <identifier_node 0x7fffe9954000 dllimport>>
(mem:SI (symbol_ref:SI ("@i.__imp_f1")) [0 S4 A32]) chain <function_decl 0x7fffe9941300 f2>>
(gdb)
instead. This fixes:
gcc.c-torture/compile/dll.c -O0 (internal compiler error: in assemble_variable, at varasm.cc:2544)
gcc.dg/visibility-12.c (internal compiler error: in expand_call, at calls.cc:3744)
for more-elf.
PR target/120589
* config/mcore/mcore.cc (mcore_mark_dllimport): Don't use
gen_rtx_MEM.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
/* ??? At least I think that's why we do this. */
idp = get_identifier (newname);
- newrtl = gen_rtx_MEM (Pmode,
- gen_rtx_SYMBOL_REF (Pmode,
- IDENTIFIER_POINTER (idp)));
+ newrtl = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (idp));
XEXP (DECL_RTL (decl), 0) = newrtl;
}