Fix binutils/gold breakage (XCC)
authorDan Cross <crossd@gmail.com>
Mon, 2 Nov 2015 20:19:59 +0000 (15:19 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Nov 2015 16:41:25 +0000 (11:41 -0500)
Binutils's safe-ctype.h plays some games with cpp macros that
are of dubious legalities as far as C++ is concerned: it is
not clear that the standard permits one to create macros with
the names of the various functions from <ctype.h>. In
particular, these are defined as functions in C++, as opposed
to macros.

"safe-ctype.h" #undef's these and #define's them to symbols that
are guaranteed to fail; this caused some problems under another
compilation environment that included C++ headers that defined
classes with member functions with the same names as the symbols
from <ctype.h>; these were being expanded to these failing
symbols.

The workaround is to move inclusion of safe-ctype.h to the end
of the list of includes. We should probably upstream this.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/compilers/gcc-glibc/binutils-2.24-akaros.patch

index 8ccc83b..c606f6a 100644 (file)
@@ -69,6 +69,24 @@ diff -ur binutils-2.24/gas/configure.tgt binutils-2.24-ros/gas/configure.tgt
    i386-*-kaos*)                               fmt=elf ;;
    i386-*-bsd*)                                fmt=aout em=386bsd ;;
    i386-*-nacl*)                               fmt=elf em=nacl
+diff -ur binutils-2.24/gold/binary.cc binutils-2.24-ros/gold/binary.cc
+--- binutils-2.24/gold/binary.cc       2015-11-02 15:17:29.049801929 -0500
++++ binutils-2.24-ros/gold/binary.cc   2015-11-02 15:17:38.246051136 -0500
+@@ -24,13 +24,13 @@
+ #include <cerrno>
+ #include <cstring>
+-#include "safe-ctype.h"
+ #include "elfcpp.h"
+ #include "stringpool.h"
+ #include "fileread.h"
+ #include "output.h"
+ #include "binary.h"
++#include "safe-ctype.h"
+ // Support for reading binary files as input.  These become blobs in
+ // the final output.  These files are treated as though they have a
 diff -ur binutils-2.24/ld/configure.tgt binutils-2.24-ros/ld/configure.tgt
 --- binutils-2.24/ld/configure.tgt     2013-11-26 06:37:33.000000000 -0500
 +++ binutils-2.24-ros/ld/configure.tgt 2015-03-13 19:04:52.888987865 -0400