From patchwork Fri Dec 19 21:43:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 422987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EE8A214009B for ; Sat, 20 Dec 2014 08:44:22 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:to:subject:from:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=P1W Nw80sofHe7OHzgb8VZRwRJtYvjQHOINKR/rMixVyzzNdx81FHU/VBQ0BLjjANxuh xJ/Dl8N13o5BqbDoApaFOq4ToHEiqa3wKngVblo5my32NCVfsxo6hKHYHIUv44sL a5TGtF+hM03MKHBGHiKz7MNUqN1smMelMp2X3DY0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:message-id:to:subject:from:mime-version :content-type:content-transfer-encoding; s=default; bh=DBoGLzLAv DKI9exGehlTOhVxxKg=; b=dt2nWQYZixunXKr3seG6TzWrieveXwVPCO3S6+1kQ owAbhsg1dQjDVQMzsqqS3oaZTUb57zsW/vNMo57yaf0fkSTUslg5uXS6Pw/N1y6s QywZOd96ske1qM90tTCUpvrsXYx2XkXIJFIUgagCPs/bta7qu423oCLjfUuJLgan Ek= Received: (qmail 26347 invoked by alias); 19 Dec 2014 21:44:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 26325 invoked by uid 89); 19 Dec 2014 21:44:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: shards.monkeyblade.net Date: Fri, 19 Dec 2014 16:43:47 -0500 (EST) Message-Id: <20141219.164347.263036710636056318.davem@davemloft.net> To: libc-alpha@sourceware.org Subject: [COMMITTED PATCH] Fix array bounds warnings in elf_get_dyanmic_info() on sparc with gcc-4.6 From: David Miller Mime-Version: 1.0 Thanks to Carlos for showing me how to handle this kind of issue properly. * get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a link_map->l_info array access. --- ChangeLog | 5 +++++ elf/get-dynamic-info.h | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e15a3cf..f983898 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-12-19 David S. Miller + + * get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a + link_map->l_info array access. + 2014-12-19 Chris Metcalf * math/atest-exp.c (TIMEOUT): Increase timeout to 10 sec. diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h index 20ccf30..3f12e2e 100644 --- a/elf/get-dynamic-info.h +++ b/elf/get-dynamic-info.h @@ -17,6 +17,7 @@ . */ #include +#include #ifndef RESOLVE_MAP static @@ -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)