From 95c29a83ebadd0038fd304539a83c5e90798c1b9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 16 Dec 2015 16:35:27 -0800 Subject: [PATCH] PR gold/17473: Fix gold build with system C++ headers that use . gold/ PR gold/17473 * binary.cc: Move #include "safe-ctype.h" to be last #include. --- gold/ChangeLog | 7 ++++++- gold/binary.cc | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 06608eb5ec1..d929cb7f2dd 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2015-12-16 Roland McGrath + + PR ld/17473 + * binary.cc: Move #include "safe-ctype.h" to be last #include. + 2015-12-13 Cary Coutant * object.h (Object::get_output_view): remove const from return type. @@ -25,7 +30,7 @@ * object.h (Object::get_output_view): New function. (Object::do_get_output_view): New function. (Sized_relobj_file::do_get_output_view): New function. - (Sized_relobj_file::output_views_): New data member. + (Sized_relobj_file::output_views_): New data member. * reloc.cc: (Sized_relobj_file::do_relocate): Store pointer to output views in class object. (Sized_relobj_file::do_get_output_view): New function. diff --git a/gold/binary.cc b/gold/binary.cc index 12ca296eb90..52df81adce2 100644 --- a/gold/binary.cc +++ b/gold/binary.cc @@ -24,7 +24,6 @@ #include #include -#include "safe-ctype.h" #include "elfcpp.h" #include "stringpool.h" @@ -32,6 +31,13 @@ #include "output.h" #include "binary.h" +// safe-ctype.h interferes with macros defined by the system . +// Some C++ system headers might include and rely on its macro +// definitions being intact. So make sure that safe-ctype.h is included +// only after any C++ system headers, whether directly here (above) or via +// other local header files (e.g. #include in "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 // single .data section and define three symbols: -- 2.30.2