From patchwork Mon Mar 13 10:22:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Khmelevsky X-Patchwork-Id: 68729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1100499wrd; Mon, 13 Mar 2023 03:23:53 -0700 (PDT) X-Google-Smtp-Source: AK7set/ZjyMHyqYij6XHYpi22OVeTSnyp8OI0KS/KivAlViBnVoffowXSw0ukKLxxh5LyRkS79Dj X-Received: by 2002:a17:907:5cb:b0:8b1:3a23:8ec7 with SMTP id wg11-20020a17090705cb00b008b13a238ec7mr42479478ejb.43.1678703032976; Mon, 13 Mar 2023 03:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678703032; cv=none; d=google.com; s=arc-20160816; b=CqmYG2FHQHs0fyPKyv0aOpFLHERSO2+Tfci2eGu/10obriBivZ9Be9bG5giMhQSgPd 1GHB+Bf3V4BuwEam3rl42WQiGLlxyf3L6XS2w5xYKoT09x+jEe71nRkGVtwOfpVnJDhO O1y/Cpcg4e/aRJK4qQiy1BmLADArImPv1Df4u3Bcu+u1rwydW6tX/4fSVusVqHHlM/e1 NAQB/4+GxLhVRHvBrgPmffAajDd+9myOYW7I/qsaa9Uz/1DkKhDK5qhgjpJEqBzxy3EW o9x8toySvmqfibynyu0sh35Trk8ujux9JIL1zQc1I7pJ5ADdEzA2Iwi8R8V8Iq3vPReu Fhxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=a1z8kTMGFr00+8gjtyn7dfkvHBB8bWlQ+QNVJKcdl3c=; b=Eda2HaVyZdtpxO5lvU7vozwpnWVHrZL8q53grG2L14KsOrhVg0MY1X8HuI6DMJMtKk COiOMZEX+rDUwSGRVHffU7UbpUozze9dkZmPtm+7PIoEALx5UUPQbutQNZRBeRuCq/Pa 7UK1Dv9iIbX+Z03XFU586ekyRBAHtk/iG7zIAiB/bZjH+P7elanNxe+Wr8ozsQQ4LhxR bqsTNlNOdypcxGw4AJb7TQtW84FD0X6NpjDev9pFmN8Zlr1sGm0v47vTRHO8rHSb7YnA aErb+R+i9imNqb8lf9fP+mTQZNdHwNPK1/bPj0zKwUaPLMOt2L3bWi1Ip7U6UwYAfr+S sDKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DF8Se5jK; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p15-20020a056402074f00b004fc3cd13b04si3116974edy.111.2023.03.13.03.23.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 03:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DF8Se5jK; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0D0DE3858C5E for ; Mon, 13 Mar 2023 10:23:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D0DE3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678703032; bh=a1z8kTMGFr00+8gjtyn7dfkvHBB8bWlQ+QNVJKcdl3c=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=DF8Se5jKS1681HNTnfCQu2QlvSv6/Q2tZ7t9I6G+MQj+zn/5CHj/9uqkroUZwso1p WzHG2wofNVrshK5WVhkyMTkeeo2yroJivpT7zAIW9eBzts2Sj3DJClvj2BcLnNo7f6 3aEtevGif7Lhvx1xZ0uh8GtK1akDVxpYSOnNnYaE= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by sourceware.org (Postfix) with ESMTPS id D80C73858D32 for ; Mon, 13 Mar 2023 10:23:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D80C73858D32 Received: from sas2-dd6f205a74fe.qloud-c.yandex.net (sas2-dd6f205a74fe.qloud-c.yandex.net [IPv6:2a02:6b8:c08:bc8b:0:640:dd6f:205a]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 1AA4F568E8EB; Mon, 13 Mar 2023 13:22:28 +0300 (MSK) Received: by sas2-dd6f205a74fe.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id OMeoSbgbhiE1-mP5Ro5S8; Mon, 13 Mar 2023 13:22:27 +0300 X-Yandex-Fwd: 1 To: binutils@sourceware.org, ccoutant@gmail.com Cc: Vladislav Khmelevsky Subject: [PATCH] Fix emit-relocs for aarch64 gold Date: Mon, 13 Mar 2023 14:22:16 +0400 Message-Id: <20230313102216.355828-1-och95@yandex.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vladislav Khmelevsky via Binutils From: Vladislav Khmelevsky Reply-To: Vladislav Khmelevsky Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760247711491268398?= X-GMAIL-MSGID: =?utf-8?q?1760247711491268398?= Fix relocation offsets values for the relaxed input sections the same way it was fixed for the sections in PR21430. --- gold/aarch64.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gold/aarch64.cc b/gold/aarch64.cc index 46a278bd466..b199fac2af7 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -2916,6 +2916,7 @@ class Target_aarch64 : public Sized_target Section_id_hash> AArch64_input_section_map; typedef AArch64_insn_utilities Insn_utilities; const static int TCB_SIZE = size / 8 * 2; + static const Address invalid_address = static_cast
(-1); Target_aarch64(const Target::Target_info* info = &aarch64_info) : Sized_target(info), @@ -8286,6 +8287,27 @@ Target_aarch64::relocate_relocs( gold_assert(sh_type == elfcpp::SHT_RELA); + if (offset_in_output_section == this->invalid_address) + { + const Output_relaxed_input_section *poris + = output_section->find_relaxed_input_section (relinfo->object, + relinfo->data_shndx); + if (poris != NULL) + { + Address section_address = poris->address (); + section_size_type section_size = poris->data_size (); + + gold_assert ((section_address >= view_address) + && ((section_address + section_size) + <= (view_address + view_size))); + + off_t offset = section_address - view_address; + view += offset; + view_address += offset; + view_size = section_size; + } + } + gold::relocate_relocs( relinfo, prelocs,