diff options
author | Nick Clifton <nickc@redhat.com> | 2006-06-12 11:12:51 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2006-06-12 11:12:51 +0000 |
commit | d07676f875b3fa1a3d527b4040c36740e6f3c395 (patch) | |
tree | 310b3b3a9b6d2a2e3930374d66e7ac140db43c42 | |
parent | 13dce8ef13f529c0629901966243f2ea23cc9494 (diff) | |
download | gdb-d07676f875b3fa1a3d527b4040c36740e6f3c395.zip gdb-d07676f875b3fa1a3d527b4040c36740e6f3c395.tar.gz gdb-d07676f875b3fa1a3d527b4040c36740e6f3c395.tar.bz2 |
PR binutils/2735
* elflink.c (elf_link_add_object_symbols): Fix the warning message about
mismatched alignments to allow for the case where the common alignment
has been deduced from the section alignment.
* bfd.c (_bfd_default_error_handler): Update comment to explain why bfd
and asection varargs are out of order.
Explicitly catch and abort on NULL bfd and asection arguments.
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/bfd.c | 29 | ||||
-rw-r--r-- | bfd/elflink.c | 20 |
3 files changed, 52 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e9163e6..a1b2a3f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2006-06-12 Nick Clifton <nickc@redhat.com> + + PR binutils/2735 + * elflink.c (elf_link_add_object_symbols): Fix the warning message + about mismatched alignments to allow for the case where the common + alignment has been deduced from the section alignment. + * bfd.c (_bfd_default_error_handler): Update comment to explain + why bfd and asection varargs are out of order. Explicitly catch + and abort on NULL bfd and asection arguments. + 2006-06-11 Richard Sandiford <richard@codesourcery.com> Thiemo Seufer <ths@mips.com> @@ -419,6 +419,23 @@ static const char *_bfd_error_program_name; %A section name from section. For group components, print group name too. %B file name from bfd. For archive components, prints archive too. + + Note - because these two extra format specifiers require special handling + they are scanned for and processed in this function, before calling + vfprintf. This means that the *arguments* for these format specifiers + must be the first ones in the variable argument list, regardless of where + the specifiers appear in the format string. Thus for example calling + this function with a format string of: + + "blah %s blah %A blah %d blah %B" + + would involve passing the arguments as: + + "blah %s blah %A blah %d blah %B", + asection_for_the_%A, + bfd_for_the_%B, + string_for_the_%s, + integer_for_the_%d); */ void @@ -483,7 +500,11 @@ _bfd_default_error_handler (const char *fmt, ...) if (p[1] == 'B') { bfd *abfd = va_arg (ap, bfd *); - if (abfd->my_archive) + + if (abfd == NULL) + /* Invoking %B with a null bfd pointer is an internal error. */ + abort (); + else if (abfd->my_archive) snprintf (bufp, avail, "%s(%s)", abfd->my_archive->filename, abfd->filename); else @@ -492,10 +513,14 @@ _bfd_default_error_handler (const char *fmt, ...) else { asection *sec = va_arg (ap, asection *); - bfd *abfd = sec->owner; + bfd *abfd; const char *group = NULL; struct coff_comdat_info *ci; + if (sec == NULL) + /* Invoking %A with a null section pointer is an internal error. */ + abort (); + abfd = sec->owner; if (abfd != NULL && bfd_get_flavour (abfd) == bfd_target_elf_flavour && elf_next_in_group (sec) != NULL diff --git a/bfd/elflink.c b/bfd/elflink.c index c5b1007..f4c63f4 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -3922,11 +3922,21 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } if (normal_align < common_align) - (*_bfd_error_handler) - (_("Warning: alignment %u of symbol `%s' in %B" - " is smaller than %u in %B"), - normal_bfd, common_bfd, - 1 << normal_align, name, 1 << common_align); + { + /* PR binutils/2735 */ + if (normal_bfd == NULL) + (*_bfd_error_handler) + (_("Warning: alignment %u of common symbol `%s' in %B" + " is greater than the alignment (%u) of its section %A"), + common_bfd, h->root.u.def.section, + 1 << common_align, name, 1 << normal_align); + else + (*_bfd_error_handler) + (_("Warning: alignment %u of symbol `%s' in %B" + " is smaller than %u in %B"), + normal_bfd, common_bfd, + 1 << normal_align, name, 1 << common_align); + } } /* Remember the symbol size and type. */ |