From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by sourceware.org (Postfix) with ESMTPS id EFE4F3858C55 for ; Mon, 17 Oct 2022 08:32:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EFE4F3858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-yb1-xb34.google.com with SMTP id e62so12431685yba.6 for ; Mon, 17 Oct 2022 01:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SrdfrwzwnxRzNhHgUpo01wGDA4TtrqkJaL5oRzi15cQ=; b=ixjm956gtv08XTXbvyWMoh7KVzTPH09zIuZAsauvL2jW1zxFigj1mLK6RcyjHm6vIp hM8UP/a4JfRXZtAQVRlu/YBIAGrDu59tItueG+fOPhIpdr8LWno/P8zNeWxIn+mKbl5/ 1g5zjphhF0NIvTwmIkJh2HbQTNgtjgY/8NUa5dsfC3YxY9/h+y4P+xqFrO+xVeu5d+oT sEKrmCuafOOzzivXyYQFOMSUDQu5sl1BSefEZJQwK9j8Wh3D1RGdystu3NRW/fk0p1HN X198lt7LTL7plIuX+nCh64niNdZCGjUwVw7KGUOWafdSmc2M/qwWjc3OTjVKXw5Wgmpk Y8eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SrdfrwzwnxRzNhHgUpo01wGDA4TtrqkJaL5oRzi15cQ=; b=EnIyj4rOm6+LfLlVhaJU2dPyoPdTXg/5YduG2J3hGf9mqrhiIB3A5VCMF987lQrvL9 qX/PWKwv8emMlowxO7vZ016mcJiwF9hBWpUy4YlgI6aaTnVd5y7WSf5dOMu3U53G9sN7 mYvJnS4J/wfZh0yDAFDU/matd0Vuu6LdNzVjT8qid/Pm4Ms9GO2UIG/48B0wsqjkAt5S 0yHpKCwttYgBEeEAX/BgjriM+4U5A5gn6jvHFeBSRT9Tjv1FD1GORpABMhoHpjjcnJV8 G2LO+hU8SVV2wTGStBaPCAkUG995KdX7hRlSWKMjhPeWHzp9vqCQEBuR2tFanGT88vEY pv6g== X-Gm-Message-State: ACrzQf3eRTdgIS7iKwcUQOprQkzD/2vETxVJHK5zIEmJ4RUJrHI2/zeL tQft2VrqaGuB0je1S0B2peANR28bwx1UOK5WdWKc0Q== X-Google-Smtp-Source: AMsMyM6a5FoS3wX85d9PqMwJw3dDMT5k5FEzD/tmbdCxCqTtwAlb6/+nGlE8fUlx8MGq2KpjdfdS0tF/WyKtU3bUPas= X-Received: by 2002:a25:abcc:0:b0:6c1:e5c4:f6fa with SMTP id v70-20020a25abcc000000b006c1e5c4f6famr8189889ybi.306.1665995560446; Mon, 17 Oct 2022 01:32:40 -0700 (PDT) MIME-Version: 1.0 References: <20221006114628.304185-1-chigot@adacore.com> In-Reply-To: From: =?UTF-8?Q?Cl=C3=A9ment_Chigot?= Date: Mon, 17 Oct 2022 10:32:29 +0200 Message-ID: Subject: Re: [PATCH] RISC-V: fix linker message when relaxation deletes bytes To: Jeff Law Cc: Nelson Chu , binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 List-Id: Hi Jeff, On Sat, Oct 15, 2022 at 2:42 AM Jeff Law wrote: > > > On 10/14/22 01:24, Cl=C3=A9ment Chigot via Binutils wrote: > > On Fri, Oct 14, 2022 at 7:08 AM Nelson Chu wrote: > >> Hi, > >> > >> On Thu, Oct 13, 2022 at 8:06 PM Cl=C3=A9ment Chigot via Binutils > >> wrote: > >>> Gentle ping > >>> > >>> Thanks, > >>> Cl=C3=A9ment > >>> > >>> On Thu, Oct 6, 2022 at 1:46 PM Cl=C3=A9ment Chigot wrote: > >>>> The section relaxation can delete some bytes resulting in the symbol= s' > >>>> value being modified. > >>>> As the linker messages retrieve a symbol information using the > >>>> outsymbols field of abfd, it must be updated as well. > >> Interesting, I never noticed this. If this is necessary, then other > >> targets should also update the output symbols when relaxing (nds32 and > >> sh), but it seems like they don't do that as well. > > Yeah, I agree there are probably other targets having a similar issue. > > I don't know at what extend outsymbols is being used for. But the fact > > that is being filled with "untouched" symbols in object files looks > > weird to me. Maybe there is something to look into this direction. > > For now, this patch aims just to fix ld-undefined on Risc-V targets. > > > > > > The target has to adjust the local and global symbols defined in the > relaxed section. I haven't done relaxing in a long time, but the > one I'm most familiar with is the H8. If you look at > elf32_h8_relax_delete_bytes you'll see suitable code to update the local > and global symbols. Yeah, that's what was already done in the Risc-V function: riscv_relax_delete_bytes. However, local and global symbols aren't enough for linker warnings and errors. These ones are using the "outsymbols" BFD field which IIUC is reading the object files directly and thus cannot know about the deleted bytes. So I guess H8 might have the same kind of errors. Are ld-undefined tests succeeding ? Thanks, Cl=C3=A9mebt