diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2025-06-08 14:23:09 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2025-06-13 09:26:04 +0800 |
commit | 11059b4a4e8d4a19e7b554817f7cf0f68e3d54bb (patch) | |
tree | 5d9a31185fd12acde953fed70c1fbb54a8fa65da | |
parent | 1c50fbfee5a18b1dab066b0962f8e66272bab77c (diff) | |
download | gcc-11059b4a4e8d4a19e7b554817f7cf0f68e3d54bb.zip gcc-11059b4a4e8d4a19e7b554817f7cf0f68e3d54bb.tar.gz gcc-11059b4a4e8d4a19e7b554817f7cf0f68e3d54bb.tar.bz2 |
mcore: Don't use gen_rtx_MEM on __attribute__((dllimport))
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>
-rw-r--r-- | gcc/config/mcore/mcore.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc index cd5f2c5..c4fc145 100644 --- a/gcc/config/mcore/mcore.cc +++ b/gcc/config/mcore/mcore.cc @@ -2984,9 +2984,7 @@ mcore_mark_dllimport (tree decl) /* ??? 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; } |