From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id C9F943858D32 for ; Thu, 25 May 2023 12:29:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9F943858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EF76F21836; Thu, 25 May 2023 12:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1685017784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UxGqXyBu8StOhQINHHQuxjGpEW4YTodByY/Wyrz8NIM=; b=UGjvJL59iOKHmbeW21xcthp27Fpv3ucll9Z9b/wDlQMmD5F1RFoNbSrSCC+76uWPTQUtqb yL2UTiuwajzdFxFn/kyYRPhmvYHlOrMq/ZoEu6+zzNly8bsTP2eLbD6NLqjCY4iroaJQhv Fa1BQroil41YcpIn3fiwJw6YFroht8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1685017784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UxGqXyBu8StOhQINHHQuxjGpEW4YTodByY/Wyrz8NIM=; b=uto3q0ZEO5OnxqNga/0XHNW5CMVdxBK9xbycJ6bqT5B7vadmtjOzoXEaulgfADJm5yN+D+ nnLx9npmKSLjh3Bg== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E3DA42C141; Thu, 25 May 2023 12:29:44 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id B9828661C; Thu, 25 May 2023 12:29:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id B831A6431; Thu, 25 May 2023 12:29:44 +0000 (UTC) Date: Thu, 25 May 2023 12:29:42 +0000 (UTC) From: Michael Matz To: "Richard Earnshaw (lists)" cc: binutils@sourceware.org Subject: Re: [PATCH] PR30437 aarch64: make RELA relocs idempotent In-Reply-To: <1ed54fc8-8ba0-9106-377e-61400af6c00c@arm.com> Message-ID: References: <1ba7b2c7-b489-79af-3f2a-56450c86d955@arm.com> <1ed54fc8-8ba0-9106-377e-61400af6c00c@arm.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: Hello, On Thu, 25 May 2023, Richard Earnshaw (lists) wrote: > Thanks for the detailed explanation. That makes sense, overall. However... > > I didn't think we had separate relocation rules for REL/RELA format > relocs. I know that we recommend RELA for aarch64, but how would an > object file with REL format relocs be handled if src_mask is always > zero? Right now the aarch64 bfd backend only support RELA (elf_backend_may_use_rel_p is off). elf64-mips is an example that supports both, and it has separate howto tables for rel and rela descriptors (e.g. mips_elf64_howto_table_rel and mips_elf64_howto_table_rela), with the appropriate src_mask/partial_inplace settings depending on rel/rela: HOWTO (R_MIPS_32, /* type */ ... true, /* partial_inplace */ 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ vs. HOWTO (R_MIPS_32, /* type */ ... false, /* partial_inplace */ 0, /* src_mask */ 0xffffffff, /* dst_mask */ the rtype_to_howto backend routine appropriately switches between those depending on side-info passed in parameters. (Whereas the name_lookup and type_lookup routines always use the rela tables and contain a FIXME comment to that effect :) ). Various non-mips embedded targets try to also support this, but often only for read-in, not for generating both types of relocs, and so get away with only one howto table. (I believe (!) mips is the only one that actively tries to get REL+RELA support correct). Ciao, Michael.