[uclibc-ng-devel] utils and enabled UCLIBC_BUILD_SSP
diff mbox series

Message ID CAPmKWpEWBcCKr9hG0mRrPvZJ8SuDUWpi4VMCoPX1cBkPYuwzaQ@mail.gmail.com
State New
Headers show
Series
  • [uclibc-ng-devel] utils and enabled UCLIBC_BUILD_SSP
Related show

Commit Message

Eugene Yudin Nov. 6, 2019, 4:35 p.m. UTC
Hi Waldemar,

When building with crosstool-ng, the libssp library is compiled at the
final stage of the compiler (after uClibc-ng was built), resulting in the
chicken-and-egg problem with utils. The attached patch fixes the problem by
building utils without stack smashing protector.

    [ALL  ]      mipsel-ndms-linux-uclibc-gcc ../utils/getconf.c  -o
../utils/getconf -Wall -Wstrict-prototypes -Wstrict-aliasing
-Wno-nonnull-compare -funsigned-char -fno-builtin -fno-asm
-fmerge-all-constants -msoft-float -std=gnu99 -mabi=32 -mnan=legacy
 -fstack-protector -nostdinc -I../include -I../include -include
libc-symbols.h -I../libc/sysdeps/linux/mips -I../libc/sysdeps/linux
-I../ldso/ldso/mips -I../ldso/include -I.  -Os -fstrict-aliasing
-mno-split-addresses   -pipe -D__USE_STDIO_FUTEXES__ -DHAVE_FORCED_UNWIND
-D_LIBC_REENTRANT -I../libpthread/nptl -I../libpthread/nptl
 -I../libpthread/nptl/sysdeps/unix/sysv/linux/mips
-I../libpthread/nptl/sysdeps/mips -I../libpthread/nptl/sysdeps/mips
-I../libpthread/nptl/sysdeps/unix/sysv/linux
-I../libpthread/nptl/sysdeps/unix/sysv/linux
-I../libpthread/nptl/sysdeps/pthread
-I../libpthread/nptl/sysdeps/pthread/bits
-I../libpthread/nptl/sysdeps/generic -I../libc/sysdeps/linux/common
-isystem
/home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/include-fixed
-isystem
/home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/include
-I/home/eugene/x-tools/mipsel-ndms-linux-uclibc/mipsel-ndms-linux-uclibc/sysroot/usr/include/
-DNDEBUG -fstack-protector-all -I../ldso/ldso/mips -I../ldso/include
-DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.1"
-I..///home/eugene/x-tools/mipsel-ndms-linux-uclibc/mipsel-ndms-linux-uclibc/sysroot/usr/include/
-DNOT_IN_libc -B../lib -Wl,-rpath-link,../lib -fstack-protector-all
-I../ldso/ldso/mips -I../ldso/include -DUCLIBC_RUNTIME_PREFIX="/"
-DUCLIBC_LDSO="ld-uClibc.so.1"
-I..///home/eugene/x-tools/mipsel-ndms-linux-uclibc/mipsel-ndms-linux-uclibc/sysroot/usr/include/
-DNOT_IN_libc -B../lib -Wl,-rpath-link,../lib
-DGETCONF_DIR='"/home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/build/build-libc-final/multilib/utils"'
-MT ../utils/getconf -MD -MP -MF ../utils/.getconf.dep
    [ALL  ]      ../utils/getconf.c: In function 'main':
    [ALL  ]      ../utils/getconf.c:1238:6: warning: statement will never
