Fix compiling using gcc 4.9

Partially resolves: #1087374
This commit is contained in:
Nick Clifton 2014-04-22 12:23:56 +01:00
parent 316c3d4761
commit 16b577d5e7
2 changed files with 110 additions and 1 deletions

View File

@ -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. *}

View File

@ -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 <nickc@redhat.com> - 2.24-12
- Fix compiling using gcc 4.9 (#1087374)
* Thu Mar 27 2014 Nick Clifton <nickc@redhat.com> - 2.24-11
- Use %{version} in Source string. Delete unused patches.