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 76F323858D39 for ; Fri, 4 Mar 2022 16:05:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 76F323858D39 Received: by mail-pj1-x1036.google.com with SMTP id mr24-20020a17090b239800b001bf0a375440so5597831pjb.4 for ; Fri, 04 Mar 2022 08:05:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H8PyrSaKHICLwOSOX/BFVqYfwRNNu9O+jx//KTCgIPA=; b=4Q9iyNvS20Egr0jQYwx99wYirERRh2L6L2sg/iSEw/S3Bob7cVfAnKpsKrTtO4s2ni MdLTQcbRNDaylIe6bQ5ZiD+L+BNOnNYv710YCqRCDmewz6oM+ZoRvZrPqn60QP59AmMQ 57aGBjGz9kXGNagodao5NPT0GxoaiNHttx6GNENxCubH5V18kkRgQcvCCLTo+HRuKY9e /crXE/XutIKyGRxqKhChtsk42bKV01kguhk1Ymw1ejbMyD+YLQIie2tVzW7W5uJUPIpS 06jL+IsPWB5bGKXpuhLA0CN3hO/t3VHGf0MzpnMFzkw06HxMLCKy3PRuhRTttg9upUFj D+ZQ== X-Gm-Message-State: AOAM533C531lCFnAVJBgEwCRvLdlokZ1wBLOb1E2Qo0oXywNSAdbpaQn Q/1WEwOCBhOkxJkBK95RoH/0xS3AmEhA0D+m+DE= X-Google-Smtp-Source: ABdhPJy4ywOnzF9kD6zFoE5E3IvpL600551ptbza1nOwn3tbxP5G70t3JszenuCoIFQSJsMjhdst67Lv43bmL06rQIE= X-Received: by 2002:a17:90a:1b4a:b0:1bf:1112:5ef with SMTP id q68-20020a17090a1b4a00b001bf111205efmr8226643pjq.143.1646409951992; Fri, 04 Mar 2022 08:05:51 -0800 (PST) MIME-Version: 1.0 References: <87czj1vhlf.fsf@redhat.com> In-Reply-To: <87czj1vhlf.fsf@redhat.com> From: "H.J. Lu" Date: Fri, 4 Mar 2022 08:05:16 -0800 Message-ID: Subject: Re: RFC: GAS: Add option to generate unused section symbols To: Nick Clifton Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3020.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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, 04 Mar 2022 16:05:57 -0000 On Fri, Mar 4, 2022 at 7:54 AM Nick Clifton via Binutils wrote: > > Hi Guys, > > With the 2.36 release of the binutils we stopped generating section > symbols if they were not needed by relocations. This helps to reduce > object file size and enhances compatibility with the LLVM compiler. > But I have received some bug reports about this feature, most notably > from kernel maintainers who have found that the new behaviour breaks > the recordmcount tool. So I am proposing the attached patch as a I ran into this problem in the Linux kernel build. I believe the proper solution is to change the Linux kernel not to include the .o files which are empty and unused. It isn't so hard to do. > solution. > > The patch adds an option to the assembler: --keep-unused-section-symbols=[yes|no] > which is pretty much self describing. The patch itself is fairly > simple, although there is one area that might provoke comment: Since > the xvec structure in a BFD is accessed via a const pointer, its > contents cannot be changed. This makes sense most of the time, but > poses a problem for this patch since it wants to change the > keep_unused_section_symbols field. So I decided that the simplest way > to resolve this would be to allocate a new xvec structure, fill it in, > and then change the pointer in the bfd. This might be a bit wasteful > of memory, but I am not expecting this feature to be used very often > and I thought that it was better to preserve the const pointer > semantics. > > Any comments ? > > Cheers > Nick -- H.J.