Artifacts Associated With Ticket 718de2132f487cf2
Ticket change [93a5a8decd] (rid 212729) by gahr on 2023-04-13 14:19:33:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Over at FreeBSD, I got a bug report regarding Tcl (8.6) not building using the LLVM linker: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270768. TL;DR INSTALL_STRIP_LIBRARY uses strip -x (https://core.tcl-lang.org/tcl/file?ci=3a6e95a25219a787&name=unix/Makefile.in&ln=154), which means we want to strip all non-global symbols, but .L.str.1 is referenced by relocations: # readelf -r tclStubLib.o | grep .L.str.1 000000000000004e 0000000300000002 R_X86_64_PC32 0000000000000031 .L.str.1 - 4 00000000000000f3 0000000300000002 R_X86_64_PC32 0000000000000031 .L.str.1 - 4 0000000000000153 0000000300000002 R_X86_64_PC32 0000000000000031 .L.str.1 - 4 Is -x correct? Can we do without it?
- foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "gahr"
- priority initialized to: "5 Medium"
- private_contact initialized to: "438e59f1f1c891b29d2528ed82d1e629cecc6336"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "gahr"
- subsystem initialized to: "53. Configuration and Build Tools"
- title initialized to: "review use of strip on the stubs library"
- type initialized to: "Bug"
Ticket change [a131d0367e] (rid 212735) by emaste on 2023-04-13 16:09:04:
- icomment:
One small clarification: it is LLVM's strip (aka llvm-readobj) that causes the issue, not the linker. LLVM strip is more strict than GNU strip and ELF Tool Chain strip, both of which silently keep the symbols referenced by relocations. In the FreeBSD experimental ports build using LLVM tools tcl and postgresql are the only significant ports that failed to build due to this issue.
- login: "emaste"
- mimetype: "text/plain"
- icomment:
Ticket change [ccdd5444a0] (rid 212745) by gahr on 2023-04-13 18:20:48:
- icomment:
oops sure, I don’t know where the word linker came from.. probably too many context switches on my side :) thanks!
- login: "gahr"
- mimetype: "text/plain"
- icomment:
Ticket change [94abe97662] (rid 212839) by pooryorick on 2023-04-14 11:53:24:
- assignee changed to: "pooryorick"
- icomment:
"--strip-unneeded" seems to be the right option to provide. Fixed for core-8-6-branch in [ecb8e87a60], for core-8-branch in [39514b5729], and for trunk in [af4865b183].
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
Ticket change [8032e587e3] (rid 212840) by pooryorick on 2023-04-14 11:53:33:
- login: "pooryorick"
- mimetype: "text/plain"
- status changed to: "Pending"
Ticket change [fbce1a74db] (rid 213742) by gahr on 2023-04-24 10:32:34:
- icomment:
So this was reverted in 82baf7827f1412fa. What's the solution going to be?
- login: "gahr"
- mimetype: "text/plain"
- resolution changed to: "None"
- username: "gahr"
- icomment:
Ticket change [ba07c329fb] (rid 213743) by pooryorick on 2023-04-24 11:11:23:
- assignee changed to: "nobody"
- icomment:
I'm unassigning myself from this ticket for now in the hope that someone else will get to this earlier than I can.
- login: "pooryorick"
- mimetype: "text/plain"
Ticket change [bcb272e4f9] (rid 213744) by pooryorick on 2023-04-24 11:29:00:
- icomment:
Since the commit wasn't accepted the solution is going to have to be modification of tcl.m4, configure.ac, and Makefile.in to enable automatic selection of the proper options at build time.
- login: "pooryorick"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [cbee8e18d9] (rid 213745) by emaste on 2023-04-24 12:39:40:
- icomment:
Another option is to just avoid stripping the .a altogether.
- login: "emaste"
- mimetype: "text/plain"
- icomment:
Ticket change [0900e5f958] (rid 213798) by emaste on 2023-04-24 16:53:23:
- icomment:
One other note - there were only two significant ports in the FreeBSD ports collection with this issue, TCL and PostgreSQL. PostgreSQL is now fixed, with the change here: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a14afd3bdc21c0c56401fb8cb2fce74f4b7dc446 They changed -x to --strip-unneeded, but they were already using --strip-uneeded on shared libraries. This is only in the case that strip's -V output includes "GNU strip", so that's how they avoided running into this on Darwin etc. LLVM's strip includes "GNU strip" in its version string: # strip -V llvm-strip, compatible with GNU strip LLVM (http://llvm.org/): LLVM version 15.0.7 Optimized build with assertions. Default target: x86_64-unknown-freebsd14.0 Host CPU: znver2 There seems to be no consensus on stripping .a archives, so it would be good to understand why the strip is there in the first place in order to find the best path forward.
- login: "emaste"
- mimetype: "text/plain"
- icomment:
Ticket change [644143441b] (rid 213809) by pooryorick on 2023-04-24 18:11:05:
- login: "pooryorick"
- mimetype: "text/plain"
- status changed to: "Open"
Ticket change [0f7b48de52] (rid 213845) by gahr on 2023-04-24 19:57:15:
- icomment:
Meanwhile, I patched the Tcl/Tk ports on FreeBSD: https://cgit.freebsd.org/ports/commit/?id=4ef4b555f46b1bddd6600380dbcf0dacb013b95e
- login: "gahr"
- mimetype: "text/plain"
- username: "gaht"
- icomment:
Ticket change [8d11a874b4] (rid 213885) by gahr on 2023-04-26 09:29:50:
- icomment:
I build and installed the current trunk [969b05] with and without -x. libtcl9.0.so is 1.9M with -x and 2.0M without. The static libraries don't change. Perhaps can we get rid of -x altogether?
- login: "gahr"
- mimetype: "text/x-fossil-plain"
- username: "gahr"
- icomment: