https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123220

            Bug ID: 123220
           Summary: Cannot build support libraries (e.g. libstdc++) with
                    stack protection
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ossman at cendio dot se
  Target Milestone: ---

We want to have stack protection everywhere, including libraries provided by
gcc. Unfortunately, this doesn't seem to be possible because of a circular
dependency on libssp.

We tried to achieve this by doing:

> CFLAGS_FOR_TARGET=-fstack-protector-strong
> CXXFLAGS_FOR_TARGET=-fstack-protector-strong
> LDFLAGS_FOR_TARGET=-fstack-protector-strong

This fails the build, because libssp isn't available yet:

> configure:4261: 
> /opt/docker-cenbuild/cenbuild/repo/rpmbuild/BUILD/gcc-15.2.0/build/./gcc/xgcc 
> -B/opt/docker-cenbuild/cenbuild/repo/rpmbuild/BUILD/gcc-15.2.0/build/./gcc/ 
> -L/usr/x86_64-w64-mingw32/lib -L/usr/mingw/lib -isystem 
> /usr/x86_64-w64-mingw32/include -isystem /usr/mingw/include 
> -B/usr/x86_64-w64-mingw32/bin/ -B/usr/x86_64-w64-mingw32/lib/ -isystem 
> /usr/x86_64-w64-mingw32/include -isystem /usr/x86_64-w64-mingw32/sys-include  
>   -o conftest -O2 -g -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 
> -Wp,-D_GLIBCXX_ASSERTIONS -fstack-clash-protection -fstack-protector-strong  
> -g  -fstack-protector-strong conftest.c  >&5
> /usr/x86_64-w64-mingw32/bin/ld: cannot find -lssp_nonshared: No such file or 
> directory
> /usr/x86_64-w64-mingw32/bin/ld: cannot find -lssp: No such file or directory
> collect2: error: ld returned 1 exit status

This is from the configure stage of libstdc++.

Reply via email to