diff options
author | Fangrui Song <maskray@google.com> | 2020-04-15 14:25:08 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-04-15 14:25:08 +0100 |
commit | 95a515681272fa3a79624279c1579cce14ad61c0 (patch) | |
tree | 21c4c3be88223c9b38116c46614fc87ac9e7f3d1 /ld | |
parent | b1bc1394df596eaaecca0c2ae89eb4fb2c204927 (diff) | |
download | gdb-95a515681272fa3a79624279c1579cce14ad61c0.zip gdb-95a515681272fa3a79624279c1579cce14ad61c0.tar.gz gdb-95a515681272fa3a79624279c1579cce14ad61c0.tar.bz2 |
Unify the behaviour of ld.bfd and ld.gold with respect to warning about unresolved symbol references. (PR 24613)
PR binutils/24613
include * bfdlink.h (enum report_method): Delete RM_GENERATE_WARNING and
RM_GENERATE_ERROR. Add RM_DIAGNOSE.
(struct bfd_link_info): Add warn_unresolved_syms.
ld * lexsup.c (parse_args): Change RM_GENERATE_WARNING and
RM_GENERATE_ERROR to RM_DIAGNOSE.
* emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Change
RM_GENERATE_ERROR to RM_DIAGNOSE.
* emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise.
bfd * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
to RM_DIAGNOSE plus a check of warn_unresolved_syms.
* coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
* elf-bfd.h (_bfd_elf_large_com_section): Likewise.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-sh.c (sh_elf_relocate_section): Likewise.
* elf32-spu.c (spu_elf_relocate_section): Likewise.
* elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
* elflink.c (elf_link_output_extsym): Likewise.
* elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 9 | ||||
-rw-r--r-- | ld/emultempl/aix.em | 4 | ||||
-rw-r--r-- | ld/emultempl/elf.em | 6 | ||||
-rw-r--r-- | ld/lexsup.c | 36 |
4 files changed, 24 insertions, 31 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index f53b226..53a3c9d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2020-04-15 Fangrui Song <maskray@google.com> + + PR binutils/24613 + * lexsup.c (parse_args): Change RM_GENERATE_WARNING and + RM_GENERATE_ERROR to RM_DIAGNOSE. + * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Change + RM_GENERATE_ERROR to RM_DIAGNOSE. + * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise. + 2020-04-14 Stephen Casner <casner@acm.org> PR ld/25677 diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index 2da3870..5b73c3e 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -472,8 +472,8 @@ gld${EMULATION_NAME}_handle_option (int optc) break; case OPTION_ERNOTOK: - link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR; - link_info.unresolved_syms_in_shared_libs = RM_GENERATE_ERROR; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; + link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; break; case OPTION_EROK: diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index bb7e537..8990300 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -675,8 +675,8 @@ fragment <<EOF case OPTION_GROUP: link_info.flags_1 |= (bfd_vma) DF_1_GROUP; /* Groups must be self-contained. */ - link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR; - link_info.unresolved_syms_in_shared_libs = RM_GENERATE_ERROR; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; + link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; break; case OPTION_EXCLUDE_LIBS: @@ -704,7 +704,7 @@ fi fragment <<EOF case 'z': if (strcmp (optarg, "defs") == 0) - link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; else if (strcmp (optarg, "undefs") == 0) link_info.unresolved_syms_in_objects = RM_IGNORE; else if (strcmp (optarg, "muldefs") == 0) diff --git a/ld/lexsup.c b/ld/lexsup.c index adbf2ab7a..d1955b9 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -569,7 +569,6 @@ parse_args (unsigned argc, char **argv) struct option *longopts; struct option *really_longopts; int last_optind; - enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR; enum symbolic_enum { symbolic_unset = 0, @@ -958,15 +957,13 @@ parse_args (unsigned argc, char **argv) link_info.keep_memory = FALSE; break; case OPTION_NO_UNDEFINED: - link_info.unresolved_syms_in_objects - = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; break; case OPTION_ALLOW_SHLIB_UNDEFINED: link_info.unresolved_syms_in_shared_libs = RM_IGNORE; break; case OPTION_NO_ALLOW_SHLIB_UNDEFINED: - link_info.unresolved_syms_in_shared_libs - = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; break; case OPTION_UNRESOLVED_SYMBOLS: if (strcmp (optarg, "ignore-all") == 0) @@ -976,40 +973,27 @@ parse_args (unsigned argc, char **argv) } else if (strcmp (optarg, "report-all") == 0) { - link_info.unresolved_syms_in_objects - = how_to_report_unresolved_symbols; - link_info.unresolved_syms_in_shared_libs - = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; + link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; } else if (strcmp (optarg, "ignore-in-object-files") == 0) { link_info.unresolved_syms_in_objects = RM_IGNORE; - link_info.unresolved_syms_in_shared_libs - = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; } else if (strcmp (optarg, "ignore-in-shared-libs") == 0) { - link_info.unresolved_syms_in_objects - = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; link_info.unresolved_syms_in_shared_libs = RM_IGNORE; } else einfo (_("%F%P: bad --unresolved-symbols option: %s\n"), optarg); break; case OPTION_WARN_UNRESOLVED_SYMBOLS: - how_to_report_unresolved_symbols = RM_GENERATE_WARNING; - if (link_info.unresolved_syms_in_objects == RM_GENERATE_ERROR) - link_info.unresolved_syms_in_objects = RM_GENERATE_WARNING; - if (link_info.unresolved_syms_in_shared_libs == RM_GENERATE_ERROR) - link_info.unresolved_syms_in_shared_libs = RM_GENERATE_WARNING; + link_info.warn_unresolved_syms = TRUE; break; - case OPTION_ERROR_UNRESOLVED_SYMBOLS: - how_to_report_unresolved_symbols = RM_GENERATE_ERROR; - if (link_info.unresolved_syms_in_objects == RM_GENERATE_WARNING) - link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR; - if (link_info.unresolved_syms_in_shared_libs == RM_GENERATE_WARNING) - link_info.unresolved_syms_in_shared_libs = RM_GENERATE_ERROR; + link_info.warn_unresolved_syms = FALSE; break; case OPTION_ALLOW_MULTIPLE_DEFINITION: link_info.allow_multiple_definition = TRUE; @@ -1639,11 +1623,11 @@ parse_args (unsigned argc, char **argv) if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET) /* FIXME: Should we allow emulations a chance to set this ? */ - link_info.unresolved_syms_in_objects = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_objects = RM_DIAGNOSE; if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET) /* FIXME: Should we allow emulations a chance to set this ? */ - link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols; + link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; if (bfd_link_relocatable (&link_info) && command_line.check_section_addresses < 0) |