From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id C208C385E451 for ; Wed, 20 Dec 2023 17:47:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C208C385E451 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C208C385E451 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2610:1c1:1:606c::19:2 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703094449; cv=pass; b=GHhpxUMQfyh8ONcONfYIFl+tqdMiZHN6EaHmtiRMdLMeJweREiWZpz5SsmLvk+LaniaxwTW1qX7uGQTI1NF2O9U2d/Opx8XWgiimOySTqYneO1wQoly+f70TZwfNLlN/prWwhknf7fLPZm5pzPfkACwyptjstHo9TAhzoS4+oCM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703094449; c=relaxed/simple; bh=R+mKzAZf5tIrmx5k7CWK3g7hp/N8YHrFW8+Rx/dCYMw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=MnmVFQ1QQfzVJRHSpMEnFgLlbeD+/XpirA0hjDfFKKENOXTGG5ybsdrDGuR0tGCe9evJMKtja0p6e4S04CIO1Bzu8/QQhXRB2qARhBU3VyHSfpHpFjCYVb3mLSBbJy3uO1SoeLN4h7BOvQi8jsQXgb4pD/Ytoqnf7xSpXWVUpek= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4SwLcF4D5Bz4cw0; Wed, 20 Dec 2023 17:47:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SwLcF3LFTz4tMw; Wed, 20 Dec 2023 17:47:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703094445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rMI5OkO59J8GkR65MwECblv9WuGriAK84DJZqb7EGhE=; b=bgX/lL5dY7Dm2WMRpImiSTTHWtEKFqrDuRJl6GxETuuZ3qPxYYfWNaQCqVrT3LGS48kmjq rgLUC709cp2qqGj9p/r8HJzNxsy1WQBprOIQIklFOS+/w4JwBErpfAUxgy7l489Pi+qbMB cjH+/5jUD8mUauuaVsBxOxBjgdenMbsvP6y1+QxmfbRbh/Gn3F1Kn+POualfnHIPfbbHn6 9Mv/EDnX2+k//q3u/vUKAEgQ5G5ck04u9LbXrgkRzzxPHhtfmos+sBQxMDe77TtF/nURgB do6R77J73Q2X8/687fYWCgW9oXF9covNxuXOQxvwPu24taNMQIy5l5qD4a1yJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703094445; a=rsa-sha256; cv=none; b=jGSAM+VYordU87hMj6PYbvzSk2/7GGrH58q0zxglojx+IBgUmhHuJq0d+PUY+NZ66nUTGt sTNw7rw+PQ6Vj/RXlrbx8QhL4YDgaDvPYBzLMZl3wc2OH1Ncp5fpPuGLJG8eCDxq73y0Mm 0fzfgUzmvcrw03rOlIkEn8V0pRe6d3RthoA4lp0bNyzKi8fuY9z6OVvnNg67giVo7vlv9q i8vF77LBuAG5lWD2Zesi+hZ9YBGMuR/ihTLEBxKlKYgOI5oF874UBUK6SgXFVqw/+QERMs U+kWEoFVfNtu4a8rWf8LBbndEg1nICDI4XHhFICYSEbTP1nBtqHsDYVlZ5gjnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703094445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rMI5OkO59J8GkR65MwECblv9WuGriAK84DJZqb7EGhE=; b=G+hDmo6DznqZck2SVBCBP1jceNbR2kNBYva22XVZXpwZn0KO5/OlWJVVC/VTq9w4S4tAqw C38cETRMF1NOfECRTHwkDLuk00B41d4bgy5/h8nLDfOyzeMdtnh4fJ5Tpjldx6rVJCqdnP OOz0jROFe6FOYpDu5IvJwwL+VnyuJ4as1vxZLnBWk8gSrqIUone6D5SIY8Q/sMMgUDko2e ApIVWn+Ge6egV/DjRWsOJdQOKixxAf2qBXVhozv2QCG8JZX94f668XCJFi7Z5mkPU4s76i 5qIJzP3rcuqKNdmMyTE0rm2P4US5AW9ieOMKfto02q4GMbrrwSh4Q4k2QMdNVA== Received: from [IPV6:2601:644:9381:f410:78bc:f512:b288:d2ba] (unknown [IPv6:2601:644:9381:f410:78bc:f512:b288:d2ba]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4SwLcD741fzjwm; Wed, 20 Dec 2023 17:47:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <6499aee9-3935-41c1-8897-a177f6173e8a@FreeBSD.org> Date: Wed, 20 Dec 2023 09:47:22 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64 To: Rainer Orth , Jan Beulich Cc: binutils@sourceware.org References: Content-Language: en-US From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/20/23 1:12 AM, Rainer Orth wrote: > Jan Beulich writes: > >> On 19.12.2023 23:23, Rainer Orth wrote: >>> Ping? It's been a week: >>> >>> https://sourceware.org/pipermail/binutils/2023-December/131178.html >>> >>> Rainer >> >> Not knowing FreeBSD it's hard to approve a change like this. Specifically, ... > > Unfortunately, there's no listed FreeBSD binutils maintainer. I'm > Cc'ing John Baldwin who actively maintains gdb on FreeBSD. Maybe he can > shed some insight or knows someone else who could. > >>>> GNU ld currently fails to link 32-bit executables on FreeBSD/amd64 when >>>> the linked libraries have dependencies on shared objects themselves: >>>> >>>> $ gcc -m32 -o ei ei.c -lexecinfo >>>> /var/gcc/binutils/amd64/lib/gcc/amd64-pc-freebsd14.0/13.2.0/../../../../amd64-pc-freebsd14.0/bin/ld: >>>> warning: libelf.so.2, needed by /usr/lib/../lib32/libexecinfo.so, not found >>>> (try using -rpath or -rpath-link) >>>> /var/gcc/binutils/amd64/lib/gcc/amd64-pc-freebsd14.0/13.2.0/../../../../amd64-pc-freebsd14.0/bin/ld: >>>> /usr/lib/../lib32/libexecinfo.so: undefined reference to `elf_begin@R1.0' >>>> [...] >>>> >>>> Fixed by handling FreeBSD/amd64 like Linux/x86. >>>> >>>> Tested on amd64-pc-freebsd14.0. >> >> ... it doesn't look implausible that things may have worked on earlier >> versions (or else perhaps someone would have noticed long ago), and that >> hence your change might break things there. > > I'm certain they didn't: I originally developed this patch 4 years ago, > but either forgot to submit it back then or hoped an active member of > the FreeBSD community would. This must have been in the FreeBSD 11 or > 12 timeframe, and obviously nothing has happened/been improved since. FreeBSD has always used /usr/lib and for the "native" ABI and /usr/lib32 for 32-bit ABIs on 64-bit platforms. This includes both i386 on x86-64 as well as 32-bit powerpc on powerpc64 and more recently 32-bit arm (armv7) on aarch64. Given that, I believe the patch to be correct (and it likely applies for powerpc64* using "powerpc" emulation and aarch64* using "armv7" emulation). > My recent forays into FreeBSD have been less than pleasant, > unfortunately: see GCC PR target/112959 (install.tex needs updates on > FreeBSD) for an overview of the issues on the GCC side. It seems the > FreeBSD community either cares little about GCC and binutils these days > (having moved to lld as /usr/bin/ld and clang/clang++), or doesn't > believe in upstream bug reports, let alone submitting patches ;-( This > is not just about GCC/binutils; the same seems to happen on the LLVM > side where they completely ripped out the cmake-based build system and > replaced it with one of their own (based on BSD make). Trying to build > upstream LLVM on FreeBSD is just as unpleasant as GCC. E.g. GCC won't > work with lld (cf. GCC PR target/112745), so you need GNU ld here... While LLVM is the primary toolchain for FreeBSD, GCC is not completely ignored. I maintain a set of ports for GCC packages customized to build FreeBSD's base system. I recently added a new port for GCC 13 for this purpose and can currently build FreeBSD's development trunk (userland + kernel) on x86-64 with both GCC 12 and GCC 13. (Right now GCC 12 is used in a CI job in FreeBSD's CI infrastructure, and the GCC 13 job is being added this week or next.) I do have a couple of patches to GCC I should post upstream (switching i386 to default to -march=i686 in newer versions, and adding a __freebsd_kprintf__ format for the in-kernel printf() function), just haven't done paperwork yet on the GCC side. In regards to the build system, FreeBSD's entire base system builds with a single build infrastructure using make (and always has). For any external tool used in the base, build glue written in make is used. This was true of GCC and binutils when they were part of base as well. -- John Baldwin