public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization
@ 2021-08-28 21:28 me at jhdtl dot ru
2021-09-07 0:01 ` [Bug target/102115] " jcmvbkbc at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: me at jhdtl dot ru @ 2021-08-28 21:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115
Bug ID: 102115
Summary: symbol address eliminated by the xtensa size
optimization
Product: gcc
Version: 12.0
URL: https://github.com/earlephilhower/newlib-xtensa/issues
/19#issuecomment-903203750
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: me at jhdtl dot ru
Target Milestone: ---
Host: x86_64-w64-mingw32
Target: xtensa-lx106-elf
Build: x86_64-linux-gnu
Created attachment 51370
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51370&action=edit
Missing symbol example
.\x86_64-w64-mingw32.xtensa-lx106-elf-1757bed.210826\xtensa-lx106-elf\bin\xtensa-lx106-elf-gcc.exe
-v
Using built-in specs.
COLLECT_GCC=C:\Users\maxim\Documents\gist\a433474aa40ab0f6433f9240455fd624\x86_64-w64-mingw32.xtensa-lx106-elf-1757bed.210826\xtensa-lx106-elf\bin\xtensa-lx106-elf-gcc.exe
COLLECT_LTO_WRAPPER=c:/users/maxim/documents/gist/a433474aa40ab0f6433f9240455fd624/x86_64-w64-mingw32.xtensa-lx106-elf-1757bed.210826/xtensa-lx106-elf/bin/../libexec/gcc/xtensa-lx106-elf/12.0.0/lto-wrapper.exe
Target: xtensa-lx106-elf
Configured with: /home/jhdtl/dev/esp-quick-toolchain/repo/gcc-gnu/configure
--prefix=/home/jhdtl/dev/esp-quick-toolchain/xtensa-lx106-elf.win64
--build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --target=xtensa-lx106-elf
--disable-shared --with-newlib --enable-threads=no --disable-__cxa_atexit
--disable-libgomp --disable-libmudflap --disable-nls --disable-multilib
--disable-bootstrap --enable-languages=c,c++ --enable-lto --enable-static=yes
--disable-libstdcxx-verbose
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210825 (experimental) (GCC)
After the 64a54505ec8249178b9767d1420354f8eb55de50, using -Os on
x86_64-w64-mingw32 *may* result in missing function symbol in the example
test.ii attached if the symbol's address can be compressed into small number
accepted by the movi + slli.
>From the URL, adding the suggested fprintf to the 'xtensa_emit_move_sequence'
and running with the following command:
$ xtensa-lx106-elf-g++.exe -Os -save-temps -mlongcalls -mtext-section-literals
-falign-functions=4 -ffunction-sections -fdata-sections -Wall
-Werror=return-type -free -fipa-pta -fno-rtti -std=gnu++17 -S -o test.S
test.cpp
Prints when the optimization happens:
[xtensa_emit_move_sequence @ function()] '513540096[0x1e9c0000]' =>
'1959[0x7a7] << 18'
[xtensa_emit_move_sequence @ function()] '513540096[0x1e9c0000]' =>
'1959[0x7a7] << 18'
[xtensa_emit_move_sequence @ function()] '513540096[0x1e9c0000]' =>
'1959[0x7a7] << 18'
Which will not be the expected function address at runtime, and will also
remove the symbol from the resulting object:
test.S:_Z8functionv:
movi a5, 0x7a7
slli a5, a5, 18
l32r a4, .LC209
l32r a2,
.LC426
mov.n a3, a5
s32i.n a5, sp, 20
call0 _Z8three132PFvPFvPFvvEES0_ES2_S0_
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/102115] symbol address eliminated by the xtensa size optimization
2021-08-28 21:28 [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization me at jhdtl dot ru
@ 2021-09-07 0:01 ` jcmvbkbc at gcc dot gnu.org
2021-09-07 22:41 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jcmvbkbc at gcc dot gnu.org @ 2021-09-07 0:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115
jcmvbkbc at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jcmvbkbc at gcc dot gnu.org
Last reconfirmed| |2021-09-07
Assignee|unassigned at gcc dot gnu.org |jcmvbkbc at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #1 from jcmvbkbc at gcc dot gnu.org ---
Thanks for the report and analysis. The following part needs a bit of
explanation:
After the 64a54505ec8249178b9767d1420354f8eb55de50, using -Os on
x86_64-w64-mingw32 *may* result in missing function symbol in the example
test.ii attached if the symbol's address can be compressed into small number
accepted by the movi + slli.
It's not about the address that corresponds to the symbol in the target code
(e.g. in the attached example the target addresses are all unknown), but about
the RTX node address that describes the symbol inside the compiler. That makes
this bug hard to reproduce.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/102115] symbol address eliminated by the xtensa size optimization
2021-08-28 21:28 [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization me at jhdtl dot ru
2021-09-07 0:01 ` [Bug target/102115] " jcmvbkbc at gcc dot gnu.org
@ 2021-09-07 22:41 ` cvs-commit at gcc dot gnu.org
2021-09-07 23:05 ` cvs-commit at gcc dot gnu.org
2021-09-07 23:07 ` jcmvbkbc at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-07 22:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Max Filippov <jcmvbkbc@gcc.gnu.org>:
https://gcc.gnu.org/g:b552c4e601c7fdc4d341e29cc1ed6081d42b00d0
commit r12-3402-gb552c4e601c7fdc4d341e29cc1ed6081d42b00d0
Author: Max Filippov <jcmvbkbc@gmail.com>
Date: Tue Sep 7 15:40:00 2021 -0700
gcc: xtensa: fix PR target/102115
2021-09-07 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
gcc/
PR target/102115
* config/xtensa/xtensa.c (xtensa_emit_move_sequence): Add
'CONST_INT_P (src)' to the condition of the block that tries to
eliminate literal when loading integer contant.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/102115] symbol address eliminated by the xtensa size optimization
2021-08-28 21:28 [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization me at jhdtl dot ru
2021-09-07 0:01 ` [Bug target/102115] " jcmvbkbc at gcc dot gnu.org
2021-09-07 22:41 ` cvs-commit at gcc dot gnu.org
@ 2021-09-07 23:05 ` cvs-commit at gcc dot gnu.org
2021-09-07 23:07 ` jcmvbkbc at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-07 23:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Max Filippov
<jcmvbkbc@gcc.gnu.org>:
https://gcc.gnu.org/g:dcb2873cd32b263643bfd9d1298b35d6cd028f0a
commit r11-8969-gdcb2873cd32b263643bfd9d1298b35d6cd028f0a
Author: Max Filippov <jcmvbkbc@gmail.com>
Date: Tue Sep 7 15:40:00 2021 -0700
gcc: xtensa: fix PR target/102115
2021-09-07 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
gcc/
PR target/102115
* config/xtensa/xtensa.c (xtensa_emit_move_sequence): Add
'CONST_INT_P (src)' to the condition of the block that tries to
eliminate literal when loading integer contant.
(cherry picked from commit b552c4e601c7fdc4d341e29cc1ed6081d42b00d0)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/102115] symbol address eliminated by the xtensa size optimization
2021-08-28 21:28 [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization me at jhdtl dot ru
` (2 preceding siblings ...)
2021-09-07 23:05 ` cvs-commit at gcc dot gnu.org
@ 2021-09-07 23:07 ` jcmvbkbc at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jcmvbkbc at gcc dot gnu.org @ 2021-09-07 23:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115
jcmvbkbc at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from jcmvbkbc at gcc dot gnu.org ---
The fix is committed to master and releases/gcc-11 branch.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-07 23:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28 21:28 [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization me at jhdtl dot ru
2021-09-07 0:01 ` [Bug target/102115] " jcmvbkbc at gcc dot gnu.org
2021-09-07 22:41 ` cvs-commit at gcc dot gnu.org
2021-09-07 23:05 ` cvs-commit at gcc dot gnu.org
2021-09-07 23:07 ` jcmvbkbc at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).