From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 0C4FA3858C52 for ; Sat, 15 Oct 2022 00:42:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0C4FA3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1036.google.com with SMTP id pq16so6360699pjb.2 for ; Fri, 14 Oct 2022 17:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mqjiheXnbxv4D3LFHg4S59gIw75ByeQ6kTdWXE7hapk=; b=NrsTLSTJZU5NSDWcAOidz3xqvk7bHgUFCN6F236R3rDQMuNDsB/NC4cwTuqmo1p96s Xo1mq4+kNW4Y/Tfq+byQ7zVZvEkm+yBN2/pfLNnXU+deCFd1G4AT6FOg9xW6iTFV0uOQ 2/zW83M2YH1B2wf//TwSW85OEK/0UDFcv6/iakcJAF7MgwyIPFduUs0GVY99QU8/eejw uKYA/5nBuv78g0VVktwlBeTFAa/1D80XkrljjHkKU7BfeVDnOpe8yb2ZuleHo/ufNrM4 0271OJkbUbzrKTfsy0zs2mrQW2KQ2f8neVeRxnpoegS2IYEmh3j6mz/IJJfjcGd+H90Q WSpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mqjiheXnbxv4D3LFHg4S59gIw75ByeQ6kTdWXE7hapk=; b=JBB4/adxGijOSP4Mt0mopUFI21vPOfWyvtD2GIJLvFwnr+C46A7Un7haRdFJAqJtZd kYv+5bBAuevV2rQhTdmtI2vhKw12eThmon6X1kCrus1gu2e6UMhvaKam7AMZl3C5rE/d 6ry2KS3mRdBNUFVmTqcmPlIzyuESfGOjRUOeMGhhrMbqOxbsMYYk/P4vHJRIPzRh6GhY 1Hgr7dMu33Me6iZMK2ZNhovkh2H4VWldsMmUAQyT895U+3NJdSmGcGcSZNGiTb45a9VE KxfCInV+F6caQyD/aHHkKkH5Ydb2I8ebLEVJCIjxZ8JB+2uYXtB/WBOX59bxEqzmva6R 5KGw== X-Gm-Message-State: ACrzQf0IRBonI1p8QyTY9jrK6gJWS0iYBn9rfVe2Gsd/dYIvJII+Sf86 Zw6h/0KOqLmj2AKgwlBLRMk1BQD5GQk= X-Google-Smtp-Source: AMsMyM7xfA/3W6Z7r1g5JU+C+C6hUaYs0W1KczS5Da0UC2RSpo5YAKfxa/kmP9YCbBJkdBVkGDe+PA== X-Received: by 2002:a17:90a:b00a:b0:203:87a3:9e70 with SMTP id x10-20020a17090ab00a00b0020387a39e70mr623870pjq.218.1665794575030; Fri, 14 Oct 2022 17:42:55 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id l14-20020a65560e000000b004411a054d2dsm1978960pgs.82.2022.10.14.17.42.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Oct 2022 17:42:54 -0700 (PDT) Message-ID: Date: Fri, 14 Oct 2022 18:42:49 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] RISC-V: fix linker message when relaxation deletes bytes Content-Language: en-US To: =?UTF-8?Q?Cl=c3=a9ment_Chigot?= , Nelson Chu Cc: binutils@sourceware.org References: <20221006114628.304185-1-chigot@adacore.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,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: On 10/14/22 01:24, Clément 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ément Chigot via Binutils >> wrote: >>> Gentle ping >>> >>> Thanks, >>> Clément >>> >>> On Thu, Oct 6, 2022 at 1:46 PM Clément Chigot wrote: >>>> The section relaxation can delete some bytes resulting in the symbols' >>>> 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. That code is very old and may not have seen many updates through the last 20 years, but it should give you a good idea of how ports have handled this. Jeff