* [PATCH 1/1] gas: add new command line option --no-group-check
[not found] <cover.1689950871.git.tanyuan@tinylab.org>
@ 2023-07-21 15:16 ` Tan Yuan
0 siblings, 0 replies; only message in thread
From: Tan Yuan @ 2023-07-21 15:16 UTC (permalink / raw)
To: binutils, amodra, jbeulich; +Cc: falcon, Tan Yuan
This option suppresses the warning when attaching a group to a section
that already belongs to a group.
ChangeLog:
* gas/as.c (parse_args): Parse args and set flag_no_group_check.
* gas/as.h: Introduce skeleton for --no-group-check.
* gas/doc/as.texi: document --no-group-check.
* gas/config/obj-elf.c: Add conditional check for conflicting group
name
Signed-off-by: Tan Yuan <tanyuan@tinylab.org>
---
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(-)
diff --git a/gas/as.c b/gas/as.c
index 6839c841588..2a5cb98212d 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -383,6 +383,8 @@ Options:\n\
fprintf (stream, _("\
-W --no-warn suppress warnings\n"));
fprintf (stream, _("\
+ --no-group-check suppress the warning when attaching a group to a section that already has a group.\n"));
+ fprintf (stream, _("\
--warn don't suppress warnings\n"));
fprintf (stream, _("\
--fatal-warnings treat warnings as errors\n"));
@@ -511,7 +513,8 @@ parse_args (int * pargc, char *** pargv)
OPTION_NOCOMPRESS_DEBUG,
OPTION_NO_PAD_SECTIONS,
OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */
- OPTION_SFRAME
+ OPTION_SFRAME,
+ OPTION_NO_GROUP_CHECK
/* When you add options here, check that they do
not collide with OPTION_MD_BASE. See as.h. */
};
@@ -585,6 +588,7 @@ parse_args (int * pargc, char *** pargv)
,{"nocpp", no_argument, NULL, OPTION_NOCPP}
,{"no-pad-sections", no_argument, NULL, OPTION_NO_PAD_SECTIONS}
,{"no-warn", no_argument, NULL, 'W'}
+ ,{"no-group-check", no_argument, NULL, OPTION_NO_GROUP_CHECK}
,{"reduce-memory-overheads", no_argument, NULL, OPTION_REDUCE_MEMORY_OVERHEADS}
,{"statistics", no_argument, NULL, OPTION_STATISTICS}
,{"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE}
@@ -990,6 +994,10 @@ This program has absolutely no warranty.\n"));
else
as_fatal (_("Invalid --size-check= option: `%s'"), optarg);
break;
+
+ case OPTION_NO_GROUP_CHECK:
+ flag_no_group_check = 1;
+ break;
case OPTION_ELF_STT_COMMON:
if (strcasecmp (optarg, "no") == 0)
diff --git a/gas/as.h b/gas/as.h
index 99ffe77afd2..92db749e193 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -605,6 +605,9 @@ COMMON const char * found_comment_file;
/* If .size directive failure should be error or warning. */
COMMON int flag_allow_nonconst_size;
+/* True if the check for an existing group of sections should be inhibited. */
+COMMON int flag_no_group_check;
+
/* If we should generate ELF common symbols with the STT_COMMON type. */
extern int flag_use_elf_stt_common;
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 753a929fb14..8b383a8e93d 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1086,7 +1086,7 @@ obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED)
return;
}
- if (elf_group_name (now_seg))
+ if (elf_group_name (now_seg) && !flag_no_group_check)
{
as_warn (_("section %s already has a group (%s)"),
bfd_section_name (now_seg), elf_group_name (now_seg));
diff --git a/gas/doc/as.texi b/gas/doc/as.texi
index 4959c2f6d49..fb27395607e 100644
--- a/gas/doc/as.texi
+++ b/gas/doc/as.texi
@@ -961,6 +961,10 @@ Print the @command{as} version and exit.
@itemx --no-warn
Suppress warning messages.
+@item --no-group-check
+Suppress the warning when attaching a group to a section that already has a
+group.
+
@item --fatal-warnings
Treat warnings as errors.
--
2.41.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-21 15:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1689950871.git.tanyuan@tinylab.org>
2023-07-21 15:16 ` [PATCH 1/1] gas: add new command line option --no-group-check Tan Yuan
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).