From nobody Sun Sep 12 19:46:06 2021 X-Original-To: ports-bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AB29617C4B0F for ; Sun, 12 Sep 2021 19:46:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H70Tp4LyQz3PJw for ; Sun, 12 Sep 2021 19:46:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B1DA19954 for ; Sun, 12 Sep 2021 19:46:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 18CJk6Fx063111 for ; Sun, 12 Sep 2021 19:46:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 18CJk6rP063110 for ports-bugs@FreeBSD.org; Sun, 12 Sep 2021 19:46:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 258463] x11/libwacom: Fix build with clang/lld 13 Date: Sun, 12 Sep 2021 19:46:06 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: dim@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: x11@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Ports bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-ports-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports-bugs@freebsd.org X-BeenThere: freebsd-ports-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258463 Bug ID: 258463 Summary: x11/libwacom: Fix build with clang/lld 13 Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: x11@FreeBSD.org Reporter: dim@FreeBSD.org Assignee: x11@FreeBSD.org Flags: maintainer-feedback?(x11@FreeBSD.org) Though x11/libwacom was not yet built during the exp-run for clang/llvm 13 = (see bug 258209), due to some other dependencies not being available yet, I noti= ced that it failed to build with clang 13, or more specifically this is due to a behavior change in lld 13: ... [ 33% 10/30] cc -o generate-hwdb generate-hwdb.p/tools_generate-hwdb.c.o -Wl,--as-needed -Wl,--no-undefined -fstack-protector-strong -O2 -pipe -g -fstack-protector-strong -fno-strict-aliasing '-Wl,-rpath,$ORIGIN/' -Wl,-rpath-link,/wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/_bu= ild/ -Wl,--start-group libwacom.so.2.6.1 /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so -Wl,--end-group [ 36% 11/30] /usr/local/bin/meson --internal exe --capture 65-libwacom.hw= db -- /wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/_build/generate-= hwdb FAILED: 65-libwacom.hwdb /usr/local/bin/meson --internal exe --capture 65-libwacom.hwdb -- /wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/_build/generate-hwdb --- stderr --- Unfortunately the meson build process doesn't really show you why it failed, but it turns out that running the 'generate-hwdb' command segfaults: Starting program: /wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/_build/generate-hwdb Program received signal SIGSEGV, Segmentation fault. libwacom_add_match (device=3Ddevice@entry=3D0x801031320, newmatch=3D0x0) = at ../libwacom/libwacom.c:943 943 device->matches[device->nmatches - 1] =3D libwacom_match_ref(newmatch); (gdb) bt #0 libwacom_add_match (device=3Ddevice@entry=3D0x801031320, newmatch=3D0= x0) at ../libwacom/libwacom.c:943 #1 0x000000080024fc7d in libwacom_matchstr_to_match (device=3Ddevice@entry=3D0x801031320, matchstr=3D) at ../libwacom/libwacom-database.c:207 #2 0x000000080024e313 in libwacom_parse_tablet_keyfile (db=3D0x8010365a0, datadir=3D0x200b70 "/wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/data", filename=3D) at ../libwacom/libwacom-database.c:652 #3 load_tablet_files (db=3D0x8010365a0, datadir=3D0x200b70 "/wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/data") at ../libwacom/libwacom-database.c:865 #4 libwacom_database_new_for_path (datadir=3D0x200b70 "/wrkdirs/share/dim/ports/x11/libwacom/work/libwacom-1.5/data") at ../libwacom/libwacom-database.c:959 #5 0x00000000002021b6 in main (argc=3D, argv=3D0x80103663= 0) at ../tools/generate-hwdb.c:131 What happens is that an internal function 'libwacom_match_new' is supposed = to be called, which returns a new 'WacomMatch' object. But instead, it calls a empty stub which returns NULL, resulting in this segfault. The empty stub w= as added as a rather nasty upstream hack to "Alias the accidentally exposed ABI into different functions", in https://github.com/linuxwacom/libwacom/commit/b9961dbe912fa096230460b194eeb= dc8a590d256: > A special "trick" is used here to hide the ABI from new versions: > Usually when defining multiple versioned symbols, one would define one as= the > default one with @@ > .symver _foo1,foo@VERSION1 > .symver _foo2,foo@@version2 <-- default one > By leaving out the default one, ld doesn't know which one to link to and > fails with an unresolved symbol. rtld however can still figure it out, so > anything compiled will continue to work. This way we can make a symbol > disappear from the library for new builds but have old builds continue to > work with the new version. Unfortunately this trick/hack does not work anymore with lld 13, since https://github.com/llvm/llvm-project/commit/66d44304921, ("[ELF] Combine fo= o@v1 and foo with the same versionId if both are defined "). The idea behind the hack is to have the linker call the 'real' libwacom_match_new function when= ever it is called from inside the library itself, but any external callers get t= he stubbed version which doesn't really do anything. I think libwacom should have used a different approach here, but just renam= ing those accidentally exposed internal functions to something different. Then = the tricks with .symver are completely unnecessary. Here I added a patch that i= s as simple as possible, which adds #defines for two affected functions in libwacomint.h, renaming then from 'libwacom_xxx' to 'libwacom_internal_xxx'. This does not affect the corresponding exposed functions in the libwacom.so, and makes the 'generate-hwdb' command work OK again. I also ran the complete libwacom test suite, including the deprecated functions test, and it works fine. --=20 You are receiving this mail because: You are the assignee for the bug.=