diff options
author | CoprDistGit <copr-devel@lists.fedorahosted.org> | 2024-01-25 14:30:18 +0000 |
---|---|---|
committer | CoprDistGit <copr-devel@lists.fedorahosted.org> | 2024-01-25 14:30:18 +0000 |
commit | 9d8422b0bfcea73a105b21d7dd0858f4c9916cca (patch) | |
tree | 97f7b280dd67955daf67ea48dc42a6826c3d61af | |
parent | 357019cd4631b328ef304c95427c349c60473f9a (diff) |
-rw-r--r-- | binutils-fatal-warnings.patch | 136 | ||||
-rw-r--r-- | binutils.spec | 9 |
2 files changed, 144 insertions, 1 deletions
diff --git a/binutils-fatal-warnings.patch b/binutils-fatal-warnings.patch new file mode 100644 index 0000000..ab57938 --- /dev/null +++ b/binutils-fatal-warnings.patch @@ -0,0 +1,136 @@ +diff -rup binutils.orig/ld/emultempl/elf.em binutils-2.41/ld/emultempl/elf.em +--- binutils.orig/ld/emultempl/elf.em 2024-01-25 12:15:12.113299123 +0000 ++++ binutils-2.41/ld/emultempl/elf.em 2024-01-25 12:15:21.754311058 +0000 +@@ -893,7 +893,7 @@ fi + + fragment <<EOF + else +- einfo (_("%P: warning: -z %s ignored\n"), optarg); ++ queue_unknown_cmdline_warning ("-z %s", optarg); + break; + EOF + +Only in binutils-2.41/ld/emultempl: elf.em.orig +diff -rup binutils.orig/ld/ldelf.c binutils-2.41/ld/ldelf.c +--- binutils.orig/ld/ldelf.c 2024-01-25 12:15:12.114299125 +0000 ++++ binutils-2.41/ld/ldelf.c 2024-01-25 12:15:21.754311058 +0000 +@@ -74,7 +74,7 @@ ldelf_after_parse (void) + && link_info.nointerp) + { + if (link_info.dynamic_undefined_weak > 0) +- einfo (_("%P: warning: -z dynamic-undefined-weak ignored\n")); ++ queue_unknown_cmdline_warning ("-z dynamic-undefined-weak"); + link_info.dynamic_undefined_weak = 0; + } + +diff -rup binutils.orig/ld/ldmain.c binutils-2.41/ld/ldmain.c +--- binutils.orig/ld/ldmain.c 2024-01-25 12:15:12.114299125 +0000 ++++ binutils-2.41/ld/ldmain.c 2024-01-25 12:15:21.754311058 +0000 +@@ -479,6 +479,8 @@ main (int argc, char **argv) + + ldemul_after_parse (); + ++ output_unknown_cmdline_warnings (); ++ + if (config.map_filename) + { + if (strcmp (config.map_filename, "-") == 0) +diff -rup binutils.orig/ld/ldmisc.c binutils-2.41/ld/ldmisc.c +--- binutils.orig/ld/ldmisc.c 2024-01-25 12:15:12.114299125 +0000 ++++ binutils-2.41/ld/ldmisc.c 2024-01-25 12:15:21.754311058 +0000 +@@ -620,6 +620,81 @@ einfo (const char *fmt, ...) + fflush (stderr); + } + ++/* The buffer size for each command-line option warning. */ ++#define CMDLINE_WARNING_SIZE 256 ++ ++/* A linked list of command-line option warnings. */ ++ ++struct cmdline_warning_list ++{ ++ struct cmdline_warning_list *next; ++ char *warning; ++}; ++ ++/* The head of the linked list of command-line option warnings. */ ++static struct cmdline_warning_list *cmdline_warning_head = NULL; ++ ++/* The tail of the linked list of command-line option warnings. */ ++static struct cmdline_warning_list **cmdline_warning_tail ++ = &cmdline_warning_head; ++ ++/* Queue an unknown command-line option warning. */ ++ ++void ++queue_unknown_cmdline_warning (const char *fmt, ...) ++{ ++ va_list arg; ++ struct cmdline_warning_list *warning_ptr ++ = xmalloc (sizeof (*warning_ptr)); ++ warning_ptr->warning = xmalloc (CMDLINE_WARNING_SIZE); ++ warning_ptr->next = NULL; ++ int written; ++ ++ va_start (arg, fmt); ++ written = vsnprintf (warning_ptr->warning, CMDLINE_WARNING_SIZE, fmt, ++ arg); ++ if (written < 0 || written >= CMDLINE_WARNING_SIZE) ++ { ++ /* If vsnprintf fails or truncates, output the warning directly. */ ++ fflush (stdout); ++ va_start (arg, fmt); ++ vfinfo (stderr, fmt, arg, true); ++ fflush (stderr); ++ } ++ else ++ { ++ *cmdline_warning_tail = warning_ptr; ++ cmdline_warning_tail = &warning_ptr->next; ++ } ++ va_end (arg); ++} ++ ++/* Output queued unknown command-line option warnings. */ ++ ++void ++output_unknown_cmdline_warnings (void) ++{ ++ struct cmdline_warning_list *list = cmdline_warning_head; ++ struct cmdline_warning_list *next; ++ if (list == NULL) ++ return; ++ ++ fflush (stdout); ++ ++ for (; list != NULL; list = next) ++ { ++ next = list->next; ++ if (config.fatal_warnings) ++ einfo (_("%P: error: unsupported option: %s\n"), list->warning); ++ else ++ einfo (_("%P: warning: %s ignored\n"), list->warning); ++ free (list->warning); ++ free (list); ++ } ++ ++ fflush (stderr); ++} ++ + void + info_assert (const char *file, unsigned int line) + { +diff -rup binutils.orig/ld/ldmisc.h binutils-2.41/ld/ldmisc.h +--- binutils.orig/ld/ldmisc.h 2024-01-25 12:15:12.114299125 +0000 ++++ binutils-2.41/ld/ldmisc.h 2024-01-25 12:15:59.559357849 +0000 +@@ -31,6 +31,8 @@ extern void yyerror (const char *); + extern void *xmalloc (size_t); + extern void *xrealloc (void *, size_t); + extern void xexit (int); ++extern void queue_unknown_cmdline_warning (const char *, ...); ++extern void output_unknown_cmdline_warnings (void); + + #define ASSERT(x) \ + do { if (!(x)) info_assert(__FILE__,__LINE__); } while (0) +Only in binutils-2.41/ld: ldmisc.h.orig +Only in binutils-2.41/ld: ldmisc.h.rej diff --git a/binutils.spec b/binutils.spec index c8e798d..e45b5ac 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.40 -Release: 13%{?dist} +Release: 14%{?dist} License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils @@ -285,6 +285,10 @@ Patch21: binutils-CVE-2023-1972.patch # Lifetime: Fixed in 2.41 (maybe) Patch22: binutils-gold-empty-dwp.patch +# Purpose: Have the bfd linker's --fatal-warnings option act consistently. +# Lifetime: Fixed in 2.43 +Patch23: binutils-fatal-warnings.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -1283,6 +1287,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Thu Jan 25 2024 Nick Clifton <nickc@redhat.com> - 2.40-14 +- Have the bfd linker's --fatal-warnings option act consistently. (#2259551) + * Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.40-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild |