From patchwork Mon Sep 18 10:53:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Khmelevsky X-Patchwork-Id: 141352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2563440vqi; Mon, 18 Sep 2023 03:53:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvICFs/xNwR53LN80diz2qpt4E6AC1ISVpY2GJLPvLOJL84vHntEGYLuwMsPG2f68vXAy7 X-Received: by 2002:aa7:dcc6:0:b0:51d:f5bd:5a88 with SMTP id w6-20020aa7dcc6000000b0051df5bd5a88mr7565083edu.38.1695034433961; Mon, 18 Sep 2023 03:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695034433; cv=none; d=google.com; s=arc-20160816; b=WitZkhO7wABLXVP2lsmG67DklHBUVK7eon0BFSV0mGSAdhUancD9WEtVfI9tvaRvkz VbQEw89mwTdmVWU/3za/Al+Nc4uiyvRtt3ROl5/oCafzn3nfV5GNYVR3nBRtd97i/6am AdCIftoL8QyS5apCfC4BnPEWbNtR1VK6b8Qu9e8kjhId2+K7E0gybsVCQYaC6yvE0ePO tVNVIOjxQt5Ua0+h1GicSsJzzszUoI8uium8VRhdMiKqQgPM/6P0CaR2jc+veDnUM5tr dDs8zNoiKu0R+poau/fmo62yBsuH84wYqi9+upspvv+0lWctMgbG5+HRZVEZpnPLNdyY V3uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=a1z8kTMGFr00+8gjtyn7dfkvHBB8bWlQ+QNVJKcdl3c=; fh=1t7OMtASFmRHpQfv+5nSsNO9HbRwCRKAs+CWW7833cg=; b=PWRhCeWq/vRj3BwWkFUVq/W+Fu7qp14JGmywn5l0utUmuWgmhfhLhWYKVwjVzBUk+2 UX4SyLoTxRNjyIiG4PvFdDHkPfUcNWkXn3ZkiyEPoZAWptsFrlMBcBt5bA9MC21D3qyH VG3goj99ryVRnqw86WifrkhL9ilvt7U1VYmSJloYq3e7Q+8RHplcaHuzmfF/+flWtOnc RxzMkvyV8+/0wQMJJ85uMTCjj6PJeSP5/ICsYi2iMPbeuOMM9NUewV++0unX5hsb6lEe woVX15qhcADAoDnAipCZ5lAfeZQW5iiVC90slq92c++B6+/BozDx+dAe2nern7oW9E4Z 92cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=EL6uf9Lt; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y19-20020a056402135300b00530e8a1bc9fsi2967460edw.208.2023.09.18.03.53.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 03:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=EL6uf9Lt; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C81F43857732 for ; Mon, 18 Sep 2023 10:53:51 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from forward101b.mail.yandex.net (forward101b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d101]) by sourceware.org (Postfix) with ESMTPS id 720433858D32 for ; Mon, 18 Sep 2023 10:53:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 720433858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-46.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-46.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:4212:0:640:eaad:0]) by forward101b.mail.yandex.net (Yandex) with ESMTP id 3CAEE60121 for ; Mon, 18 Sep 2023 13:53:42 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-46.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id drhwbd7DceA0-NE0jqnKH; Mon, 18 Sep 2023 13:53:41 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1695034422; bh=a1z8kTMGFr00+8gjtyn7dfkvHBB8bWlQ+QNVJKcdl3c=; h=Message-Id:Date:Cc:Subject:To:From; b=EL6uf9LtjZDqoKp3Go7ZiZczHcnf1m0tNYB0y2eRcY6+D1yvngMyZ+syScYHBgmRh PzlKfloAC+i0HC8xjVEHfbiZ/cKjy67Me4hPt5nlRIobVtCX1Lp2r7P6CFvCqhx6bO 9bVskqY4NN1vZLcGYpdX1H8JKfsOEFkWD9NWx4VY= Authentication-Results: mail-nwsmtp-smtp-production-main-46.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Vladislav Khmelevsky To: binutils@sourceware.org Cc: Vladislav Khmelevsky Subject: [PATCH] Fix emit-relocs for aarch64 gold Date: Mon, 18 Sep 2023 14:53:32 +0400 Message-Id: <20230918105332.2682211-1-och95@yandex.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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_DNSWL_LOW, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777372426405581795 X-GMAIL-MSGID: 1777372426405581795 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,