Skip to content

Commit

Permalink
Fix array bounds warnings in elf_get_dyanmic_info() on sparc with gcc…
Browse files Browse the repository at this point in the history
…-4.6

	* get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a
	link_map->l_info array access.
  • Loading branch information
David S. Miller committed Dec 19, 2014
1 parent 804c54f commit 6d4188d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2014-12-19 David S. Miller <davem@davemloft.net>

* get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a
link_map->l_info array access.

2014-12-19 Chris Metcalf <cmetcalf@ezchip.com>

* iconvdata/tst-loading.c (TIMEOUT): Increase timeout 10 sec.
Expand Down
11 changes: 10 additions & 1 deletion elf/get-dynamic-info.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */

#include <assert.h>
#include <libc-internal.h>

#ifndef RESOLVE_MAP
static
Expand Down Expand Up @@ -47,7 +48,15 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
info[dyn->d_tag] = dyn;
else if (dyn->d_tag >= DT_LOPROC &&
dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
{
/* This does not violate the array bounds of l->l_info, but
gcc 4.6 on sparc somehow does not see this. */
DIAG_PUSH_NEEDS_COMMENT;
DIAG_IGNORE_NEEDS_COMMENT (4.6,
"-Warray-bounds");
info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
DIAG_POP_NEEDS_COMMENT;
}
else if ((d_tag_utype) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
info[VERSYMIDX (dyn->d_tag)] = dyn;
else if ((d_tag_utype) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
Expand Down

0 comments on commit 6d4188d

Please sign in to comment.