From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 5EC693858D35 for ; Fri, 5 Nov 2021 06:31:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5EC693858D35 Received: by mail-pj1-x102b.google.com with SMTP id x16-20020a17090a789000b001a69735b339so2718514pjk.5 for ; Thu, 04 Nov 2021 23:31:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=fc7ZORqYI/P9z+Sujmgbo9eXtPlylMWcmZ7iSp5HJcM=; b=DBx05picE9o27zl0E0RqdxXlhYHFr+KI5whIuXS4P3FRePrw67hqxa9dNaP6uTn/f0 T/g8iSwMtdhna5PrrIB30bMP95yBZdyznVG/k4ZDolEv6LIOl9PuU+UJm4WkyS36ksRI opgZ5WKvcIizwKL+oQbFJIkHT4gGYr3QQjgvw7dVLTVPndpY3Ogdf9AAuqDUFstv7XQw mwckWLdIHIHJM4pZ+cZe13EB4RREeWI9l6i12Ces+U6AdD4RzksoY+J2VIAPL/7lscY/ +fQnhuXFiMyJnfPajavuzFoqNaa/xMgGZtPiKZTRgzzJagKw0I9ZiGYgWnY9BFiJQ1CP Dsnw== X-Gm-Message-State: AOAM533INKhQN14FGZbTnpOt0a89KHxMVQPv3w2X4Pwce5PXv2rxLPgr 2Li9bJgSiIvZVO8c7aTAa2e1si2MOpg= X-Google-Smtp-Source: ABdhPJzJhu7uM+autDj8wSBpKIA8QqgtLiBGAH8hJwqaF8syLtLmPCqiw3x9ewfH3zloSBRjxPonVQ== X-Received: by 2002:a17:90b:350b:: with SMTP id ls11mr18519247pjb.227.1636093900525; Thu, 04 Nov 2021 23:31:40 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id s11sm6348092pfd.182.2021.11.04.23.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 23:31:39 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id D2C431140027; Fri, 5 Nov 2021 17:01:36 +1030 (ACDT) Date: Fri, 5 Nov 2021 17:01:36 +1030 From: Alan Modra To: =?utf-8?B?572X5rW3546y?= Cc: binutils@sourceware.org Subject: Re: What types of relocations needed to be saved in the option "-emit-relocs" in ld linker? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-3031.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Fri, 05 Nov 2021 06:31:43 -0000 On Wed, Nov 03, 2021 at 07:02:34PM +0800, 罗海玲 via Binutils wrote: > Hi all, > I’m new of ld linker. And I have a simple problem about ld linker. > What types of relocations needed to be saved in the option "-emit-relocs” > in ld linker? Do all types of relocations need to be saved? --emit-relocs is mostly handled by the generic code. See elflink.c:elf_link_input_bfd after the call to relocate_section, which will copy all relocs from input to output. Some will be zeroed out. Where a backend edits code in some way it may be necessary to edit relocations too, in order for the output relocations to match up with the code. -- Alan Modra Australia Development Lab, IBM