From patchwork Sat Dec 10 20:21:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 704768 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 3tbgW169t5z9snk for ; Sun, 11 Dec 2016 07:22:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="iUIuX4i+"; dkim-atps=neutral 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:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= M9TFgoeyunwfRuGXgDm6r5mx1p08xW9l0fpHrd8PKIVXdknKwAIWLH6wSB1RpVai aa4iued1YzHmJkSQQfwAoE86BGDBQv5KGBRBgWb3Qzot0U9Kj+oSAeQ058RsC7NN e9HVqZTBQnF+QDztjL7Uz/KKWjc/I4+3OdMfUofKWAk= 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:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=RfGYvS 5YaMMoewujkzMqtcfCxKM=; b=iUIuX4i+bBmEkcDkkEfwgsyQNbR5IHcr4z2I94 Cr4jDU5RCsrcQWP+8rdFUqjK/GWIvCEgmNYfhZhT9j9+gzhQf+fu9rnJT4HpQdnL eC3KoU5Ht/pFG+LaEvVOmIqjYFpZtOkBpsZHCRLBrSy98K76bkhXcdscqHfYJDGe OgLVQ= Received: (qmail 49847 invoked by alias); 10 Dec 2016 20:21:56 -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 49831 invoked by uid 89); 10 Dec 2016 20:21:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Switch, 995, 1159 X-HELO: mx1.redhat.com Date: Sat, 10 Dec 2016 21:21:51 +0100 To: libc-alpha@sourceware.org Subject: [PATCH COMMITTED] debug: Additional compiler barriers for backtrace tests [BZ #20956] User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20161210202151.C4AC84022974A@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) The new test framework changed the call stacks. The weak attribute acts as a strong compiler barrier. Some static functions had to be declared extern as a consequence. 2016-12-10 Florian Weimer [BZ #20956] * debug/tst-backtrace.h (NO_INLINE): Add noclone, weak attributes as additional compiler barriers. * debug/tst-backtrace2.c: Switch to . (fn2, do_test): Declare with external linkage. * debug/tst-backtrace3.c: Switch to . (do_test): Declare with external linkage. * debug/tst-backtrace4.c: Switch to . (do_test): Declare with external linkage. * debug/tst-backtrace5.c: Switch to . (do_test): Declare with external linkage. diff --git a/debug/tst-backtrace.h b/debug/tst-backtrace.h index 1a53048..6a4b200 100644 --- a/debug/tst-backtrace.h +++ b/debug/tst-backtrace.h @@ -33,7 +33,7 @@ volatile int x; /* Use this attribute to prevent inlining, so that all expected frames are present. */ -#define NO_INLINE __attribute__ ((noinline)) +#define NO_INLINE __attribute__ ((noinline, noclone, weak)) /* Look for a match in SYM from backtrace_symbols to NAME, a fragment of a function name. Ignore the filename before '(', but presume diff --git a/debug/tst-backtrace2.c b/debug/tst-backtrace2.c index d139c10..4224b55 100644 --- a/debug/tst-backtrace2.c +++ b/debug/tst-backtrace2.c @@ -24,10 +24,6 @@ #include "tst-backtrace.h" -static int do_test (void); -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" - /* The backtrace should include at least f1, f2, f3, and do_test. */ #define NUM_FUNCTIONS 4 @@ -75,7 +71,7 @@ fn1 (void) check do_test. */ } -NO_INLINE static int +NO_INLINE int fn2 (void) { fn1 (); @@ -91,7 +87,7 @@ fn3 (void) return x; } -NO_INLINE static int +NO_INLINE int do_test (void) { /* Test BZ #18084. */ @@ -103,3 +99,5 @@ do_test (void) fn3 (); return ret; } + +#include diff --git a/debug/tst-backtrace3.c b/debug/tst-backtrace3.c index 74514d7..f3135f2 100644 --- a/debug/tst-backtrace3.c +++ b/debug/tst-backtrace3.c @@ -24,10 +24,6 @@ #include "tst-backtrace.h" -static int do_test (void); -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" - /* The backtrace should include at least 3 * fn, and do_test. */ #define NUM_FUNCTIONS 4 @@ -75,9 +71,11 @@ fn (int c) return x; } -NO_INLINE static int +NO_INLINE int do_test (void) { fn (2); return ret; } + +#include diff --git a/debug/tst-backtrace4.c b/debug/tst-backtrace4.c index 965e6bd..db2be10 100644 --- a/debug/tst-backtrace4.c +++ b/debug/tst-backtrace4.c @@ -27,10 +27,6 @@ #include "tst-backtrace.h" -static int do_test (void); -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" - /* The backtrace should include at least handle_signal, a signal trampoline, 3 * fn, and do_test. */ #define NUM_FUNCTIONS 6 @@ -115,9 +111,11 @@ fn (int c) return 0; } -NO_INLINE static int +NO_INLINE int do_test (void) { fn (2); return ret; } + +#include diff --git a/debug/tst-backtrace5.c b/debug/tst-backtrace5.c index c049bca..a6ed474 100644 --- a/debug/tst-backtrace5.c +++ b/debug/tst-backtrace5.c @@ -32,10 +32,6 @@ # define SIGACTION_FLAGS 0 #endif -static int do_test (void); -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" - /* The backtrace should include at least handle_signal, a signal trampoline, read, 3 * fn, and do_test. */ #define NUM_FUNCTIONS 7 @@ -133,9 +129,11 @@ fn (int c, int flags) return 0; } -NO_INLINE static int +NO_INLINE int do_test (void) { fn (2, SIGACTION_FLAGS); return ret; } + +#include