From patchwork Tue Jan 24 13:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Khmelevsky X-Patchwork-Id: 47706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2151661wrn; Tue, 24 Jan 2023 05:37:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXur+MJXxL26BdP5/6R3sKtnUEbFI9vPCB6+wrxpN4BVcKJu6cjRx+nodGom+JioLvQ2L5vW X-Received: by 2002:a17:906:8311:b0:84d:4646:1848 with SMTP id j17-20020a170906831100b0084d46461848mr30484116ejx.44.1674567425970; Tue, 24 Jan 2023 05:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674567425; cv=none; d=google.com; s=arc-20160816; b=W5DcDwkPVtSLKYINe1yPsBUPX84VBRn1aXcN6nUTFao2B4E3KlfJdpFKfpo2MHahfi 8kTegwo/UXRwSIUk9Bp+7bsLYfZuw675P/3L9uDEURut+zs/vFUC4OD8Et4ErdkGuf1k nUqAtooHSV6mtxLjrLo4oE4YvDueCuVsjWUzpd5n9KkwcUYV3MIf9s2ox/9jyklvjhio MJKCKFgbhk1anrOm5Sg49WKInu2Iz0VjJKxkEM/vrauyYZDu9i4MgtF+7oHyCQ9fXJOV F5mOmtC+jf8m0qLwQkyOW/am2s2IrnQtbpoEap0t02AbcLOxi6WW0YU7RfA2l2k+W7+E 00Ig== 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=; b=mgOA6pVPVnsz/ZQfOlql8onAn7JLIzWKngAdwq8PHXeVzGVmMCpEk8tJVxFlPGHnT/ boTWK2KELJj2gf4mCy+h73pYVrd4AhsAg9BnkFIaOEoaJGpy3yJa4wf5E2RmrPYGoWo+ wZFOtFqiTnn1rSiuDhLeVoLyTtUnaMLS2Kck1/o4rf3s/i2W/y/zdNbRBY0cP2/2cM0h pfKR+qkiiNwBGElvdcRM4bzrJ1I5U0DbdEazlVRR8F+TRCteihlulgT4zr9ICnyoNZXz sanvbpe9IKqjeMAZGvMcDYXhMcUo6dJ7LB29XGHE3lRSls1XFtSETR99sO0vS0jESPjB ScTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=Chl4+msJ; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id fl23-20020a1709072a9700b0084d44bd6939si2093475ejc.508.2023.01.24.05.37.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 05:37:05 -0800 (PST) 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=Chl4+msJ; 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 789C73858C83 for ; Tue, 24 Jan 2023 13:37:04 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::109]) by sourceware.org (Postfix) with ESMTPS id D815A3858D1E for ; Tue, 24 Jan 2023 13:36:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D815A3858D1E 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 sas8-d2832c3b6ed7.qloud-c.yandex.net (sas8-d2832c3b6ed7.qloud-c.yandex.net [IPv6:2a02:6b8:c1b:2a09:0:640:d283:2c3b]) by forward106j.mail.yandex.net (Yandex) with ESMTP id E06246BD7037; Tue, 24 Jan 2023 16:36:54 +0300 (MSK) Received: by sas8-d2832c3b6ed7.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id paOmVv0eHKo1-1ZN7J1uY; Tue, 24 Jan 2023 16:36:54 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1674567414; bh=a1z8kTMGFr00+8gjtyn7dfkvHBB8bWlQ+QNVJKcdl3c=; h=Message-Id:Date:Cc:Subject:To:From; b=Chl4+msJiaRzmG6spnl0IBzeRYTMT3goVSQj27dLc3LSSUgvLGLb4LBdmTxg+nPFJ S2zYC4h0iUwG7mHb7p+a4paARzIzlWFjZgNIVyQtvap233UdAOLowcakg6Cz9p+cU7 Ii7lC+BpoNbq7lJMy3Gc25NJA6P9DIHcgmcyEdT4= Authentication-Results: sas8-d2832c3b6ed7.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru From: Vladislav Khmelevsky To: binutils@sourceware.org, ccoutant@gmail.com, ikudrin@accesssoftek.com Cc: Vladislav Khmelevsky Subject: [PATCH] Fix emit-relocs for aarch64 gold Date: Tue, 24 Jan 2023 17:36:41 +0400 Message-Id: <20230124133641.258195-1-och95@yandex.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 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, 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: , 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?1755911212939527969?= X-GMAIL-MSGID: =?utf-8?q?1755911212939527969?= 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,