From 70819a18bf9c452d229e587e03b26bfa44f10686 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Thu, 8 Aug 2019 14:17:25 +0100 Subject: Static PatchELF only built when static C library exists Until now, when building PatchELF, we would always require that it be done statically. However, some systems don't have a static C library available for linking. This cause a crash in the static building of PatchELF. But a static PatchELF is necessary for correcting RPATH in GCC's outputs. With this commit, in the configure script we check if a static C library is linkable for the compiler. If it isn't then `host_cc' will be set to 1 and GCC won't be built. We also pass the result of this test to `basic.mk' (through `good_static_lib'), so if a static C library isn't available, it builds a dynamically linked PatchELF. This bug was reported by Elham Saremi. --- reproduce/software/bash/configure.sh | 66 ++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 7 deletions(-) (limited to 'reproduce/software/bash/configure.sh') diff --git a/reproduce/software/bash/configure.sh b/reproduce/software/bash/configure.sh index be9c635..14268d9 100755 --- a/reproduce/software/bash/configure.sh +++ b/reproduce/software/bash/configure.sh @@ -866,11 +866,11 @@ fi # example `/usr/include/x86_64-linux-gnu/') that are automatically included # in an installed GCC. HOWEVER during the build of GCC, all those other # directories are ignored. So even if they exist, they are useless. -warningsleep=0 +gccwarning=0 if [ $host_cc = 0 ]; then if ! [ -f /usr/include/sys/cdefs.h ]; then host_cc=1 - warningsleep=1 + gccwarning=1 cat <" > $testsource + echo "#include " >> $testsource + echo "int main(void){printf(\"...yes\");" >> $testsource + echo " return EXIT_SUCCESS;}" >> $testsource + if gcc $testsource -o$testprog -static -lc && $testprog; then + good_static_libc=1 + rm $testsource $testprog + else + good_static_libc=0 + rm $testsource + gccwarning=1 + host_cc=1 + cat <