From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BBEC13858D29; Sat, 28 Aug 2021 21:28:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBEC13858D29 From: "me at jhdtl dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/102115] New: symbol address eliminated by the xtensa size optimization Date: Sat, 28 Aug 2021 21:28:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: me at jhdtl dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_file_loc bug_status bug_severity priority component assigned_to reporter target_milestone cf_gcchost cf_gcctarget cf_gccbuild attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2021 21:28:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102115 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=3D51370&action=3Dedit Missing symbol example .\x86_64-w64-mingw32.xtensa-lx106-elf-1757bed.210826\xtensa-lx106-elf\bin\x= tensa-lx106-elf-gcc.exe -v Using built-in specs. COLLECT_GCC=3DC:\Users\maxim\Documents\gist\a433474aa40ab0f6433f9240455fd62= 4\x86_64-w64-mingw32.xtensa-lx106-elf-1757bed.210826\xtensa-lx106-elf\bin\x= tensa-lx106-elf-gcc.exe COLLECT_LTO_WRAPPER=3Dc:/users/maxim/documents/gist/a433474aa40ab0f6433f924= 0455fd624/x86_64-w64-mingw32.xtensa-lx106-elf-1757bed.210826/xtensa-lx106-e= lf/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=3D/home/jhdtl/dev/esp-quick-toolchain/xtensa-lx106-elf.win64 --build=3Dx86_64-linux-gnu --host=3Dx86_64-w64-mingw32 --target=3Dxtensa-lx= 106-elf --disable-shared --with-newlib --enable-threads=3Dno --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --disable-nls --disable-multilib --disable-bootstrap --enable-languages=3Dc,c++ --enable-lto --enable-static= =3Dyes --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_sequenc= e' and running with the following command: $ xtensa-lx106-elf-g++.exe -Os -save-temps -mlongcalls -mtext-section-liter= als -falign-functions=3D4 -ffunction-sections -fdata-sections -Wall -Werror=3Dreturn-type -free -fipa-pta -fno-rtti -std=3Dgnu++17 -S -o test.S test.cpp Prints when the optimization happens: [xtensa_emit_move_sequence @ function()] '513540096[0x1e9c0000]' =3D> '1959[0x7a7] << 18' [xtensa_emit_move_sequence @ function()] '513540096[0x1e9c0000]' =3D> '1959[0x7a7] << 18' [xtensa_emit_move_sequence @ function()] '513540096[0x1e9c0000]' =3D> '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:=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 movi a5, 0x7a7=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 slli a5, a5, 18=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 l32r a4, .LC209=20=20= =20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 l32r a2, .LC426=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 mov.n a3, a5=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 s32i.n a5, sp, 20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 call0 _Z8three132PFvPFvPFvvEES0_ES2_S0_=