summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2014-04-25 00:19:30 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-27 08:37:49 +0100
commite72727500d678f6c94a8846079970593c177534a (patch)
tree304708ef5e2913ed37938dbff7f749e689ba13f9
parent90ea79e5156c0023d10c39e380e84c2e233f4c1c (diff)
downloadpoky-e72727500d678f6c94a8846079970593c177534a.tar.gz
binutils: Fix building nativesdk binutils with gcc 4.9
Patches explain the issue in detail but this is exposed with gcc 4.9 in binutils 2.23.2 (From OE-Core rev: fc5c467b680fc5aef4b0f689e6988e17a9322ae0) (From OE-Core rev: 4dfb8847ebf8aab90ad8888933468e2899c96998) (From OE-Core rev: af347d3298e15552d502d5b2ce497bbda9705bc7) (From OE-Core rev: 07a7228392ec5157616888cee1eb119f4adb39a7) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.23.2.inc2
-rw-r--r--meta/recipes-devtools/binutils/binutils/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch31
-rw-r--r--meta/recipes-devtools/binutils/binutils/replace_macros_with_static_inline.patch188
3 files changed, 221 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.2.inc b/meta/recipes-devtools/binutils/binutils-2.23.2.inc
index 99fe2e558f..4de833962f 100644
--- a/meta/recipes-devtools/binutils/binutils-2.23.2.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.23.2.inc
@@ -30,6 +30,8 @@ SRC_URI = "\
30 ${BACKPORT} \ 30 ${BACKPORT} \
31 file://binutils-fix-over-array-bounds-issue.patch \ 31 file://binutils-fix-over-array-bounds-issue.patch \
32 file://binutils-xlp-support.patch \ 32 file://binutils-xlp-support.patch \
33 file://replace_macros_with_static_inline.patch \
34 file://0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch \
33 " 35 "
34 36
35BACKPORT = "\ 37BACKPORT = "\
diff --git a/meta/recipes-devtools/binutils/binutils/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch b/meta/recipes-devtools/binutils/binutils/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch
new file mode 100644
index 0000000000..f786b176f2
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0001-Fix-MMIX-build-breakage-from-bfd_set_section_vma-cha.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Backport
2
3From 0a09fb4a09e80c36fa3ef763ae276fd13d272a36 Mon Sep 17 00:00:00 2001
4From: Hans-Peter Nilsson <hp@bitrange.com>
5Date: Sat, 1 Feb 2014 01:11:28 +0100
6Subject: [PATCH] Fix MMIX build breakage from bfd_set_section_vma change.
7
8 * emultempl/mmix-elfnmmo.em (mmix_after_allocation): Fix typo in
9 call to bfd_set_section_vma exposed by recent bfd_set_section_vma
10 change.
11---
12 ld/ChangeLog | 6 ++++++
13 ld/emultempl/mmix-elfnmmo.em | 2 +-
14 2 files changed, 7 insertions(+), 1 deletion(-)
15
16diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
17index 0059792..5e9781a 100644
18--- a/ld/emultempl/mmix-elfnmmo.em
19+++ b/ld/emultempl/mmix-elfnmmo.em
20@@ -102,7 +102,7 @@ mmix_after_allocation (void)
21 This section is only present when there are register symbols. */
22 sec = bfd_get_section_by_name (link_info.output_bfd, MMIX_REG_SECTION_NAME);
23 if (sec != NULL)
24- bfd_set_section_vma (abfd, sec, 0);
25+ bfd_set_section_vma (sec->owner, sec, 0);
26
27 if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info))
28 {
29--
301.7.10.4
31
diff --git a/meta/recipes-devtools/binutils/binutils/replace_macros_with_static_inline.patch b/meta/recipes-devtools/binutils/binutils/replace_macros_with_static_inline.patch
new file mode 100644
index 0000000000..834f55cf6d
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/replace_macros_with_static_inline.patch
@@ -0,0 +1,188 @@
1Upstream-Status: Backport
2
3From 27b829ee701e29804216b3803fbaeb629be27491 Mon Sep 17 00:00:00 2001
4From: Nick Clifton <nickc@redhat.com>
5Date: Wed, 29 Jan 2014 13:46:39 +0000
6Subject: [PATCH 1/1] Following up on Tom's suggestion I am checking in a patch to replace the various
7 bfd_xxx_set macros with static inline functions, so that we can avoid compile time
8 warnings about comma expressions with unused values.
9
10 * bfd-in.h (bfd_set_section_vma): Delete.
11 (bfd_set_section_alignment): Delete.
12 (bfd_set_section_userdata): Delete.
13 (bfd_set_cacheable): Delete.
14 * bfd.c (bfd_set_cacheable): New static inline function.
15 * section.c (bfd_set_section_userdata): Likewise.
16 (bfd_set_section_vma): Likewise.
17 (bfd_set_section_alignment): Likewise.
18 * bfd-in2.h: Regenerate.
19---
20 bfd/ChangeLog | 12 ++++++++++++
21 bfd/bfd-in.h | 5 -----
22 bfd/bfd-in2.h | 41 +++++++++++++++++++++++++++++++++++------
23 bfd/bfd.c | 8 ++++++++
24 bfd/section.c | 26 ++++++++++++++++++++++++++
25 5 files changed, 81 insertions(+), 11 deletions(-)
26
27diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
28index 3afd71b..c7c5a7d 100644
29--- a/bfd/bfd-in.h
30+++ b/bfd/bfd-in.h
31@@ -292,9 +292,6 @@ typedef struct bfd_section *sec_ptr;
32
33 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
34
35-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
36-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
37-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
38 /* Find the address one past the end of SEC. */
39 #define bfd_get_section_limit(bfd, sec) \
40 (((bfd)->direction != write_direction && (sec)->rawsize != 0 \
41@@ -517,8 +514,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *);
42
43 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
44
45-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
46-
47 extern bfd_boolean bfd_cache_close
48 (bfd *abfd);
49 /* NB: This declaration should match the autogenerated one in libbfd.h. */
50diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
51index 71996db..b5aeb40 100644
52--- a/bfd/bfd-in2.h
53+++ b/bfd/bfd-in2.h
54@@ -299,9 +299,6 @@ typedef struct bfd_section *sec_ptr;
55
56 #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
57
58-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
59-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
60-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
61 /* Find the address one past the end of SEC. */
62 #define bfd_get_section_limit(bfd, sec) \
63 (((bfd)->direction != write_direction && (sec)->rawsize != 0 \
64@@ -524,8 +521,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *);
65
66 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
67
68-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
69-
70 extern bfd_boolean bfd_cache_close
71 (bfd *abfd);
72 /* NB: This declaration should match the autogenerated one in libbfd.h. */
73@@ -1029,7 +1024,7 @@ bfd *bfd_openr (const char *filename, const char *target);
74
75 bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
76
77-bfd *bfd_openstreamr (const char *, const char *, void *);
78+bfd *bfd_openstreamr (const char * filename, const char * target, void * stream);
79
80 bfd *bfd_openr_iovec (const char *filename, const char *target,
81 void *(*open_func) (struct bfd *nbfd,
82@@ -1596,6 +1591,32 @@ struct relax_table {
83 int size;
84 };
85
86+/* Note: the following are provided as inline functions rather than macros
87+ because not all callers use the return value. A macro implementation
88+ would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
89+ compilers will complain about comma expressions that have no effect. */
90+static inline bfd_boolean
91+bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
92+{
93+ ptr->userdata = val;
94+ return TRUE;
95+}
96+
97+static inline bfd_boolean
98+bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
99+{
100+ ptr->vma = ptr->lma = val;
101+ ptr->user_set_vma = TRUE;
102+ return TRUE;
103+}
104+
105+static inline bfd_boolean
106+bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
107+{
108+ ptr->alignment_power = val;
109+ return TRUE;
110+}
111+
112 /* These sections are global, and are managed by BFD. The application
113 and target back end are not permitted to change the values in
114 these sections. */
115@@ -6415,6 +6436,14 @@ struct bfd
116 unsigned int selective_search : 1;
117 };
118
119+/* See note beside bfd_set_section_userdata. */
120+static inline bfd_boolean
121+bfd_set_cacheable (bfd * abfd, bfd_boolean val)
122+{
123+ abfd->cacheable = val;
124+ return TRUE;
125+}
126+
127 typedef enum bfd_error
128 {
129 bfd_error_no_error = 0,
130diff --git a/bfd/bfd.c b/bfd/bfd.c
131index 8d0580c..2d174f3 100644
132--- a/bfd/bfd.c
133+++ b/bfd/bfd.c
134@@ -311,6 +311,14 @@ CODE_FRAGMENT
135 . unsigned int selective_search : 1;
136 .};
137 .
138+.{* See note beside bfd_set_section_userdata. *}
139+.static inline bfd_boolean
140+.bfd_set_cacheable (bfd * abfd, bfd_boolean val)
141+.{
142+. abfd->cacheable = val;
143+. return TRUE;
144+.}
145+.
146 */
147
148 #include "sysdep.h"
149diff --git a/bfd/section.c b/bfd/section.c
150index fb19d8c..a661228 100644
151--- a/bfd/section.c
152+++ b/bfd/section.c
153@@ -542,6 +542,32 @@ CODE_FRAGMENT
154 . int size;
155 .};
156 .
157+.{* Note: the following are provided as inline functions rather than macros
158+. because not all callers use the return value. A macro implementation
159+. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
160+. compilers will complain about comma expressions that have no effect. *}
161+.static inline bfd_boolean
162+.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
163+.{
164+. ptr->userdata = val;
165+. return TRUE;
166+.}
167+.
168+.static inline bfd_boolean
169+.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
170+.{
171+. ptr->vma = ptr->lma = val;
172+. ptr->user_set_vma = TRUE;
173+. return TRUE;
174+.}
175+.
176+.static inline bfd_boolean
177+.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
178+.{
179+. ptr->alignment_power = val;
180+. return TRUE;
181+.}
182+.
183 .{* These sections are global, and are managed by BFD. The application
184 . and target back end are not permitted to change the values in
185 . these sections. *}
186--
1871.7.1
188