From 8ed88239b4e44167abc75d9423596284de5a001d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 6 Feb 1995 20:01:38 +0000 Subject: [PATCH] * ldctor.c (ldctor_build_sets): Handle bfd_link_hah_defweak. * ldexp.c (fold_name): Likewise. * ldlang.c (print_one_symbol): Likewise. (lang_finish): Likewise. * ldmain.c (multiple_common): Likewise. * ldwrite.c (print_symbol): Likewise. Also, bfd_link_hash_weak renamed to bfd_link_hash_undefweak. --- ld/ChangeLog | 8 ++++++++ ld/ldlang.c | 6 ++++-- ld/ldmain.c | 35 ++++++++++++++++++++++++++--------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 40f0933..2df76e9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,13 @@ Mon Feb 6 12:17:24 1995 Ian Lance Taylor + * ldctor.c (ldctor_build_sets): Handle bfd_link_hah_defweak. + * ldexp.c (fold_name): Likewise. + * ldlang.c (print_one_symbol): Likewise. + (lang_finish): Likewise. + * ldmain.c (multiple_common): Likewise. + * ldwrite.c (print_symbol): Likewise. Also, bfd_link_hash_weak + renamed to bfd_link_hash_undefweak. + * scripttempl/alpha.sc: Set address of .data section correctly when -n or -N is used. Patch from Chris G Demetriou . diff --git a/ld/ldlang.c b/ld/ldlang.c index c2b8e7d..bd71f2b 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1280,7 +1280,8 @@ PTR ptr; { asection * sec = (asection *)ptr; - if (hash_entry->type == bfd_link_hash_defined) + if (hash_entry->type == bfd_link_hash_defined + || hash_entry->type == bfd_link_hash_defweak) { if (sec == hash_entry->u.def.section) { print_section (""); @@ -2149,7 +2150,8 @@ lang_finish () h = bfd_link_hash_lookup (link_info.hash, entry_symbol, false, false, true); if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) + && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak)) { bfd_vma val; diff --git a/ld/ldmain.c b/ld/ldmain.c index 392d302..a9b836a 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -201,12 +201,20 @@ main (argc, argv) einfo ("%P%F: -relax and -r may not be used together\n"); if (config.dynamic_link) einfo ("%P%F: -r and -call_shared may not be used together\n"); - if (link_info.strip == strip_all) - einfo ("%P%F: -r and -s may not be used together\n"); if (link_info.shared) einfo ("%P%F: -r and -shared may not be used together\n"); } + /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I + don't see how else this can be handled, since in this case we + must preserve all externally visible symbols. */ + if (link_info.relocateable && link_info.strip == strip_all) + { + link_info.strip = strip_debugger; + if (link_info.discard == discard_none) + link_info.discard = discard_all; + } + /* This essentially adds another -L directory so this must be done after the -L's in argv have been processed. */ set_scripts_dir (); @@ -629,19 +637,25 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize) if (! config.warn_common) return true; - if (ntype == bfd_link_hash_defined) + if (ntype == bfd_link_hash_defined + || ntype == bfd_link_hash_defweak + || ntype == bfd_link_hash_indirect) { ASSERT (otype == bfd_link_hash_common); einfo ("%B: warning: definition of `%T' overriding common\n", nbfd, name); - einfo ("%B: warning: common is here\n", obfd); + if (obfd != NULL) + einfo ("%B: warning: common is here\n", obfd); } - else if (otype == bfd_link_hash_defined) + else if (otype == bfd_link_hash_defined + || otype == bfd_link_hash_defweak + || otype == bfd_link_hash_indirect) { ASSERT (ntype == bfd_link_hash_common); einfo ("%B: warning: common of `%T' overridden by definition\n", nbfd, name); - einfo ("%B: warning: defined here\n", obfd); + if (obfd != NULL) + einfo ("%B: warning: defined here\n", obfd); } else { @@ -650,18 +664,21 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize) { einfo ("%B: warning: common of `%T' overridden by larger common\n", nbfd, name); - einfo ("%B: warning: larger common is here\n", obfd); + if (obfd != NULL) + einfo ("%B: warning: larger common is here\n", obfd); } else if (nsize > osize) { einfo ("%B: warning: common of `%T' overriding smaller common\n", nbfd, name); - einfo ("%B: warning: smaller common is here\n", obfd); + if (obfd != NULL) + einfo ("%B: warning: smaller common is here\n", obfd); } else { einfo ("%B: warning: multiple common of `%T'\n", nbfd, name); - einfo ("%B: warning: previous common is here\n", obfd); + if (obfd != NULL) + einfo ("%B: warning: previous common is here\n", obfd); } } -- 2.7.4