From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 14A1A38582A7; Wed, 31 Aug 2022 12:08:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14A1A38582A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661947739; bh=gBeo8AZvmYwcUwTjCXrSU4OqH6bIfHiPUJtc30LOppo=; h=From:To:Subject:Date:From; b=FyGag3CC36NOroToi91xb1irdv6B67eQl/WwYuhStwBMqXEP84IHQfzQkY2n7opsz ysjNK6hMgVZzy1uOLag8hs0gjGHXlWRphJr4tap9KUJ/oKyDzzzLz08+KU2QId1rlh 3uMfVSUvA1TiPdFHAsvHIZZLEw8lXThp5HupZQco= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] elf: Restore how vDSO dependency is printed with LD_TRACE_LOADED_OBJECTS (BZ #29539) X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: 8cd559cf5afe3894f92c2be6f972e1a4e38c56ca X-Git-Newrev: 1e903124cec4492463d075c6c061a2a772db77bf Message-Id: <20220831120859.14A1A38582A7@sourceware.org> Date: Wed, 31 Aug 2022 12:08:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1e903124cec4492463d075c6c061a2a772db77bf commit 1e903124cec4492463d075c6c061a2a772db77bf Author: Adhemerval Zanella Date: Tue Aug 30 13:35:52 2022 -0300 elf: Restore how vDSO dependency is printed with LD_TRACE_LOADED_OBJECTS (BZ #29539) The d7703d3176d225d5743b21811d888619eba39e82 changed how vDSO like dependencies are printed, instead of just the name and address it follows other libraries mode and prints 'name => path'. Unfortunately, this broke some ldd consumer that uses the output to filter out the program's dependencies. For instance CMake bundleutilities module [1], where GetPrequirite uses the regex to filter out 'name => path' [2]. This patch restore the previous way to print just the name and the mapping address. Checked on x86_64-linux-gnu. [1] https://github.com/Kitware/CMake/tree/master/Tests/BundleUtilities [2] https://github.com/Kitware/CMake/blob/master/Modules/GetPrerequisites.cmake#L733 Reviewed-by: Florian Weimer Diff: --- elf/rtld.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elf/rtld.c b/elf/rtld.c index cbbaf4a331..3e771a93d8 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -2122,6 +2122,12 @@ dl_main (const ElfW(Phdr) *phdr, if (l->l_faked) /* The library was not found. */ _dl_printf ("\t%s => not found\n", l->l_libname->name); + else if (strcmp (l->l_libname->name, l->l_name) == 0) + /* Print vDSO like libraries without duplicate name. Some + consumers depend of this format. */ + _dl_printf ("\t%s (0x%0*Zx)\n", l->l_libname->name, + (int) sizeof l->l_map_start * 2, + (size_t) l->l_map_start); else _dl_printf ("\t%s => %s (0x%0*Zx)\n", DSO_FILENAME (l->l_libname->name),