[Bug bootstrap/107728] with -O0, libgcc in the first stage compiler has reference to libc functions

2022-11-24 Thread arnout at mind dot be via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728

--- Comment #5 from Arnout Vandecappelle  ---
Based on

> glibc builds needs to be fixed such that it does not reference the function 
> in the unwinder at -O0

I've traced through the map file why this symbol is pulled in:

/.../libgcc.a(unwind-dw2.o)
  /.../libgcc.a(_umoddi3.o) (_Unwind_Resume)
/.../libgcc.a(unwind-dw2-fde-dip.o)
  /.../libgcc.a(unwind-dw2.o) (_Unwind_Find_FDE)

In other words, _umoddi3.o is the one that pulls in the unwinder.

[Bug bootstrap/107728] with -O0, libgcc in the first stage compiler has reference to libc functions

2022-11-24 Thread arnout at mind dot be via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728

Arnout Vandecappelle  changed:

   What|Removed |Added

 CC||arnout at mind dot be

--- Comment #4 from Arnout Vandecappelle  ---
This bug was already reported before at glibc:
https://sourceware.org/bugzilla/show_bug.cgi?id=29621

There it was concluded that it is due to gcc stage1 being built with
CFLAGS_FOR_TARGET="-O0". This is not something that is tested in glibc's
testing infrastructure.

It's not clear to me whether the issue needs to be solved in GCC or in glibc.

[Bug bootstrap/107728] with -O0, libgcc in the first stage compiler has reference to libc functions

2022-11-16 Thread thomas.petazzoni--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728

--- Comment #3 from Thomas Petazzoni  ---
Thanks for the super quick feedback. Could you clarify "Move over, the
functions are not optimized out at -O2 but rather they don't get pulled in
glibc building because another function is referenced." ?

For the record, we are able to work around this issue by passing -O1 in
CFLAGS_FOR_TARGET/CXXFLAGS_FOR_TARGET when building the first stage gcc.

[Bug bootstrap/107728] with -O0, libgcc in the first stage compiler has reference to libc functions

2022-11-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728

--- Comment #2 from Andrew Pinski  ---
Move over, the functions are not optimized out at -O2 but rather they don't get
pulled in glibc building because another function is referenced.

Either libgcc should be built with -fdata-sections -ffunction-sections or glibc
builds needs to be fixed such that it does not reference the function in the
unwinder at -O0.  You need to look at the linker map to figure why the object
file is being pulled into glibc at -O0 and not at -O2.
But it is still a bug in glibc's ld.so really.

[Bug bootstrap/107728] with -O0, libgcc in the first stage compiler has reference to libc functions

2022-11-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |MOVED
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Andrew Pinski  ---
This is not a GCC issue as __register_frame_table is declared as extern.
This is almost definitely a glibc issue really.
But I doubt glibc can be compiled at -O0 because of these issues.