From patchwork Sun Jan 22 18:07:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Khmelevsky X-Patchwork-Id: 46985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1250922wrn; Sun, 22 Jan 2023 10:07:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMEPmWgc3Fne4/kVwj1AYIPkLJRV/qtsxdXomF+QPCiDsIm855lQ/82UkL2O8iMES4/1SA X-Received: by 2002:a17:907:d049:b0:840:604:1da1 with SMTP id vb9-20020a170907d04900b0084006041da1mr26285119ejc.61.1674410873239; Sun, 22 Jan 2023 10:07:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674410873; cv=none; d=google.com; s=arc-20160816; b=LT15Kzdoep6m1Alsjo0FbhjwrhGcXLVm1XEtyM0pm15UUurIOWPqP86KgTKmHfk2i9 Wys8BxClF1D6jT8v1O45Ykpt2GBWVhcoYI9PI/F4SQoS++O0OK4XNTzd7F6NTMY9kULd B72l2qS/LQChkD/DUBK/ITEhomzMMCTrAonS45J4pWsktyJZjg07H9AnNJE1uLUEmGNN znqu1vT9Gko7N1RcTDM0xaTiCTcs3eq6uCy40UaiJw18mBMj7OV9i/BWZEv78CwIeBbF +dHpWzFt+0MQZNSH2TlvSEX8wKXWGx9E+ac2swtlh99p93ZUolk++rq0K6J1DcBbcloP 7J5A== 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=BR0Vef77w0UTb/PyJhVkuQ2FN4FFqOIvjlXNaWKFPIM=; b=SQ5It+pBkeCC4rWayIKH6Q4svzn8bCP08xwfTBIFx7b5Lj77dvnGVMwfj120RqtclT xXkQwcKX6y6oBoxMK/O4Bgt2j/8p774/M9OY9MAzPVH4wvXUAjHCgLzC5V88RJZ2Br6N /w4NxytOJ+d3EOoMKVSYdh3jPcHHYPYGdnoFWfM16g//mDd1sQNKPOBS/ztElHFM6VEb uSyBOWjDotfLCCDfoPT3FvjS/q+WKROn4OUMs4wts1z22sGbJdHJgmG/77DiRtsvX3OK Z2DBM1DYwpaPsZ3KWqE0oyrf6gZltlIta3QwpYBbEUFfvE6gJcnAYjgT0PcK2iIWiMGX 16ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=UknUTAVs; 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 hg7-20020a1709072cc700b00869f2ca6a95si34011456ejc.552.2023.01.22.10.07.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Jan 2023 10:07:53 -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=UknUTAVs; 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 CD6CB3858C20 for ; Sun, 22 Jan 2023 18:07:51 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by sourceware.org (Postfix) with ESMTPS id 65C403858D32 for ; Sun, 22 Jan 2023 18:07:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65C403858D32 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 sas1-37da021029ee.qloud-c.yandex.net (sas1-37da021029ee.qloud-c.yandex.net [IPv6:2a02:6b8:c08:1612:0:640:37da:210]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 44C5A4EC859C for ; Sun, 22 Jan 2023 21:07:43 +0300 (MSK) Received: by sas1-37da021029ee.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id e7ulkAvfGCg1-3oQie7wK; Sun, 22 Jan 2023 21:07:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1674410862; bh=BR0Vef77w0UTb/PyJhVkuQ2FN4FFqOIvjlXNaWKFPIM=; h=Message-Id:Date:Cc:Subject:To:From; b=UknUTAVsUgGR38bWQrU+9eo/4lH+n4zNo0sPdCt8wVH87W8RS2sO628xirx5TdQAq UGULzbMT/sHniPZiz8ZJ9TQFFPSLdB0WkocbrsNSPJjm0YTKZtpHmcsz6kXN/NFq4R o2472VVWFRwdHhgzh/mZDBkUvCz8m4zcFpnRlaN4= Authentication-Results: sas1-37da021029ee.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru From: Vladislav Khmelevsky To: binutils@sourceware.org Cc: Vladislav Khmelevsky Subject: [PATCH] objdump: Fix relocations objdumping for specific symbol Date: Sun, 22 Jan 2023 22:07:36 +0400 Message-Id: <20230122180736.55917-1-och95@yandex.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 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: , 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?1755747055756176287?= X-GMAIL-MSGID: =?utf-8?q?1755747055756176287?= If objdump is used with both --disassemble=symbol and --reloc options skip relocations that are belonging to the addresses below the symbol address. --- binutils/objdump.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/binutils/objdump.c b/binutils/objdump.c index 61a18746fde..155461fc3cd 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -3909,6 +3909,13 @@ disassemble_section (bfd *abfd, asection *section, void *inf) { do_print = true; + /* Skip over the relocs belonging to addresses below the + symbol address. */ + const bfd_vma sym_offset = bfd_asymbol_value (sym) - section->vma; + while (rel_pp < rel_ppend && + (*rel_pp)->address - rel_offset < sym_offset) + ++rel_pp; + if (sym->flags & BSF_FUNCTION) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour