From nobody Fri Oct 18 13:01:13 2024 X-Original-To: dev-commits-src-main@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 4XVPw96RXGz5ZB3n; Fri, 18 Oct 2024 13:01:13 +0000 (UTC) (envelope-from git@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XVPw95ykTz4LH4; Fri, 18 Oct 2024 13:01:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729256473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XOUuaQSTchKZ8W8DYw2gNVoUctoDkqszepgSvhS0kks=; b=Ix+aLYIIhkS8l1iBEAyNpQfMl2ptt/CpIu7Gg4iI7OUoCZzsIMKRXatmRVult5QGSgZwL8 Ik6UNOwmVUDh972otPKMq0nOpGG4bHADwR/yv0xu0nS6hVithKv8xh+B/048Cmlfb0wLft gbOoPE/+NycnhtTiY78Skb2z4Gw5L6tI5ZttQSnn2ojoCO60zb1RASUPvcXUUKlYNt5e5e xzjNYRBhxpCWecAI7Qc6Ipzt1Z0PgGelZVFQ+SUfC0lZnLSVS3E57sjjpU5wCgT2tK1PAu oT1NOFj6lM73I/V8pKwhl4skoAJ8WpRNOUrkau1vUS27ZbQt3WvIBl++RVvggA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729256473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XOUuaQSTchKZ8W8DYw2gNVoUctoDkqszepgSvhS0kks=; b=xvKoR8ZhGuaeLOuHZSQWUPD/2jty9cndL4Q0EybMjvX5BfVfqiNyJPV83XVy/o3ALuGoEh 8zLe/mjNFw810tuBswAjYOUlHgZa2k5m/6tvNldRyeHvYUIb4zrFwQhwaTWZaHXjOr0dg9 Fy8mZKzxKoRuabZ7EZxc04b+yJVAuVQbfVE8jE5kwhK74Au+dGQOXA0vnoS8ucSJDQEh4X Kdri0aEhqlepgv6MuVXxF/IPu3bKZrRX7n1IfJb3/vg8aKQKWD8UfZ0cwiyvpDL0ckiqet eCN5l0skdd9S30rGNK4j26wQMagLmFQn6zPbFHsUbMlfP8OE6XhoUK9i+oTOiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729256473; a=rsa-sha256; cv=none; b=puUKUE/kkyOvi0atps1BhOhVeCDRryz3kWtVqsDPNHIC035O1x5u3CT9oRQI1lTJin5/C6 Thv2IOxwLTczdNAcNnokSuawc1bcVTqFU7D6CranHCuccAZDqrAkeuq/rQFw8zirl3JxDG Y01c4nfFCkCOiYr73qXdtCX8ZJecBcq3ErdqpfZEp7T379MqzvH5mCOpKDCEOj1S8r8FCT zDj4G5TWW7mnKU+ZJUgWPfKAOJbDUEDECNuZUM8yGhttIS1GLxOIRAbxpznL84iqVjIPBl QTzbbQm60gzzLXEHFahpKVCs4je2S6PENxiwmVR0OuMsDXqZTh9U2FJjxVkZ0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4XVPw95Z6kzb5F; Fri, 18 Oct 2024 13:01:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49ID1Do4025359; Fri, 18 Oct 2024 13:01:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49ID1D0s025356; Fri, 18 Oct 2024 13:01:13 GMT (envelope-from git) Date: Fri, 18 Oct 2024 13:01:13 GMT Message-Id: <202410181301.49ID1D0s025356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 7aa6667623be - main - lib/clang: Commit cleaned-up workaround for building on RISC-V List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7aa6667623bef7306009d50a571e5e8c7766a174 Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7aa6667623bef7306009d50a571e5e8c7766a174 commit 7aa6667623bef7306009d50a571e5e8c7766a174 Author: Jessica Clarke AuthorDate: 2024-10-18 12:59:48 +0000 Commit: Jessica Clarke CommitDate: 2024-10-18 12:59:48 +0000 lib/clang: Commit cleaned-up workaround for building on RISC-V There is a long-standing issue on RISC-V around --gc-sections when statically linking, which affects the bootstrap build of LLVM. Since fixing this properly has remained a TODO for years, commit the workaround with documentation so that building natively from source works out of the box. PR: 258358 MFC after: 1 week --- lib/clang/llvm.build.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index 7b16f4485340..2520637e2d06 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -109,6 +109,14 @@ CFLAGS+= -fdata-sections LDFLAGS+= -Wl,-dead_strip .else LDFLAGS+= -Wl,--gc-sections +# XXX: --gc-sections strips the ELF brand note and on RISC-V the OS/ABI ends up +# as NONE, so for statically-linked binaries, i.e. lacking an interpreter, +# get_brandinfo finds nothing and (f)execve fails with ENOEXEC. Work around +# this by manually setting the OS/ABI field via the emulation. +.if ${MACHINE_ARCH:Mriscv64*} != "" && ${NO_SHARED:Uno:tl} != "no" && \ + (${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING)) +LDFLAGS+= -Wl,-m,elf64lriscv_fbsd +.endif .endif CXXSTD?= c++17