From patchwork Tue Apr 30 19:18:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 163159 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp3628175ill; Tue, 30 Apr 2019 12:18:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/A5iHfds/1DGxKygdWh+bkIQdldt8cGpwMAGyaxCsgBufg3LSbFSIGvH8xcwjoVCWYTa9 X-Received: by 2002:a62:2b43:: with SMTP id r64mr38100917pfr.210.1556651930134; Tue, 30 Apr 2019 12:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556651930; cv=none; d=google.com; s=arc-20160816; b=UzPT1b7cfNqbWPFSaZu+xrNHZ0sdGRgS45FT/C14NS1ac5bET/+btU4he+g1WLOl4i sGhDs+gHnNf/LoD3PLf0Tv7m8PX5b7DK05rLZyrsmq7oKA0z/BK0W1uL8/w27wVNNI9P MNXxNf6xnmcwk5kxQzNyIgW2g3gzgaUam43hEif4lto6sMb/AgESLxFFZnrknPZ/28IZ zAo0KmaEAyYpzllQDdOrXDsC5sKQcRQZ/Zv3u6ooKWi0MDovFUMiJJ/hpa4CH7K7GEFk aSM4H8HX69Lub63D5en1siFR3rVlg3bFovdM8g1gBpk2tvNo8dYDxskaqHfyt0Q7rlV4 l00w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=mEd7oEKfacJzS33hhjxnQhin76J/pOQNVh5x4VEtbTE=; b=qIBJoxPBqqm/DQOpi92VWwprgYTp3KLXTeD1X88srhEa0dik+xfYcp37+widnJElAM iNC8fWzjVQM/T7JQkQYfJjuwkxtGflKia2/jI8N5FoZEBuQAxSfO00SYYQqn9WuTUTMD PtoQhCLjgntv/HHRv5xg9AsEXfv1qIabeFZUm+4yJUFq2dS2Twnb7hmvFOD2kRfSRn1d Bg3q6QCYNHIAnZ/e2OuZMF66WZF764GCD8G/c/Aw7NRoXYZEUQePtChV3r24JFHw/+mS T0PEfJapyBmSJKKXVXWNV3Q7ENmODCDyHyRgA6gVvG9BAP8DXsKsJ7xmzaOn/WzAjQIP 1Jjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=owKxFT1+; dkim=pass header.i=@linaro.org header.s=google header.b=Gy4D9BOB; spf=pass (google.com: domain of libc-alpha-return-101677-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101677-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c12si35371641pgq.390.2019.04.30.12.18.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 12:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-101677-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=owKxFT1+; dkim=pass header.i=@linaro.org header.s=google header.b=Gy4D9BOB; spf=pass (google.com: domain of libc-alpha-return-101677-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-101677-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=aOifI/41A4hmRrQXNdzHLzSZ1cseVLgU3nxxJS3dbwHrg+MGEUprF GiftKzuVqQZ4nRomwRlEedkMfBtX3M1EdgOCExUWXi4ZsEC0EjcC6SzCIa812F1K wGmNeenlEaJjURIyvQ9BVQRKbJN2Jz2g27DsJ+zGC8kM4dX1ZedsjY= 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:from:to:subject:date:message-id; s=default; bh=oTzB64dkEHrkGaayMdU9CzpZa7c=; b=owKxFT1+Ti9Dl0Qd9gZYfA4iAs0j XJ8iVp7dsZsbigWk8+rW0O7HBmRFfdaE6h61j9i1XYptHAGtWqKPaGVXNR8kT7lS /91OpsdPjF5V4gO8kEy+LMs/h2VPq5zK99kAWqTwthzjiUUt1r1b3DwpsvBq05sV HmLrirPJ3L8uJ9g= Received: (qmail 48198 invoked by alias); 30 Apr 2019 19:18:41 -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 48190 invoked by uid 89); 30 Apr 2019 19:18:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-vs1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=mEd7oEKfacJzS33hhjxnQhin76J/pOQNVh5x4VEtbTE=; b=Gy4D9BOBmalweEkyALWubC6lmAgjdgKOIBgRuedGbw2Lbo66VpUXe3OamkxaGTwEBM 5CUH/rupg2wne1Wu39BzNVaw6NRDjEgZZWyEKV0I1k1+ehdUTXaBWzgooGz/Nn7rrRBa O7vehrPYorylTV0TYBqjc7pyxT2V0zDVftD6t1rqetsgLlUAdLkeT8aSKiugC1rNoKtN lBXbH61sZw5fcQ1wFBMjJfGn8fxHFHo2wv3ROEJEVpBGr392x3PUkgM9mZ5uOQSKSc3Y R1iQePnZ5Ppvz0WmbczyhQm1aqF+r2EFILV0QYvtjGyNXapvJBJUPIdwQ74sNUTkksWM 5evA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] elf: Fix elf/tst-pldd with --enable-hardcoded-path-in-tests (BZ#24506) Date: Tue, 30 Apr 2019 16:18:34 -0300 Message-Id: <20190430191834.19003-1-adhemerval.zanella@linaro.org> Although test-container does support --enable-hardcoded-path-in-tests, the resulting library names obtained with pldd will have the 'vanilla' names of 'ld.so' and 'libc.so' instead of the installed ABI names (ld-linux-x86-64.so.2 for instance on x86_64). The patch adds the default names as one possible option. Checked on x86_64-linux-gnu (built with and without --enable-hardcoded-path-in-tests) and i686-linux-gnu. * elf/tst-pldd.c (in_str_list): New function. (do_test): Add default names for ld and libc as one option. --- elf/tst-pldd.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) -- 2.17.1 Reviewed-by: Carlos O'Donell diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c index ed19cedd05..2a9f58936f 100644 --- a/elf/tst-pldd.c +++ b/elf/tst-pldd.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -39,6 +38,15 @@ target_process (void *arg) /* The test runs in a container because pldd does not support tracing a binary started by the loader iself (as with testrun.sh). */ +static bool +in_str_list (const char *libname, const char *const strlist[]) +{ + for (const char *const *str = strlist; *str != NULL; str++) + if (strcmp (libname, *str) == 0) + return true; + return false; +} + static int do_test (void) { @@ -89,14 +97,20 @@ do_test (void) if (buffer[strlen(buffer)-1] == '\n') buffer[strlen(buffer)-1] = '\0'; - if (strcmp (basename (buffer), LD_SO) == 0) + const char *libname = basename (buffer); + + /* It checks for default names in case of build configure with + --enable-hardcoded-path-in-tests (BZ #24506). */ + if (in_str_list (libname, + (const char *const []) { "ld.so", LD_SO, NULL })) { TEST_COMPARE (interpreter_found, false); interpreter_found = true; continue; } - if (strcmp (basename (buffer), LIBC_SO) == 0) + if (in_str_list (libname, + (const char *const []) { "libc.so", LIBC_SO, NULL })) { TEST_COMPARE (libc_found, false); libc_found = true;