be executed [-Wswitch-unreachable]
    [ALL  ]            {
    [ALL  ]            ^
    [ALL  ]
 /home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/../../../../mipsel-ndms-linux-uclibc/bin/ld:
cannot find -lssp_nonshared
    [ALL  ]
 /home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/../../../../mipsel-ndms-linux-uclibc/bin/ld:
cannot find -lssp
    [ERROR]      collect2: error: ld returned 1 exit status
    [ALL  ]      Makefile.in:114: recipe for target '../utils/getconf'
failed

Comments

Waldemar Brodkorb Nov. 17, 2019, 4:34 p.m. UTC | #1
Hi Eugene,
Eugene Yudin wrote,

> Hi Waldemar,
> 
> When building with crosstool-ng, the libssp library is compiled at the final
> stage of the compiler (after uClibc-ng was built), resulting in the
> chicken-and-egg problem with utils. The attached patch fixes the problem by
> building utils without stack smashing protector.

Thanks, applied and pushed,
 Waldemar

Patch
diff mbox series

commit 3b8a2dee02e3877f134c50edfc209d2c7cab195d
Author: Eugene Yudin <e.yudin@ndmsystems.com>
Date:   Thu Aug 16 18:06:57 2018 +0300

    Makefile.in: build utils without stack smashing protector
    
    [ALL  ]      mipsel-ndms-linux-uclibc-gcc ../utils/getconf.c  -o ../utils/getconf -Wall -Wstrict-prototypes -Wstrict-aliasing -Wno-nonnull-compare -funsigned-char -fno-builtin -fno-asm -fmerge-all-constants -msoft-float -std=gnu99 -mabi=32 -mnan=legacy  -fstack-protector -nostdinc -I../include -I../include -include libc-symbols.h -I../libc/sysdeps/linux/mips -I../libc/sysdeps/linux -I../ldso/ldso/mips -I../ldso/include -I.  -Os -fstrict-aliasing -mno-split-addresses   -pipe -D__USE_STDIO_FUTEXES__ -DHAVE_FORCED_UNWIND -D_LIBC_REENTRANT -I../libpthread/nptl -I../libpthread/nptl  -I../libpthread/nptl/sysdeps/unix/sysv/linux/mips -I../libpthread/nptl/sysdeps/mips -I../libpthread/nptl/sysdeps/mips -I../libpthread/nptl/sysdeps/unix/sysv/linux -I../libpthread/nptl/sysdeps/unix/sysv/linux -I../libpthread/nptl/sysdeps/pthread -I../libpthread/nptl/sysdeps/pthread/bits -I../libpthread/nptl/sysdeps/generic -I../libc/sysdeps/linux/common -isystem /home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/include-fixed -isystem /home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/include -I/home/eugene/x-tools/mipsel-ndms-linux-uclibc/mipsel-ndms-linux-uclibc/sysroot/usr/include/ -DNDEBUG -fstack-protector-all -I../ldso/ldso/mips -I../ldso/include -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.1" -I..///home/eugene/x-tools/mipsel-ndms-linux-uclibc/mipsel-ndms-linux-uclibc/sysroot/usr/include/ -DNOT_IN_libc -B../lib -Wl,-rpath-link,../lib -fstack-protector-all -I../ldso/ldso/mips -I../ldso/include -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.1" -I..///home/eugene/x-tools/mipsel-ndms-linux-uclibc/mipsel-ndms-linux-uclibc/sysroot/usr/include/ -DNOT_IN_libc -B../lib -Wl,-rpath-link,../lib -DGETCONF_DIR='"/home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/build/build-libc-final/multilib/utils"' -MT ../utils/getconf -MD -MP -MF ../utils/.getconf.dep
    [ALL  ]      ../utils/getconf.c: In function 'main':
    [ALL  ]      ../utils/getconf.c:1238:6: warning: statement will never be executed [-Wswitch-unreachable]
    [ALL  ]            {
    [ALL  ]            ^
    [ALL  ]      /home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/../../../../mipsel-ndms-linux-uclibc/bin/ld: cannot find -lssp_nonshared
    [ALL  ]      /home/eugene/Documents/work/cases/13220_toolchain/crosstool-ng/.build/mipsel-ndms-linux-uclibc/buildtools/lib/gcc/mipsel-ndms-linux-uclibc/8.1.0/../../../../mipsel-ndms-linux-uclibc/bin/ld: cannot find -lssp
    [ERROR]      collect2: error: ld returned 1 exit status
    [ALL  ]      Makefile.in:114: recipe for target '../utils/getconf' failed

diff --git a/utils/Makefile.in b/utils/Makefile.in
index 2f8d1c96a..1544c8fcc 100644
--- a/utils/Makefile.in
+++ b/utils/Makefile.in
@@ -9,7 +9,7 @@  subdirs += utils
 # "make utils" flags
 
 CFLAGS-utils := \
-    $(SSP_ALL_CFLAGS) \
+    $(SSP_DISABLE_FLAGS) \
     -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
     -I$(top_srcdir)ldso/include \
     -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \