From 16b577d5e79d52ce56463a1e572f70f1512e2c59 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 22 Apr 2014 12:23:56 +0100 Subject: [PATCH] Fix compiling using gcc 4.9 Partially resolves: #1087374 --- binutils-2.24-set-section-macros.patch | 103 +++++++++++++++++++++++++ binutils.spec | 8 +- 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 binutils-2.24-set-section-macros.patch diff --git a/binutils-2.24-set-section-macros.patch b/binutils-2.24-set-section-macros.patch new file mode 100644 index 0000000..6171c48 --- /dev/null +++ b/binutils-2.24-set-section-macros.patch @@ -0,0 +1,103 @@ +diff -rcp ../binutils-2.24.orig/bfd/bfd-in2.h bfd/bfd-in2.h +*** ../binutils-2.24.orig/bfd/bfd-in2.h 2014-04-22 12:03:35.226872578 +0100 +--- bfd/bfd-in2.h 2014-04-22 12:07:51.556393678 +0100 +*************** typedef struct bfd_section *sec_ptr; +*** 294,302 **** + + #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) + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ + (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +--- 294,299 ---- +*************** struct relax_table { +*** 1592,1597 **** +--- 1589,1620 ---- + int size; + }; + ++ /* Note: the following are provided as inline functions rather than macros ++ because not all callers use the return value. A macro implementation ++ would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some ++ compilers will complain about comma expressions that have no effect. */ ++ static inline bfd_boolean ++ bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) ++ { ++ ptr->userdata = val; ++ return TRUE; ++ } ++ ++ static inline bfd_boolean ++ bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) ++ { ++ ptr->vma = ptr->lma = val; ++ ptr->user_set_vma = TRUE; ++ return TRUE; ++ } ++ ++ static inline bfd_boolean ++ bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) ++ { ++ ptr->alignment_power = val; ++ return TRUE; ++ } ++ + /* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. */ +diff -rcp ../binutils-2.24.orig/bfd/bfd-in.h bfd/bfd-in.h +*** ../binutils-2.24.orig/bfd/bfd-in.h 2014-04-22 12:03:35.272868967 +0100 +--- bfd/bfd-in.h 2014-04-22 12:06:12.850914084 +0100 +*************** typedef struct bfd_section *sec_ptr; +*** 287,295 **** + + #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) + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ + (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +--- 287,292 ---- +diff -rcp ../binutils-2.24.orig/bfd/section.c bfd/section.c +*** ../binutils-2.24.orig/bfd/section.c 2014-04-22 12:03:35.215873442 +0100 +--- bfd/section.c 2014-04-22 12:06:55.795118059 +0100 +*************** CODE_FRAGMENT +*** 542,547 **** +--- 542,573 ---- + . int size; + .}; + . ++ .{* Note: the following are provided as inline functions rather than macros ++ . because not all callers use the return value. A macro implementation ++ . would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some ++ . compilers will complain about comma expressions that have no effect. *} ++ .static inline bfd_boolean ++ .bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) ++ .{ ++ . ptr->userdata = val; ++ . return TRUE; ++ .} ++ . ++ .static inline bfd_boolean ++ .bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) ++ .{ ++ . ptr->vma = ptr->lma = val; ++ . ptr->user_set_vma = TRUE; ++ . return TRUE; ++ .} ++ . ++ .static inline bfd_boolean ++ .bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) ++ .{ ++ . ptr->alignment_power = val; ++ . return TRUE; ++ .} ++ . + .{* These sections are global, and are managed by BFD. The application + . and target back end are not permitted to change the values in + . these sections. *} diff --git a/binutils.spec b/binutils.spec index 740b59d..cd70e17 100644 --- a/binutils.spec +++ b/binutils.spec @@ -17,7 +17,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.24 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv3+ Group: Development/Tools URL: http://sources.redhat.com/binutils @@ -53,6 +53,8 @@ Patch14: binutils-2.24-s390-mkopc.patch Patch15: binutils-2.24-elfnn-aarch64.patch # Fix decoding of abstract instance names using DW_FORM_ref_addr. Patch16: binutils-2.24-DW_FORM_ref_addr.patch +# Fix compiling using gcc 4.9 +Patch17: binutils-2.24-set-section-macros.patch Provides: bundled(libiberty) @@ -171,6 +173,7 @@ using libelf instead of BFD. %patch14 -p0 -b .mkopc~ %patch15 -p0 -b .elf-aarch64~ %patch16 -p0 -b .ref-addr~ +%patch17 -p0 -b .sec-macros~ # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -476,6 +479,9 @@ exit 0 %endif # %{isnative} %changelog +* Tue Apr 22 2014 Nick Clifton - 2.24-12 +- Fix compiling using gcc 4.9 (#1087374) + * Thu Mar 27 2014 Nick Clifton - 2.24-11 - Use %{version} in Source string. Delete unused patches.