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

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).