diff options
author | Zhenhua Luo <zhenhua.luo@freescale.com> | 2013-03-13 15:43:04 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-15 01:53:04 +0000 |
commit | d350bb84896530455a2cd6f10000ba6db6a10e22 (patch) | |
tree | fa820242048165f3bb5a566511e083624848cf16 /meta/recipes-devtools | |
parent | 5b2aaa3c1ce0aadb2f89ad1ecc791410ea66fe10 (diff) | |
download | poky-d350bb84896530455a2cd6f10000ba6db6a10e22.tar.gz |
binutils: fix ineffectual zero of cache and array bounds issue
binutils build fails on Fedora18+:
1. binutils-2.23.1/bfd/elf32-xtensa.c:6078:36: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
memset (sec_cache, 0, sizeof (sec_cache));
^
2. binutils-2.23.1/bfd/elf32-xtensa.c:6120:32: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
memset (sec_cache, 0, sizeof (sec_cache));
^
3. binutils-2.23.1/opcodes/arc-dis.c:430:13: error: argument to 'sizeof' in '__builtin_strncat' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
sizeof (state->commentBuffer));
^
4. binutils-2.23.1/opcodes/rl78-dis.c:230:13: error: array subscript is above array bounds [-Werror=array-bounds]
if (oper->use_es && indirect_type (oper->type))
^
(From OE-Core rev: 5445e12e5a32cc5c51ce8a29f2800692ed831115)
Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
4 files changed, 110 insertions, 1 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.1.inc b/meta/recipes-devtools/binutils/binutils-2.23.1.inc index 15811d7830..4523407660 100644 --- a/meta/recipes-devtools/binutils/binutils-2.23.1.inc +++ b/meta/recipes-devtools/binutils/binutils-2.23.1.inc | |||
@@ -1,4 +1,4 @@ | |||
1 | PR = "r2" | 1 | PR = "r3" |
2 | 2 | ||
3 | LIC_FILES_CHKSUM="\ | 3 | LIC_FILES_CHKSUM="\ |
4 | file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ | 4 | file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ |
@@ -28,6 +28,7 @@ SRC_URI = "\ | |||
28 | file://binutils-armv5e.patch \ | 28 | file://binutils-armv5e.patch \ |
29 | file://mips64-default-ld-emulation.patch \ | 29 | file://mips64-default-ld-emulation.patch \ |
30 | ${BACKPORT} \ | 30 | ${BACKPORT} \ |
31 | file://binutils-fix-over-array-bounds-issue.patch \ | ||
31 | " | 32 | " |
32 | 33 | ||
33 | BACKPORT = "\ | 34 | BACKPORT = "\ |
@@ -44,6 +45,8 @@ BACKPORT = "\ | |||
44 | file://backport/0026-ld-testsuite.patch \ | 45 | file://backport/0026-ld-testsuite.patch \ |
45 | file://backport/0001-doc-binutils.texi-elfedit-Fix-use-of-itemx-in-table.patch \ | 46 | file://backport/0001-doc-binutils.texi-elfedit-Fix-use-of-itemx-in-table.patch \ |
46 | file://backport/0001-ld.texinfo-Replace-with-when-it-is-part-of-the-text.patch \ | 47 | file://backport/0001-ld.texinfo-Replace-with-when-it-is-part-of-the-text.patch \ |
48 | file://backport/binutils-fix-ineffectual-zero-of-cache.patch \ | ||
49 | file://backport/binutils-replace-strncat-with-strcat.patch \ | ||
47 | " | 50 | " |
48 | SRC_URI[md5sum] = "33adb18c3048d057ac58d07a3f1adb38" | 51 | SRC_URI[md5sum] = "33adb18c3048d057ac58d07a3f1adb38" |
49 | SRC_URI[sha256sum] = "2ab2e5b03e086d12c6295f831adad46b3e1410a3a234933a2e8fac66cb2e7a19" | 52 | SRC_URI[sha256sum] = "2ab2e5b03e086d12c6295f831adad46b3e1410a3a234933a2e8fac66cb2e7a19" |
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.1/backport/binutils-fix-ineffectual-zero-of-cache.patch b/meta/recipes-devtools/binutils/binutils-2.23.1/backport/binutils-fix-ineffectual-zero-of-cache.patch new file mode 100644 index 0000000000..a4aebf3be0 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.1/backport/binutils-fix-ineffectual-zero-of-cache.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | * elf32-xtensa.c | ||
4 | * (free_section_cache): Renamed from clear_section_cache. | ||
5 | * (section_cache_section): Remove ineffectual zero of cache. | ||
6 | Call init_section_cache instead. | ||
7 | |||
8 | binutils build might fail on recent Linux distros: | ||
9 | binutils-2.23.1/bfd/elf32-xtensa.c:6078:36: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess] | ||
10 | memset (sec_cache, 0, sizeof (sec_cache)); | ||
11 | ^ | ||
12 | binutils-2.23.1/bfd/elf32-xtensa.c:6120:32: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess] | ||
13 | memset (sec_cache, 0, sizeof (sec_cache)); | ||
14 | |||
15 | The original commit is http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-xtensa.c.diff?r1=1.135&r2=1.136&cvsroot=src | ||
16 | |||
17 | Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> | ||
18 | |||
19 | --- binutils-2.23.1/bfd/elf32-xtensa.c.org 2013-03-12 03:04:29.000000000 -0500 | ||
20 | +++ binutils-2.23.1/bfd/elf32-xtensa.c 2013-03-12 03:06:37.000000000 -0500 | ||
21 | @@ -6067,7 +6067,7 @@ | ||
22 | |||
23 | |||
24 | static void | ||
25 | -clear_section_cache (section_cache_t *sec_cache) | ||
26 | +free_section_cache (section_cache_t *sec_cache) | ||
27 | { | ||
28 | if (sec_cache->sec) | ||
29 | { | ||
30 | @@ -6075,7 +6075,6 @@ | ||
31 | release_internal_relocs (sec_cache->sec, sec_cache->relocs); | ||
32 | if (sec_cache->ptbl) | ||
33 | free (sec_cache->ptbl); | ||
34 | - memset (sec_cache, 0, sizeof (sec_cache)); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | @@ -6116,8 +6115,8 @@ | ||
39 | goto err; | ||
40 | |||
41 | /* Fill in the new section cache. */ | ||
42 | - clear_section_cache (sec_cache); | ||
43 | - memset (sec_cache, 0, sizeof (sec_cache)); | ||
44 | + free_section_cache (sec_cache); | ||
45 | + init_section_cache (sec_cache); | ||
46 | |||
47 | sec_cache->sec = sec; | ||
48 | sec_cache->contents = contents; | ||
49 | @@ -8272,8 +8271,9 @@ | ||
50 | #endif /* DEBUG */ | ||
51 | |||
52 | error_return: | ||
53 | - if (prop_table) free (prop_table); | ||
54 | - clear_section_cache (&target_sec_cache); | ||
55 | + if (prop_table) | ||
56 | + free (prop_table); | ||
57 | + free_section_cache (&target_sec_cache); | ||
58 | |||
59 | release_contents (sec, contents); | ||
60 | release_internal_relocs (sec, internal_relocs); | ||
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.1/backport/binutils-replace-strncat-with-strcat.patch b/meta/recipes-devtools/binutils/binutils-2.23.1/backport/binutils-replace-strncat-with-strcat.patch new file mode 100644 index 0000000000..bc8f92b8ae --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.1/backport/binutils-replace-strncat-with-strcat.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | Upstream-Status: Backport | ||
2 | |||
3 | * arc-dis.c (write_comments_): Don't use strncat due to | ||
4 | the size of state->commentBuffer pointer isn't predictable. | ||
5 | |||
6 | binutils build will fail on Fedora18+. | ||
7 | binutils-2.23.1/opcodes/arc-dis.c:430:13: error: argument to 'sizeof' in '__builtin_strncat' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] | ||
8 | sizeof (state->commentBuffer)); | ||
9 | ^ | ||
10 | |||
11 | The original commit is http://sourceware.org/cgi-bin/cvsweb.cgi/src/opcodes/arc-dis.c.diff?r1=1.17&r2=1.18&cvsroot=src | ||
12 | |||
13 | Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> | ||
14 | |||
15 | --- binutils-2.23.1/opcodes/arc-dis.c.orig 2013-03-13 00:10:27.978498158 -0500 | ||
16 | +++ binutils-2.23.1/opcodes/arc-dis.c 2013-03-13 00:11:28.297499381 -0500 | ||
17 | @@ -426,8 +426,7 @@ | ||
18 | strcpy (state->commentBuffer, comment_prefix); | ||
19 | else | ||
20 | strcat (state->commentBuffer, ", "); | ||
21 | - strncat (state->commentBuffer, state->comm[i], | ||
22 | - sizeof (state->commentBuffer)); | ||
23 | + strcat (state->commentBuffer, state->comm[i]); | ||
24 | } | ||
25 | } | ||
26 | } | ||
diff --git a/meta/recipes-devtools/binutils/binutils-2.23.1/binutils-fix-over-array-bounds-issue.patch b/meta/recipes-devtools/binutils/binutils-2.23.1/binutils-fix-over-array-bounds-issue.patch new file mode 100644 index 0000000000..aacbfef7d6 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils-2.23.1/binutils-fix-over-array-bounds-issue.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | Upstream-Status: Pending | ||
2 | |||
3 | binutils build fails on Fedora18+ due to over array bounds issue: | ||
4 | binutils-2.23.1/opcodes/rl78-dis.c:230:13: error: array subscript is above array bounds [-Werror=array-bounds] | ||
5 | if (oper->use_es && indirect_type (oper->type)) | ||
6 | ^ | ||
7 | |||
8 | Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> | ||
9 | |||
10 | --- binutils-2.23.1/opcodes/rl78-dis.c.orig 2013-03-12 22:17:47.664361066 -0500 | ||
11 | +++ binutils-2.23.1/opcodes/rl78-dis.c 2013-03-12 23:39:51.383460914 -0500 | ||
12 | @@ -221,7 +221,7 @@ | ||
13 | |||
14 | case '0': | ||
15 | case '1': | ||
16 | - oper = opcode.op + *s - '0'; | ||
17 | + oper = &opcode.op[*s - '0']; | ||
18 | if (do_bang) | ||
19 | PC ('!'); | ||
20 | |||