diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-09-14 22:27:16 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-09-14 22:27:16 +0000 |
commit | 809ee7e0365ed037cbb26ca3d9cc44431bb0f4b1 (patch) | |
tree | 79c0fc901b40235300843b698771afe90a64a408 /ld/ldmain.c | |
parent | a8d0866480cdc01f1695e8e653c625326e8d2e20 (diff) | |
download | gdb-809ee7e0365ed037cbb26ca3d9cc44431bb0f4b1.zip gdb-809ee7e0365ed037cbb26ca3d9cc44431bb0f4b1.tar.gz gdb-809ee7e0365ed037cbb26ca3d9cc44431bb0f4b1.tar.bz2 |
* ld.h (ld_config_type): Add new field warn_once.
* ldmain.c (undefined_symbol): Handle -warn-once.
* lexsup.c (parse_args): Recognize -warn-once.
* ld.texinfo (Options): Document -warn-once.
* ld.1: Likewise.
PR 4456.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index 754813b..392d302 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -782,6 +782,27 @@ undefined_symbol (info, name, abfd, section, address) #define MAX_ERRORS_IN_A_ROW 5 + if (config.warn_once) + { + static struct bfd_hash_table *hash; + + /* Only warn once about a particular undefined symbol. */ + + if (hash == NULL) + { + hash = ((struct bfd_hash_table *) + xmalloc (sizeof (struct bfd_hash_table))); + if (! bfd_hash_table_init (hash, bfd_hash_newfunc)) + einfo ("%F%P: bfd_hash_table_init failed: %E\n"); + } + + if (bfd_hash_lookup (hash, name, false, false) != NULL) + return true; + + if (bfd_hash_lookup (hash, name, true, true) == NULL) + einfo ("%F%P: bfd_hash_lookup failed: %E\n"); + } + /* We never print more than a reasonable number of errors in a row for a single symbol. */ if (error_name != (char *) NULL |