Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 28 Mar 2013 21:56:55 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: musl and gcc-4.8 (sabotage)

On Fri, Mar 29, 2013 at 02:39:03AM +0100, Daniel Cegiełka wrote:
> diff -urN gcc-4.8-20130203.orig/gcc/config/linux.h gcc-4.8-20130203/gcc/config/linux.h
> --- gcc-4.8-20130203.orig/gcc/config/linux.h	Sun Feb 10 21:27:40 2013
> +++ gcc-4.8-20130203/gcc/config/linux.h	Sun Feb 10 21:45:07 2013
> @@ -32,10 +32,12 @@
>  #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
>  #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
>  #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
> +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
>  #else
>  #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
>  #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
>  #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
> +#define OPTION_MUSL (linux_libc == LIBC_MUSL)
>  #endif
>  
>  #define GNU_USER_TARGET_OS_CPP_BUILTINS()			\
> @@ -53,18 +55,21 @@
>     uClibc or Bionic is the default C library and whether
>     -muclibc or -mglibc or -mbionic has been passed to change the default.  */
>  
> -#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)	\
> -  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
> +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)	\
> +  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
>  
>  #if DEFAULT_LIBC == LIBC_GLIBC
> -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
> -  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
> +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
> +  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
>  #elif DEFAULT_LIBC == LIBC_UCLIBC
> -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
> -  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
> +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
> +  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
>  #elif DEFAULT_LIBC == LIBC_BIONIC
> -#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
> -  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
> +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
> +  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
> +#elif DEFAULT_LIBC == LIBC_MUSL
> +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
> +  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
>  #else
>  #error "Unsupported DEFAULT_LIBC"
>  #endif /* DEFAULT_LIBC */
> @@ -81,19 +86,23 @@
>  #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
>  #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
>  #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
> +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl.so.1"

This is almost certainly wrong.

> diff -r 45cd88d4fb7b -r 0afd9d82498d libgomp/config/posix/time.c
> --- a/libgomp/config/posix/time.c       Wed Nov 21 21:19:19 2012 -0500
> +++ b/libgomp/config/posix/time.c       Wed Nov 21 21:20:22 2012 -0500
> @@ -28,6 +28,8 @@
>     The following implementation uses the most simple POSIX routines.
>     If present, POSIX 4 clocks should be used instead.  */
>  
> +#define _POSIX_C_SOURCE 199309L /* for clocks */
> +
>  #include "libgomp.h"
>  #include <unistd.h>
>  #if TIME_WITH_SYS_TIME
> diff -r 0afd9d82498d -r 53f3e21a7d14 gcc/config/i386/linux.h
> --- a/gcc/config/i386/linux.h   Wed Nov 21 21:20:22 2012 -0500
> +++ b/gcc/config/i386/linux.h   Wed Nov 21 21:21:21 2012 -0500
> @@ -22,3 +22,4 @@
>  
>  #define GNU_USER_LINK_EMULATION "elf_i386"
>  #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
> +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl.so.1"

This too.

> diff -r 53f3e21a7d14 -r 0a4e297edad6 libitm/config/arm/hwcap.cc
> --- a/libitm/config/arm/hwcap.cc        Wed Nov 21 21:21:21 2012 -0500
> +++ b/libitm/config/arm/hwcap.cc        Wed Nov 21 21:21:54 2012 -0500
> @@ -40,7 +40,11 @@
>  
>  #ifdef __linux__
>  #include <unistd.h>
> +#ifdef __GLIBC__
>  #include <sys/fcntl.h>
> +#else
> +#include <fcntl.h>
> +#endif
>  #include <elf.h>

This should just unconditionally be <fcntl.h>. <sys/fcntl.h> is wrong.

>  # Disable libsanitizer on unsupported systems.
> -if test -d ${srcdir}/libsanitizer; then
> -    if test x$enable_libsanitizer = x; then
> -	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsanitizer support" >&5
> -$as_echo_n "checking for libsanitizer support... " >&6; }
> -	if (srcdir=${srcdir}/libsanitizer; \
> -		. ${srcdir}/configure.tgt; \
> -		test -n "$UNSUPPORTED")
> -	then
> -	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> -$as_echo "no" >&6; }
> -	    noconfigdirs="$noconfigdirs target-libsanitizer"
> -	else
> -	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
> -$as_echo "yes" >&6; }
> -	fi
> -    fi
> -fi
> +noconfigdirs="$noconfigdirs target-libsanitizer"

That works... :-)

Rich

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.