From patchwork Sun Apr 23 17:30:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Khmelevsky X-Patchwork-Id: 86786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2297080vqo; Sun, 23 Apr 2023 10:30:40 -0700 (PDT) X-Google-Smtp-Source: AKy350Y7Wgsn8rognm8j7OiMznHuOb5WOijFTSX4BUiYUc5xxzAz9RkHqlxh/7qSjNwEW5zJyCuh X-Received: by 2002:a05:6402:b16:b0:504:ae37:77d0 with SMTP id bm22-20020a0564020b1600b00504ae3777d0mr10932263edb.10.1682271039941; Sun, 23 Apr 2023 10:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682271039; cv=none; d=google.com; s=arc-20160816; b=et1zn32xbLZ37u8SG9uZ/3iOCxQRJXMW8wLeHIs8+Kd7cCWV+Rofh1Td7z+N0ov0ee 9oP0odSoZWZT+nLXO6AQbmAhUf+tJhEkuLxiccxOP8bRTbWEfby5DAFaCNipGQ2+JFJ7 qIJ+MkHCSQDNEm42Obyj++NB1DBLJD2LpJIQ9rNU8Td8h1dYGJuXMP67eckZtsuzyeMx IK0PiD4bcdPO1pjgJKLGKYRyFTbNO6A5Kf/aCUDXLcFjobccUdEI3nC/7oI3AjfOxv2F Zs4I5hDe2ayTNau056iMVg0fUoYKcociVrxNwGy6o7n0ApFOdSn75CVNXc3wuoUjfx3A PTEg== 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=XKCzqNT/PtleM4IYUsr52EmocX+bvQOjN/HASurLILr+v7DeHybkEc6YPQUCtjacKu G246B2d6iuiMUCmD9p6bE5ES1NL+I25aCmZuDcDOZd+wSzXzLnZcGETVULDCUexiweyi MSfTubv5/9HCfvIJdsCEuLCDA2CTaDh3j6yDK5hi5lh0rB83o530tanSpJ4KebA7n+Og EC/gHxF14f51n3+DAFs6YNDaZUPNC0BX06IOeLZs5kzRhlwjAMZLEZZhRmH8DjOOaoPu i46hwN0rMgYSM4xSJ7PCsmn+1gevYOE1w/3/krreHCOvXPKFJplaJaYJzqGFzN0iArni s/vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=UM9WmbP8; 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 bm6-20020a0564020b0600b0050492be1daesi3833062edb.558.2023.04.23.10.30.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 10:30:39 -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=UM9WmbP8; 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 D431A3858C53 for ; Sun, 23 Apr 2023 17:30:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D431A3858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682271038; 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=UM9WmbP8qsbNi9h/rEr5GudJuy1iP4TGMBUxqJbtygRaub3mYDKxjFrIsKwcNX2PG dk5LbkVRq4WV6T/59qWEDS036/kE/XI2k2AHchPaaukeWw3acsHBAqYyJOxwLHcz9M nZ5qtPKdD2vVQan3ezLvDOMOYD/3XjmHcY1md0S0= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from forward100c.mail.yandex.net (forward100c.mail.yandex.net [IPv6:2a02:6b8:c03:500:1:45:d181:d100]) by sourceware.org (Postfix) with ESMTPS id 99F713858C83 for ; Sun, 23 Apr 2023 17:30:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99F713858C83 Received: from mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:519a:0:640:e38c:0]) by forward100c.mail.yandex.net (Yandex) with ESMTP id 69A1C6006A for ; Sun, 23 Apr 2023 20:30:26 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-45.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id NUIkUcWWrSw0-v3XLJWDz; Sun, 23 Apr 2023 20:30:25 +0300 X-Yandex-Fwd: 1 To: binutils@sourceware.org Cc: Vladislav Khmelevsky Subject: [PATCH] Fix emit-relocs for aarch64 gold Date: Sun, 23 Apr 2023 21:30:21 +0400 Message-Id: <20230423173021.582102-1-och95@yandex.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 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, T_SCC_BODY_TEXT_LINE 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?1763989037728562940?= X-GMAIL-MSGID: =?utf-8?q?1763989037728562940?= 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,