From: Ian Lance Taylor Date: Wed, 5 Jul 1995 19:04:58 +0000 (+0000) Subject: * config/obj-aout.c (obj_aout_frob_symbol): Warn about an attempt X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f219dc655ad997093ccb3a0518907e5a8cd2b237;p=binutils-gdb.git * config/obj-aout.c (obj_aout_frob_symbol): Warn about an attempt to put an undefined symbol into a set. PR 6340. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index e5a6f4d6c5c..749365fad10 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,8 @@ Wed Jul 5 12:01:49 1995 Ian Lance Taylor + * config/obj-aout.c (obj_aout_frob_symbol): Warn about an attempt + to put an undefined symbol into a set. + * Makefile.in: Remove @configure_input@; it's not needed in files named Makefile. diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 00e77947ed5..ee8b3987501 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -1,5 +1,5 @@ /* a.out object file format - Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -116,7 +116,7 @@ obj_aout_frob_symbol (sym, punt) { if (type == (N_UNDF | N_EXT) && sec == &bfd_abs_section) - sym->bsym->section = sec = &bfd_und_section; + sym->bsym->section = sec = bfd_und_section_ptr; if ((type & N_TYPE) != N_INDR && (type & N_TYPE) != N_SETA @@ -139,10 +139,29 @@ obj_aout_frob_symbol (sym, punt) /* Set the debugging flag for constructor symbols so that BFD leaves them alone. */ sym->bsym->flags |= BSF_DEBUGGING; + + /* You can't put a common symbol in a set. The way a set + element works is that the symbol has a definition and a + name, and the linker adds the definition to the set of + that name. That does not work for a common symbol, + because the linker can't tell which common symbol the + user means. FIXME: Using as_bad here may be + inappropriate, since the user may want to force a + particular type without regard to the semantics of sets; + on the other hand, we certainly don't want anybody to be + mislead into thinking that their code will work. */ + if (S_IS_COMMON (sym)) + as_bad ("Attempt to put a common symbol into set %s", + S_GET_NAME (sym)); + /* Similarly, you can't put an undefined symbol in a set. */ + else if (! S_IS_DEFINED (sym)) + as_bad ("Attempt to put an undefined symbol into set %s", + S_GET_NAME (sym)); + break; case N_INDR: /* Put indirect symbols in the indirect section. */ - sym->bsym->section = &bfd_ind_section; + sym->bsym->section = bfd_ind_section_ptr; sym->bsym->flags |= BSF_INDIRECT; if (type & N_EXT) { @@ -162,6 +181,14 @@ obj_aout_frob_symbol (sym, punt) } S_SET_TYPE (sym, type); + + /* Double check weak symbols. */ + if (sym->bsym->flags & BSF_WEAK) + { + if (S_IS_COMMON (sym)) + as_bad ("Symbol `%s' can not be both weak and common", + S_GET_NAME (sym)); + } } void