public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tan Yuan <tanyuan@tinylab.org>
To: binutils@sourceware.org, amodra@gmail.com, jbeulich@suse.com
Cc: Tan Yuan <tanyuan@tinylab.org>
Subject: [PATCH 0/1] gas: add new command line option --no-group-check
Date: Fri, 21 Jul 2023 23:14:20 +0800	[thread overview]
Message-ID: <C46FD19573A4B955+cover.1689950871.git.tanyuan@tinylab.org> (raw)

Hi, list

This patch introduces a new option that allows suppressing the warning
when attaching a group to a section that already belongs to a group.

The kernel extensively uses the ".pushsection" directive, which poses
issues with proper reference building and garbage collection. To address
this problem, the kernel uses "KEEP" in the linker script to prevent
certain sections from being garbage collected. Consequently, some
sections that should have been garbage collected are retained. For
instance, if the section pusher is being garbage collected, the pushed
sections are also supposed to be collected, but the linker script
retains them.

To resolve this, we can utilize ".attach_to_group" alongside
".pushsection," which enables the section pusher and the pushed sections
to be grouped together, making them either eligible for garbage
collection or kept together.

Currently, the kernel encapsulates the use of ".pushsection" within
macros, leading to thousands of instances where these macros are
expanded. Rather than adding ".attach_to_group" to a thousand functions,
we can incorporate it into this macro. However, some functions expand
this macro multiple times, resulting in multiple attachments to the
group for those functions. Unfortunately, there is no alternative method
to ensure a single expansion of ".attach_to_group" As a solution, we
propose adding an option to address this issue.

Thanks.

Tan Yuan (1):
  gas: add new command line option --no-group-check

 gas/as.c             | 10 +++++++++-
 gas/as.h             |  3 +++
 gas/config/obj-elf.c |  2 +-
 gas/doc/as.texi      |  4 ++++
 4 files changed, 17 insertions(+), 2 deletions(-)

-- 
2.41.0


             reply	other threads:[~2023-07-21 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 15:14 Tan Yuan [this message]
2023-07-21 22:55 ` Alan Modra
2023-07-22  3:47   ` Tan Yuan
2023-07-22  3:56     ` Xi Ruoyao
2023-07-23  9:31       ` Tan Yuan
2023-07-22  0:32 ` Song Fangrui
     [not found] <DS7PR12MB5765A326273E125586D742F7CB3CA@DS7PR12MB5765.namprd12.prod.outlook.com>
2023-07-23  9:10 ` Tan Yuan
2023-07-23 17:15   ` Fangrui Song
2023-07-24  9:28 ` Tan Yuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C46FD19573A4B955+cover.1689950871.git.tanyuan@tinylab.org \
    --to=tanyuan@tinylab.org \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).