From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by sourceware.org (Postfix) with ESMTPS id 103A53853561 for ; Thu, 20 Oct 2022 07:20:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 103A53853561 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-xb2f.google.com with SMTP id l145so4066771ybl.0 for ; Thu, 20 Oct 2022 00:20:35 -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=dviacJdp3Z2MJfL6m8BzmEotpRPchhEka0g5yEb9bqg=; b=fYSuJteRRCmLhWbDud5isJIwCZOZWZaDDcxAzHoqlbqL5o7QR6ma1QMmUUZ5i0zRRj ALrJiSXFNCuU/7XpvVWEpplcEJnegfuQNiTtuJdOE0VWjwE1vMM62VMQCO2xH90hi37/ MhX+ehYnabmNQBg063Esxr1x7EDBvK3Es6Z8KHURIYvpSAdSBph5KBsHgG69X0bwLpw4 Kdi1XLYe0vk/Ei4KmmoVsFg9Bk7y362UrJMyu1L4T6+kpTdyoltv1+vTmBYBT1dnzRf0 GOqQygg8SOG7AVyro6ya5+B2tPvuoIpPgQGIqhCw5l+nDb+QcGBtURApAagV7Gfi2/Uw rrEg== 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=dviacJdp3Z2MJfL6m8BzmEotpRPchhEka0g5yEb9bqg=; b=PwXGZTszpjaqFcWImSLvL5KwU/5YiTTkhI/QkbHQ7OBxg24yzIouK+tjBi1XSgo5wf rQlfX4+yqU8gRull9sw+mnM+ZyCX/QhpahkPanA7q250NGgvgL63dL8cHW9e9X/H7WLt BF7YYwosb8IGTDIdsrw0mgzMtZhzK+DpvFfdMY9xH5CWBg1anfHPHXdpTJOQk9sCGg/Y FsQULM5/N/huoDbudvNFtwTVWyOksHxkHQxETIkpWoZprXXB/psxK0mil0GUbl7Ep21m wdOschc65i0WwZS98+ppquFBxF8TVehrdwHpVx1mVM+uzEuT8EpmN+Yp6nNZ2oLinupJ ZP8Q== X-Gm-Message-State: ACrzQf2F9bShAKibUucivJtBuG6quJy4HICO4kV2q9pgLPLL1imRr0Yq gRAdtxG6P5MICNEryi6jXbTD8Yr4QJCKhkuco3gKlgPoPAb+0Q== X-Google-Smtp-Source: AMsMyM6MB5MYZoaqriUqEVCgcvMcmKmUAfEw2PcBHpbA7NT4HNHLzDSCR4Ytl8pGIaQvoF4M9LtgPIE+lT1URc9efQg= X-Received: by 2002:a25:7795:0:b0:6c9:e426:7984 with SMTP id s143-20020a257795000000b006c9e4267984mr5063202ybc.306.1666250434472; Thu, 20 Oct 2022 00:20:34 -0700 (PDT) MIME-Version: 1.0 References: <20221006114628.304185-1-chigot@adacore.com> <5d1faf3a-f33b-f3db-4fc7-36bc4419f49d@gmail.com> In-Reply-To: <5d1faf3a-f33b-f3db-4fc7-36bc4419f49d@gmail.com> From: =?UTF-8?Q?Cl=C3=A9ment_Chigot?= Date: Thu, 20 Oct 2022 09:20:23 +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=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,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 Wed, Oct 19, 2022 at 7:38 PM Jeff Law wrote: > > > On 10/17/22 02:32, Cl=C3=A9ment Chigot wrote: > > > > 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. > > But if you're getting the outsymbols for the output bfd, then they > should have the right address. If they don't, then the symbol table in > the output file is going to be wrong. And changing the local/global > symbols when relaxing should directly influence the outsymbols for the > output bfd. For Risc-V, it seems that outsymbols aren't needed for the output file symbol table. I've tried with different programs, bfd_get_outsymbols seems to be reached only when an error has to be displayed. > > So I guess H8 might have the same kind of errors. Are ld-undefined > > tests succeeding ? > > Which test specifically? None are failing, but some are > UNTESTED/UNSUPPORTED: > > > UNSUPPORTED: -shared --entry foo archive > UNSUPPORTED: -shared --entry foo -u foo archive > UNTESTED: undefined > UNTESTED: undefined function > UNTESTED: undefined line > UNSUPPORTED: undefined symbols in shared lib > UNSUPPORTED: weak undefined function symbols in shared lib > > > Do I need to turn on relaxing by default to see this issue (unlike > riscv, h8 does not enable relaxing by default). Hum, I guess they are probably disabled because you haven't a compiler available for H8 or at least it's not properly set up for the testsuites. The way I'm enabling them is by passing a "board" to DejaGNU (see [1]). This board will have the correct CFLAGS and LDFLAGS. | set_board_info ldflags "${CFLAGS}" | set_board_info ldflags "${LDFLAGS}" | set_currtarget_info ldflags "${CFLAGS}" | set_currtarget_info ldflags "${LDFLAGS}" Note that I stated in a recent patch improving the support for LDFLAGS, I'm not sure why both set_board and set_currtarget are needed. But I do need both to make it work. [1] https://www.gnu.org/software/dejagnu/manual/Adding-a-new-board.html [2] https://sourceware.org/pipermail/binutils/2022-October/123314.html