Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 30 Mar 2013 10:51:41 +0100
From: Daniel Cegiełka <daniel.cegielka@...il.com>
To: musl@...ts.openwall.com
Subject: Re: musl and gcc-4.8 (sabotage)

2013/3/29 Szabolcs Nagy <nsz@...t70.net>

> for some reason the diff got attached as octet stream
>
> i'd cc gregor since it was his work originally and he
> is not subscribed to the ml
>
> this part seems to change the behaviour for other
> libcs, is that necessary?
>
>

glibc, bionic and uclib have special definitions to be able to detect which
libc is used (__GLIBC__, __UCLIBC__). musl doesn't support such solutions,
so we can use host_os (gcc-4.8-musl.diff):

diff -urN gcc-4.8-20130321.orig/libstdc++-v3/configure.host
gcc-4.8-20130321/libstdc++-v3/configure.host
--- gcc-4.8-20130321.orig/libstdc++-v3/configure.host    Sat Mar 30
00:29:39 2013
+++ gcc-4.8-20130321/libstdc++-v3/configure.host    Sat Mar 30 00:31:28 2013
@@ -268,6 +268,8 @@
       os_include_dir="os/uclibc"
     elif [ "$bionic" = "yes" ]; then
       os_include_dir="os/bionic"
+    elif [ "$host_os" = "linux-musl" ]; then
+      os_include_dir="os/generic"
     else
       os_include_dir="os/gnu-linux"
     fi


or detect glibc in gcc way (gcc-4.8-musl2.diff):


diff -urN gcc-4.8-20130321.orig/libstdc++-v3/acinclude.m4
gcc-4.8-20130321/libstdc++-v3/acinclude.m4
--- gcc-4.8-20130321.orig/libstdc++-v3/acinclude.m4    Fri Mar 29 22:23:14
2013
+++ gcc-4.8-20130321/libstdc++-v3/acinclude.m4    Fri Mar 29 22:30:53 2013
@@ -99,6 +99,13 @@

   # Check for C library flavor since GNU/Linux platforms use different
   # configuration directories depending on the C library in use.
+  AC_EGREP_CPP([_using_glibc], [
+  #include <features.h>
+  #if __GLIBC__
+    _using_glibc
+  #endif
+  ], glibc=yes, glibc=no)
+
   AC_EGREP_CPP([_using_uclibc], [
   #include <stdio.h>
   #if __UCLIBC__
diff -urN gcc-4.8-20130321.orig/libstdc++-v3/configure
gcc-4.8-20130321/libstdc++-v3/configure
--- gcc-4.8-20130321.orig/libstdc++-v3/configure    Fri Mar 29 22:23:14 2013
+++ gcc-4.8-20130321/libstdc++-v3/configure    Fri Mar 29 22:29:23 2013
@@ -5243,6 +5243,24 @@
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */

+  #include <features.h>
+  #if __GLIBC__
+    _using_glibc
+  #endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "_using_glibc" >/dev/null 2>&1; then :
+  glibc=yes
+else
+  glibc=no
+fi
+rm -f conftest*
+
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
   #include <stdio.h>
   #if __UCLIBC__
     _using_uclibc
diff -urN gcc-4.8-20130321.orig/libstdc++-v3/configure.host
gcc-4.8-20130321/libstdc++-v3/configure.host
--- gcc-4.8-20130321.orig/libstdc++-v3/configure.host    Fri Mar 29
22:23:14 2013
+++ gcc-4.8-20130321/libstdc++-v3/configure.host    Fri Mar 29 22:36:15 2013
@@ -264,12 +264,14 @@
     os_include_dir="os/bsd/freebsd"
     ;;
   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
-    if [ "$uclibc" = "yes" ]; then
+    if [ "$glibc" = "yes" ]; then
+      os_include_dir="os/gnu-linux"
+    elif [ "$uclibc" = "yes" ]; then
       os_include_dir="os/uclibc"
     elif [ "$bionic" = "yes" ]; then
       os_include_dir="os/bionic"
     else
-      os_include_dir="os/gnu-linux"
+      os_include_dir="os/generic"
     fi
     ;;
   hpux*)

Daniel

Content of type "text/html" skipped

Download attachment "gcc-4.8-musl.diff" of type "application/octet-stream" (14375 bytes)

Download attachment "gcc-4.8-musl2.diff" of type "application/octet-stream" (15902 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.