From patchwork Sun Apr 5 11:35:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Sionneau X-Patchwork-Id: 1266529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=sionneau.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=sionneau.net header.i=@sionneau.net header.a=rsa-sha1 header.s=selectormx3 header.b=Y5SXYByp; dkim-atps=neutral Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48wBT40jPBz9sRR for ; Sun, 5 Apr 2020 21:36:23 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id EC9FB101B4; Sun, 5 Apr 2020 13:36:16 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from mx3.sionneau.net (mx3.sionneau.net [163.172.183.177]) by helium.openadk.org (Postfix) with ESMTPS id 9DDE8101AA for ; Sun, 5 Apr 2020 13:36:08 +0200 (CEST) Received: from mx3.sionneau.net (localhost [127.0.0.1]) by mx3.sionneau.net. (OpenSMTPD) with ESMTP id 341c1953 for ; Sun, 5 Apr 2020 11:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=simple; d=sionneau.net; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=selectormx3; bh=ummiDl1CKH8vUEJ7+Oxu8X0Mrws=; b=Y5SXYBypX/0hxhlfngK13gzyBDR9 fieEW1Tj/UH79EPL/yp8WtZFZGcgpSSPBm3o3LHSuMHIKxkR7DSj0gCu12zFj1lG DsR7xIc93+rMXSCwQRGSzf/3Y79T73iZyHvPZCt2O23tybotfqYwsbBBQKJl+yYh C5DKEPwT6EpvxIQ= DomainKey-Signature: a=rsa-sha1; c=simple; d=sionneau.net; h=from:to:cc :subject:date:message-id:in-reply-to:references; q=dns; s= selectormx3; b=vYroASU/Hdvh9SDDJ0g1d9pZZawV9eSsaVpM0BQoqT/U6rMFn TFAY3tmhQHYBPfy7g1sNWZbMleq90paIDmJV30D0PA1upgQNZcqCMRpifgFdW13a +A8EB/HoaXXiHhd9npiGbtl6gWRVFpS5YTB02oiYrV/HV1JPpZKrENMrI8= Received: by mx3.sionneau.net (OpenSMTPD) with ESMTPSA id 09fec91a (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO); Sun, 5 Apr 2020 11:36:06 +0000 (UTC) From: Yann Sionneau To: devel@uclibc-ng.org Date: Sun, 5 Apr 2020 13:35:40 +0200 Message-Id: <20200405113540.25084-5-yann@sionneau.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200405113540.25084-1-yann@sionneau.net> References: <20200405113540.25084-1-yann@sionneau.net> Subject: [uclibc-ng-devel] [PATCH 4/4] tls: make tls tests great again X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" * TLS tests were "empty" because nothing was setting the following variables: * USE_TLS * HAVE___THREAD * HAVE_TLS_MODEL_ATTRIBUTE All toolchains supported by uClibc-ng today do support both NPTL threads and TLS. All ports also define HAVE_TLS_MODEL_ATTRIBUTE except alpha. * 3 tests (tst-tls6 / tst-tls7 / tst-tls8) were peeking into internal/private data structures from libc, which is not possible anymore since libc and tests are now split into 2 git repositories. This commit fixes those 2 issues so that TLS tests can be run again. Signed-off-by: Yann Sionneau --- test/tls/Makefile.in | 6 +++ test/tls/tst-tls6.c | 25 ------------ test/tls/tst-tls7.c | 25 ------------ test/tls/tst-tls8.c | 95 -------------------------------------------- 4 files changed, 6 insertions(+), 145 deletions(-) diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in index 6a6a50e..348fc1c 100644 --- a/test/tls/Makefile.in +++ b/test/tls/Makefile.in @@ -1,6 +1,12 @@ # uClibc-ng TLS tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +CFLAGS += -DUSE_TLS=1 -DHAVE___THREAD=1 -I. + +ifneq ($(ARCH),alpha) +CFLAGS += -DHAVE_TLS_MODEL_ATTRIBUTE=1 +endif + TESTS := tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 \ tst-tls8 tst-tls9 tst-tls10 tst-tls11 tst-tls12 tst-tls13 \ tst-tls14 tst-tls15 tst-tls16 tst-tls17 tst-tls18 tst-tls-at-ctor \ diff --git a/test/tls/tst-tls6.c b/test/tls/tst-tls6.c index 7cc8f6b..b9a5609 100644 --- a/test/tls/tst-tls6.c +++ b/test/tls/tst-tls6.c @@ -26,31 +26,6 @@ do_test (void) exit (1); } - /* Dirty test code here: we peek into a private data structure. - We make sure that the module gets assigned the same ID every - time. The value of the first round is used. */ -#ifdef __UCLIBC__ - if (modid == -1) - modid = ((struct dyn_elf *) h)->dyn->l_tls_modid; - else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid) - { - printf ("round %d: modid now %zu, initially %d\n", - i, - ((struct dyn_elf *)h)->dyn->l_tls_modid, - modid); - result = 1; - } -#else - if (modid == -1) - modid = ((struct link_map *) h)->l_tls_modid; - else if (((struct link_map *) h)->l_tls_modid != modid) - { - printf ("round %d: modid now %zd, initially %d\n", - i, ((struct link_map *) h)->l_tls_modid, modid); - result = 1; - } -#endif - foop = dlsym (h, "foo"); if (foop == NULL) { diff --git a/test/tls/tst-tls7.c b/test/tls/tst-tls7.c index b8bb71d..b0a6d37 100644 --- a/test/tls/tst-tls7.c +++ b/test/tls/tst-tls7.c @@ -24,31 +24,6 @@ do_test (void) exit (1); } - /* Dirty test code here: we peek into a private data structure. - We make sure that the module gets assigned the same ID every - time. The value of the first round is used. */ -#ifdef __UCLIBC__ - if (modid == -1) - modid = ((struct dyn_elf *) h)->dyn->l_tls_modid; - else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid) - { - printf ("round %d: modid now %zu, initially %d\n", - i, - ((struct dyn_elf *)h)->dyn->l_tls_modid, - modid); - result = 1; - } -#else - if (modid == -1) - modid = ((struct link_map *) h)->l_tls_modid; - else if (((struct link_map *) h)->l_tls_modid != (size_t) modid) - { - printf ("round %d: modid now %zu, initially %d\n", - i, ((struct link_map *) h)->l_tls_modid, modid); - result = 1; - } -#endif - fp = dlsym (h, "in_dso2"); if (fp == NULL) { diff --git a/test/tls/tst-tls8.c b/test/tls/tst-tls8.c index 4635304..a723cab 100644 --- a/test/tls/tst-tls8.c +++ b/test/tls/tst-tls8.c @@ -29,31 +29,6 @@ do_test (void) exit (1); } - /* Dirty test code here: we peek into a private data structure. - We make sure that the module gets assigned the same ID every - time. The value of the first round is used. */ -#ifdef __UCLIBC__ - if (modid1 == (size_t) -1) - modid1 = ((struct dyn_elf *) h1)->dyn->l_tls_modid; - else if (((struct dyn_elf *)h1)->dyn->l_tls_modid != (size_t) modid1) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, - ((struct dyn_elf *)h1)->dyn->l_tls_modid, - modid1); - result = 1; - } -#else - if (modid1 == (size_t) -1) - modid1 = ((struct link_map *) h1)->l_tls_modid; - else if (((struct link_map *) h1)->l_tls_modid != modid1) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, ((struct link_map *) h1)->l_tls_modid, modid1); - result = 1; - } -#endif - fp1 = dlsym (h1, "in_dso2"); if (fp1 == NULL) { @@ -72,32 +47,6 @@ do_test (void) exit (1); } - /* Dirty test code here: we peek into a private data structure. - We make sure that the module gets assigned the same ID every - time. The value of the first round is used. */ -#ifdef __UCLIBC__ - if (modid2 == (size_t) -1) - modid2 = ((struct dyn_elf *)h2)->dyn->l_tls_modid; - else if (((struct dyn_elf *)h2)->dyn->l_tls_modid - != (size_t) modid2) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, - ((struct dyn_elf *)h2)->dyn->l_tls_modid, - modid2); - result = 1; - } -#else - if (modid2 == (size_t) -1) - modid2 = ((struct link_map *) h2)->l_tls_modid; - else if (((struct link_map *) h2)->l_tls_modid != modid2) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, ((struct link_map *) h2)->l_tls_modid, modid2); - result = 1; - } -#endif - bazp = dlsym (h2, "baz"); if (bazp == NULL) { @@ -127,28 +76,6 @@ do_test (void) exit (1); } - /* Dirty test code here: we peek into a private data structure. - We make sure that the module gets assigned the same ID every - time. The value of the first round is used. */ -#ifdef __UCLIBC__ - if (((struct dyn_elf *)h1)->dyn->l_tls_modid - != modid1) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, - ((struct dyn_elf *)h1)->dyn->l_tls_modid, - modid1); - result = 1; - } -#else - if (((struct link_map *) h1)->l_tls_modid != modid1) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, ((struct link_map *) h1)->l_tls_modid, modid1); - result = 1; - } -#endif - fp1 = dlsym (h1, "in_dso2"); if (fp1 == NULL) { @@ -167,28 +94,6 @@ do_test (void) exit (1); } - /* Dirty test code here: we peek into a private data structure. - We make sure that the module gets assigned the same ID every - time. The value of the first round is used. */ -#ifdef __UCLIBC__ - if (((struct dyn_elf *)h2)->dyn->l_tls_modid - != modid2) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, - ((struct dyn_elf *)h2)->dyn->l_tls_modid, - modid2); - result = 1; - } -#else - if (((struct link_map *) h2)->l_tls_modid != modid2) - { - printf ("round %d: modid now %zd, initially %zd\n", - i, ((struct link_map *) h2)->l_tls_modid, modid2); - result = 1; - } -#endif - bazp = dlsym (h2, "baz"); if (bazp == NULL) {