public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug build/29456] missing DT_HASH section in shared objects Date: Mon, 08 Aug 2022 15:29:29 +0000 [thread overview] Message-ID: <bug-29456-131-DiCjVcVeZB@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-29456-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=29456 --- Comment #9 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> --- (In reply to Arkadiusz Hiler from comment #8) > (In reply to Florian Weimer from comment #6) > > > Do you know why distros do this? > > > > sysv hashing is much slower for symbol binding because we have to do a > > strcmp even on lookup failure. The Bloom filter is missing, too. Once the > > glibc dynamic linker supported it, I think distributions really wanted to > > use it, even if binutils and GCC defaults had not caught up at that point > > yet. It fixes real issues around startup performance. > > I've read through both algorithms and seen the benchmarks / original > discussion around the new hash algorithm. The new one is unquestionably > superior. > > I don't understand why people forced "gnu" instead of "both" though. > From my point of view, as an outsider, it looks like people hopped on the > feature a bit early overriding upstream defaults and it has stuck. > > If they would not have carried over `--with-linker-hash-style=gnu` from > that era we would respect linker's default, which is both for The GNU > Linker. > > As far as I understand there's small size increase and no real performance > penalty caused by having both. > > This is mostly besides the point though and doesn't affect the perceived > breakage, but I appreciate having the historical context. It was done as size optimization from perceived unused features since DT_GNU_HASH is being used as a default on most distros for a long time. On libc.so for x86_64, I see: * with -Wl,--hash-style=both $ size libc.so text data bss dec hex filename 1992171 20320 55120 2067611 1f8c9b libc.so * with -Wl,--hash-style=gnu text data bss dec hex filename 1975923 20304 55120 2051347 1f4d13 libc.so Roughly 1%, which is considerable for an unused feature. > > (In reply to Adhemerval Zanella from comment #7) > > Right, however, I am not sure this characterize as an ABI break since the > > symbol lookup information would be indeed provided (albeit in a different > > format). And it should be transparent to most applications as well since > > symbol resolution is done by the loader itself. > > The glibc loader is not the only thing that can do symbol resolution, and > software that ships with distros is not the only software out there. > Changing the section name and the format is significant. All the historical > software that uses old version of dlsym() that's linked in to use pthreads > would break. But we do not really support loading two different C runtime environments (for instance having libc.so with different versions in a different namespace), nor loading libc.so by a different executable (for instance dlsym libc.so from a different C runtime implementation), and static dlopen is being deprecated (meaning that eventually, we will phase out its support, besides the already know issues). And dlopen libphtread will still work since we continue to provide a stub libpthread.so. Are you aware of an issue with the current scheme? So it does not make much sense to enforce DT_HASH on libc.so, especially if users do want to do symbol resolution it is still provided by DT_GNU_HASH. The glibc build now uses the default set by binutils, so maybe one option is to enforce -Wl,--hash-style=both as distro level if this is really a compatibility issue (since it might not be specific to glibc shared objects). -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2022-08-08 15:29 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-08 9:10 [Bug build/29456] New: " arek at hiler dot eu 2022-08-08 9:39 ` [Bug build/29456] " mikhail.v.gavrilov at gmail dot com 2022-08-08 10:45 ` fweimer at redhat dot com 2022-08-08 11:33 ` arek at hiler dot eu 2022-08-08 12:01 ` fweimer at redhat dot com 2022-08-08 12:43 ` adhemerval.zanella at linaro dot org 2022-08-08 14:34 ` arek at hiler dot eu 2022-08-08 14:45 ` fweimer at redhat dot com 2022-08-08 14:49 ` adhemerval.zanella at linaro dot org 2022-08-08 15:08 ` arek at hiler dot eu 2022-08-08 15:29 ` adhemerval.zanella at linaro dot org [this message] 2022-08-08 16:49 ` arek at hiler dot eu 2022-08-08 17:13 ` adhemerval.zanella at linaro dot org 2022-08-08 17:32 ` adhemerval.zanella at linaro dot org 2022-08-08 19:58 ` sam at gentoo dot org 2022-08-08 19:58 ` sam at gentoo dot org 2022-08-09 16:12 ` freswa at archlinux dot org 2022-08-12 7:46 ` arek at hiler dot eu 2022-08-12 13:17 ` adhemerval.zanella at linaro dot org 2022-08-14 21:33 ` hi-angel at yandex dot ru 2022-08-24 4:12 ` i at maskray dot me 2022-08-24 8:28 ` rguenth at gcc dot gnu.org 2022-08-24 8:56 ` fweimer at redhat dot com 2022-08-24 8:57 ` mliska at suse dot cz 2023-08-11 15:40 ` es20490446e at gmail dot com 2023-08-11 15:58 ` carlos at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29456-131-DiCjVcVeZB@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).