From nobody Wed Mar 02 22:07:50 2022 X-Original-To: dev-commits-src-all@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 BB65C19E695C; Wed, 2 Mar 2022 22:07:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K87XR2Mt8z3hxw; Wed, 2 Mar 2022 22:07:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258871; 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=LotJFTcHvT/5Y0mMSfMR0q2xYQiLvwzQ+Ic8Axqh658=; b=aHZkAMq+wx4SgSVChWs51+7JZmNHoIqfQXv6Oxk+Ho2K0eq8vtZgvnNK7QEIIQ8qSdHczt qtjwQyWqlqCO5rzhs6SQmprTztwXosv6lUpRwdQuhr1Ypge+RC03d4PlkIidHIzHApuPpU 72CMfpo/bisuP5+orDXe2jhlRw1GTxj7Ii2IoUXe3ikzD0xdQnQ5vhz3C/7v13fL4MXSMM Cb0LYlWmLNexILsGSneybwZnkUrBKDfa9ZHSCgk3dpvJtZc5d+VnkdAQSNj+RFH2+C215m yDE1K6Mah/oSnAaSUQ+aQStNswM1+ke59GNlUuyxG2dXd5Cjf9alz9lxc89vYg== 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 0F30A3C20; Wed, 2 Mar 2022 22:07:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 222M7oFi079815; Wed, 2 Mar 2022 22:07:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222M7oY6079814; Wed, 2 Mar 2022 22:07:50 GMT (envelope-from git) Date: Wed, 2 Mar 2022 22:07:50 GMT Message-Id: <202203022207.222M7oY6079814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 2b8ce90daa5b - stable/12 - Apply lld fixes for internal errors building perl on 32-bit PowerPC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2b8ce90daa5b8adcf628b9591480d4e88b576ebe Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646258871; 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=LotJFTcHvT/5Y0mMSfMR0q2xYQiLvwzQ+Ic8Axqh658=; b=gfWOha3L4QpA5gLPL/6kt/A7nlE4yuebK95wgA9Ot4nG4BOq4ls1LhHWZMBtYsqL9yrK3K tIdkcZTFMLVDJ0nLrHtuvg0c8c0tUsLXCkmeDCsanp9lLbR8aQ0bJb/4Yl4dQCUEz9Tl3Y 5mb/vgc54iKHUWBGYhjw3ImYl+LM2F4fi9JZejGn2oaG1j0jsFS9h05J0wjWnaUfCGHu5i V5LswhrF+ypXF9UaugdiSQz0iRwge90rcZ0nYRhNK8ACaqSBdnvYNG3zo09NFy2Aj5QokG cm9l8NeNUoPLxeol/ZahCCBE07D2ZX0c6Ssr/nbDKFQsT+wZ8qaKEnksq4YSdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646258871; a=rsa-sha256; cv=none; b=Ys0c+BQyk5xhSB2C3bAVXVHYk4mtecCRyODhplKyI8J7aU4ghDxqJIh81exr+f+7f4ZyZ6 Jzk7Ar0bSO4QZbvVpMxv/Ek/r8fM+KYO0kiLCVAqxUX8cMBXph3RKIBQzAoh285DPT+tHs RU60P8528n8iVj8t2P5PTxaVJPXenWmi3LH/k6s5sS/bMaLt/6eZZCfeBqgGwsxpfSPO+Q uYdzmfL4dGkYehDCacJXiDZLV+WQRnS5asmMU8MpFrvfEpp+d7Z9Oiyh4Zm5R775IPaqEN fMB2TjHB8NFPdugSDKyr4LiWTPE4PALDInkOI44XB3ZqnakrivzN6f2H86cBew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=2b8ce90daa5b8adcf628b9591480d4e88b576ebe commit 2b8ce90daa5b8adcf628b9591480d4e88b576ebe Author: Dimitry Andric AuthorDate: 2022-02-27 12:53:19 +0000 Commit: Dimitry Andric CommitDate: 2022-03-02 22:07:31 +0000 Apply lld fixes for internal errors building perl on 32-bit PowerPC Merge commit f457863ae345 from llvm git (by Fangrui Song): [ELF] Support REL-format R_AARCH64_NONE relocation -fprofile-use=/-fprofile-sample-use= compiles may produce REL-format .rel.llvm.call-graph-profile even if the prevailing format is RELA on AArch64. Add R_AARCH64_NONE to getImplicitAddend to fix this linker error: ``` ld.lld: error: internal linker error: cannot read addend for relocation R_AARCH64_NONE PLEASE submit a bug report to https://crbug.com and run tools/clang/scripts/process_crashreports.py (only works inside Google) which will upload a report and include the crash backtrace. ``` Merge commit 53fc5d9b9a01 from llvm git (by Fangrui Song): [ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend Similar to f457863ae345d2635026501f5383e0e625869639 Merge commit 767e64fc11d7 from llvm git (by Fangrui Song): [ELF] Support some absolute/PC-relative relocation types for REL format ctfconvert seems to use REL-format `.rel.SUNW_dof` for 32-bit architectures. ``` Binary file usr/ports/lang/perl5.32/work/perl-5.32.1/dtrace_mini.o matches [alfredo.junior@dell-a ~/tmp/llvm-bug]$ readelf -r dtrace_mini.o Relocation section (.rel.SUNW_dof): r_offset r_info r_type st_value st_name 00000184 0000281a R_PPC_REL32 00000000 $dtrace1772974259.Perl_dtrace_probe_load ``` Support R_PPC_REL32 to fix `ld.lld: error: drti.c:(.SUNW_dof+0x4E4): internal linker error: cannot read addend for relocation R_PPC_REL32`. While here, add some common relocation types for AArch64, PPC, and PPC64. We perform minimum tests. Reviewed By: adalava, arichardson Differential Revision: https://reviews.llvm.org/D120535 Requested by: alfredo MFC after: 3 days (cherry picked from commit 298c3e8d6b6405cbea13a7a1a1fbc1ad5a45c378) --- contrib/llvm-project/lld/ELF/Arch/AArch64.cpp | 7 +++++++ contrib/llvm-project/lld/ELF/Arch/PPC.cpp | 15 +++++++++++++++ contrib/llvm-project/lld/ELF/Arch/PPC64.cpp | 17 +++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/contrib/llvm-project/lld/ELF/Arch/AArch64.cpp b/contrib/llvm-project/lld/ELF/Arch/AArch64.cpp index c1ab0e97efe2..0d03617ecf76 100644 --- a/contrib/llvm-project/lld/ELF/Arch/AArch64.cpp +++ b/contrib/llvm-project/lld/ELF/Arch/AArch64.cpp @@ -199,6 +199,13 @@ int64_t AArch64::getImplicitAddend(const uint8_t *buf, RelType type) const { switch (type) { case R_AARCH64_TLSDESC: return read64(buf + 8); + case R_AARCH64_NONE: + return 0; + case R_AARCH64_PREL32: + return SignExtend64<32>(read32(buf)); + case R_AARCH64_ABS64: + case R_AARCH64_PREL64: + return read64(buf); default: internalLinkerError(getErrorLocation(buf), "cannot read addend for relocation " + toString(type)); diff --git a/contrib/llvm-project/lld/ELF/Arch/PPC.cpp b/contrib/llvm-project/lld/ELF/Arch/PPC.cpp index aaecef6ee94f..583cb3afda4c 100644 --- a/contrib/llvm-project/lld/ELF/Arch/PPC.cpp +++ b/contrib/llvm-project/lld/ELF/Arch/PPC.cpp @@ -27,6 +27,7 @@ public: RelExpr getRelExpr(RelType type, const Symbol &s, const uint8_t *loc) const override; RelType getDynRel(RelType type) const override; + int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override; void writeGotHeader(uint8_t *buf) const override; void writePltHeader(uint8_t *buf) const override { llvm_unreachable("should call writePPC32GlinkSection() instead"); @@ -274,6 +275,20 @@ RelType PPC::getDynRel(RelType type) const { return R_PPC_NONE; } +int64_t PPC::getImplicitAddend(const uint8_t *buf, RelType type) const { + switch (type) { + case R_PPC_NONE: + return 0; + case R_PPC_ADDR32: + case R_PPC_REL32: + return SignExtend64<32>(read32(buf)); + default: + internalLinkerError(getErrorLocation(buf), + "cannot read addend for relocation " + toString(type)); + return 0; + } +} + static std::pair fromDTPREL(RelType type, uint64_t val) { uint64_t dtpBiasedVal = val - 0x8000; switch (type) { diff --git a/contrib/llvm-project/lld/ELF/Arch/PPC64.cpp b/contrib/llvm-project/lld/ELF/Arch/PPC64.cpp index a0c2d1617caa..cd626acb8c60 100644 --- a/contrib/llvm-project/lld/ELF/Arch/PPC64.cpp +++ b/contrib/llvm-project/lld/ELF/Arch/PPC64.cpp @@ -369,6 +369,7 @@ public: RelExpr getRelExpr(RelType type, const Symbol &s, const uint8_t *loc) const override; RelType getDynRel(RelType type) const override; + int64_t getImplicitAddend(const uint8_t *buf, RelType type) const override; void writePltHeader(uint8_t *buf) const override; void writePlt(uint8_t *buf, const Symbol &sym, uint64_t pltEntryAddr) const override; @@ -1067,6 +1068,22 @@ RelType PPC64::getDynRel(RelType type) const { return R_PPC64_NONE; } +int64_t PPC64::getImplicitAddend(const uint8_t *buf, RelType type) const { + switch (type) { + case R_PPC64_NONE: + return 0; + case R_PPC64_REL32: + return SignExtend64<32>(read32(buf)); + case R_PPC64_ADDR64: + case R_PPC64_REL64: + return read64(buf); + default: + internalLinkerError(getErrorLocation(buf), + "cannot read addend for relocation " + toString(type)); + return 0; + } +} + void PPC64::writeGotHeader(uint8_t *buf) const { write64(buf, getPPC64TocBase()); }