From 07f33e0b396007dfc92c52ba4900ee14096d9013 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 18 Jul 2017 22:28:46 +0100 Subject: [PATCH] Various build fixes. --- binutils1.patch | 49 +++++++++++++++++++++++++++++++++++++++++ binutils2.patch | 12 ++++++++++ build_binutils_linux.sh | 6 +++-- build_gcc_core.sh | 3 +++ gcc1.patch | 30 +++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 binutils1.patch create mode 100644 binutils2.patch create mode 100644 gcc1.patch diff --git a/binutils1.patch b/binutils1.patch new file mode 100644 index 0000000..9f1c448 --- /dev/null +++ b/binutils1.patch @@ -0,0 +1,49 @@ +A patch from bug #752071 to fix build already sent to upstream. +--- a/bfd/bfd-in.h ++++ b/bfd/bfd-in.h +@@ -294,9 +294,9 @@ + + #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) + +-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) +-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) +-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) ++#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE)) ++#define bfd_set_section_alignment(bfd, ptr, val) ((ptr)->alignment_power = (val)) ++#define bfd_set_section_userdata(bfd, ptr, val) ((ptr)->userdata = (val)) + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ + (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +@@ -519,7 +519,7 @@ + + #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) + +-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) ++#define bfd_set_cacheable(abfd,bool) ((abfd)->cacheable = bool) + + extern bfd_boolean bfd_cache_close + (bfd *abfd); +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -301,9 +301,9 @@ + + #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) + +-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) +-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) +-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) ++#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE)) ++#define bfd_set_section_alignment(bfd, ptr, val) ((ptr)->alignment_power = (val)) ++#define bfd_set_section_userdata(bfd, ptr, val) ((ptr)->userdata = (val)) + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ + (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +@@ -526,7 +526,7 @@ + + #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) + +-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) ++#define bfd_set_cacheable(abfd,bool) ((abfd)->cacheable = bool) + + extern bfd_boolean bfd_cache_close + (bfd *abfd); diff --git a/binutils2.patch b/binutils2.patch new file mode 100644 index 0000000..bae0803 --- /dev/null +++ b/binutils2.patch @@ -0,0 +1,12 @@ +diff -Naur gas/config/tc-i386.c gas/config/tc-i386.c +--- a/gas/config/tc-i386.c 2013-11-26 12:37:33.000000000 +0100 ++++ b/gas/config/tc-i386.c 2015-05-22 11:42:24.647713050 +0200 +@@ -6140,7 +6140,7 @@ + op.bitfield.regmem = 0; + if ((dest + 1) >= i.operands + || (op.bitfield.reg32 != 1 +- && !op.bitfield.reg64 != 1 ++ && !!op.bitfield.reg64 + && !operand_type_equal (&op, ®xmm) + && !operand_type_equal (&op, ®ymm) + && !operand_type_equal (&op, ®zmm) diff --git a/build_binutils_linux.sh b/build_binutils_linux.sh index f97bb71..bc1cdd3 100644 --- a/build_binutils_linux.sh +++ b/build_binutils_linux.sh @@ -6,9 +6,11 @@ tar xjf Archives/binutils-2.23.2.tar.bz2 cd binutils-2.23.2 sed -i -e 's/@colophon/@@colophon/' \ -e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo +patch -p1 < ../binutils1.patch +patch -p1 < ../binutils2.patch cd .. -mkdir -p binutils-build-$MINGW_TARGET -cd binutils-build-$MINGW_TARGET +mkdir -p binutils-linux-build-$MINGW_TARGET +cd binutils-linux-build-$MINGW_TARGET ../binutils-2.23.2/configure --with-sysroot=$MINGW_PREFIX --prefix=$MINGW_PREFIX --disable-multilib -target=$MINGW_TARGET --enable-targets=$MINGW_TARGET make $MINGW_PARALLEL sudo make install diff --git a/build_gcc_core.sh b/build_gcc_core.sh index fe5107c..b8ce18a 100644 --- a/build_gcc_core.sh +++ b/build_gcc_core.sh @@ -1,6 +1,9 @@ #!/bin/bash -e tar xjf Archives/gcc-$MINGW_GCC_VERSION.tar.bz2 +cd gcc-$MINGW_GCC_VERSION +patch -p1 < ../gcc1.patch +cd .. mkdir -p gcc-build-$MINGW_TARGET cd gcc-build-$MINGW_TARGET ../gcc-$MINGW_GCC_VERSION/configure --with-sysroot=$MINGW_PREFIX --prefix=$MINGW_PREFIX --disable-multilib --target=$MINGW_TARGET --with-gnu-ld --with-gnu-as --enable-fully-dynamic-string diff --git a/gcc1.patch b/gcc1.patch new file mode 100644 index 0000000..7fdd4b6 --- /dev/null +++ b/gcc1.patch @@ -0,0 +1,30 @@ +diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf +index 68acd3d..953262f 100644 +--- a/gcc/cp/cfns.gperf ++++ b/gcc/cp/cfns.gperf +@@ -22,6 +22,9 @@ __inline + static unsigned int hash (const char *, unsigned int); + #ifdef __GNUC__ + __inline ++#ifdef __GNUC_STDC_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif + #endif + const char * libc_name_p (const char *, unsigned int); + %} +diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h +index 1c6665d..6d00c0e 100644 +--- a/gcc/cp/cfns.h ++++ b/gcc/cp/cfns.h +@@ -53,6 +53,9 @@ __inline + static unsigned int hash (const char *, unsigned int); + #ifdef __GNUC__ + __inline ++#ifdef __GNUC_STDC_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif + #endif + const char * libc_name_p (const char *, unsigned int); + /* maximum key range = 391, duplicates = 0 */ +-- +2.4.4 -- 2.30.2