From 650e7e032e3956812c25dbf9afc29da000b7048e Mon Sep 17 00:00:00 2001 From: nickc Date: Mon, 4 Aug 2003 11:32:51 +0000 Subject: [PATCH] Prefix .gnu.warning section messages with "warning: ". --- bfd/ChangeLog | 5 +++++ bfd/elflink.h | 10 +++++++--- ld/ChangeLog | 5 +++++ ld/emultempl/elf32.em | 11 ++++++++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b2686ef969..8645db0104 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2003-08-04 Nick Clifton + + * elflink.h (elf_link_add_object_symbols): Prepend "warning: " + to messages produced for .gnu.warning.SYMBOL sections. + 2003-08-04 Alan Modra * elfcode.h: Convert to C90, remove unneeded casts and prototypes. diff --git a/bfd/elflink.h b/bfd/elflink.h index a2520b1d80..c0b2468b7d 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -459,6 +459,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { char *msg; bfd_size_type sz; + bfd_size_type prefix_len; + const char * gnu_warning_prefix = _("warning: "); name += sizeof ".gnu.warning." - 1; @@ -492,14 +494,16 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } sz = bfd_section_size (abfd, s); - msg = bfd_alloc (abfd, sz + 1); + prefix_len = strlen (gnu_warning_prefix); + msg = bfd_alloc (abfd, prefix_len + sz + 1); if (msg == NULL) goto error_return; - if (! bfd_get_section_contents (abfd, s, msg, 0, sz)) + strcpy (msg, gnu_warning_prefix); + if (! bfd_get_section_contents (abfd, s, msg + prefix_len, 0, sz)) goto error_return; - msg[sz] = '\0'; + msg[prefix_len + sz] = '\0'; if (! (_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_WARNING, s, 0, msg, diff --git a/ld/ChangeLog b/ld/ChangeLog index 326d3b01db..68e92d6305 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2003-08-04 Nick Clifton + + * emultempl/elf32.em (before_allocation): Prepend "warning: " + to messages produced for .gnu.warning.SYMBOL sections. + 2003-08-04 Alan Modra * emultempl/elf32.em (output_rel_find): Add "isdyn" param. Put diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index e5fefa977f..dfe4e2d308 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -880,8 +880,10 @@ ${ELF_INTERPRETER_SET_DEFAULT} { asection *s; bfd_size_type sz; + bfd_size_type prefix_len; char *msg; bfd_boolean ret; + const char * gnu_warning_prefix = _("warning: "); if (is->just_syms_flag) continue; @@ -891,11 +893,14 @@ ${ELF_INTERPRETER_SET_DEFAULT} continue; sz = bfd_section_size (is->the_bfd, s); - msg = xmalloc ((size_t) sz + 1); - if (! bfd_get_section_contents (is->the_bfd, s, msg, (file_ptr) 0, sz)) + prefix_len = strlen (gnu_warning_prefix); + msg = xmalloc ((size_t) (prefix_len + sz + 1)); + strcpy (msg, gnu_warning_prefix); + if (! bfd_get_section_contents (is->the_bfd, s, msg + prefix_len, + (file_ptr) 0, sz)) einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n", is->the_bfd); - msg[sz] = '\0'; + msg[prefix_len + sz] = '\0'; ret = link_info.callbacks->warning (&link_info, msg, (const char *) NULL, is->the_bfd, (asection *) NULL, -- 2.11.0