[Bug lto/122507] undefined reference using inline assembly with LTO
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Nov 1 07:34:09 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122507
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to LIU Hao from comment #7)
> (In reply to Andrew Pinski from comment #2)
> > Yes
> > ```
> > __asm__(
> > ".text \n"
> > ".def my_add; .scl 3; .type 32; .endef \n"
> > //".globl my_add \n" ////////////////////////
> > "my_add: \n"
> > " lea eax, [rcx + rdx] \n"
> > " ret \n"
> > ::":"(my_add)
> > );
> > ```
> > But that is currently not implemented with LTO.
>
> Even without LTO this effects a warning:
> (https://gcc.godbolt.org/z/9TaWrMhqT)
>
> ```
> <source>:3:12: warning: 'my_add' used but never defined
> 3 | static int my_add(int x, int y);
> | ^~~~~~
> ```'
That is Pr 122458
More information about the Gcc-bugs
mailing list