From a5c7acea2fd3fd603e5d7e3f314e2228dc7012a8 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 11 Jun 1996 22:25:55 +0000 Subject: [PATCH] * xcofflink.c (xcoff_build_ldsyms): Set XCOFF_DEF_REGULAR for a common symbol defined by the linker. Don't export function code even if export_defineds is set. PR 9856. --- bfd/ChangeLog | 15 +++++++++++++++ bfd/xcofflink.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7f72945140..e30101d89b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,18 @@ +Tue Jun 11 15:24:48 1996 Ian Lance Taylor + + * xcofflink.c (xcoff_build_ldsyms): Set XCOFF_DEF_REGULAR for a + common symbol defined by the linker. Don't export function code + even if export_defineds is set. + +Mon Jun 10 11:57:27 1996 Jeffrey A Law (law@cygnus.com) + + * coff-h8300.c (howto_table): Add new entries for R_BCC_INV + and R_JMP_DEL. + (rtype2howto): Handle R_BCC_INV and R_JMP_DEL. + (h8300_symbol_address_p): New function. + (h8300_reloc16_estimate): Eliminate jumps made unnecessary by + relaxing. + Sun Jun 9 16:30:20 1996 Jeffrey A Law (law@cygnus.com) * coff-h8300.c (h8300_reloc16_estimate): Fix many minor spacing diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 4e1bfa7e9e..88a7f3462a 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1064,7 +1064,9 @@ _bfd_xcoff_bfd_link_add_symbols (abfd, info) case bfd_archive: /* We need to look through the archive for stripped dynamic objects, because they will not appear in the archive map even - though they should, perhaps, be included. */ + though they should, perhaps, be included. Also, if the + linker has no map, we just consider each object file in turn, + since that apparently is what the AIX native linker does. */ { bfd *member; @@ -1072,8 +1074,9 @@ _bfd_xcoff_bfd_link_add_symbols (abfd, info) while (member != NULL) { if (bfd_check_format (member, bfd_object) - && (member->flags & DYNAMIC) != 0 - && (member->flags & HAS_SYMS) == 0) + && (! bfd_has_map (abfd) + || ((member->flags & DYNAMIC) != 0 + && (member->flags & HAS_SYMS) == 0))) { boolean needed; @@ -1085,6 +1088,9 @@ _bfd_xcoff_bfd_link_add_symbols (abfd, info) member = bfd_openr_next_archived_file (abfd, member); } + if (! bfd_has_map (abfd)) + return true; + /* Now do the usual search. */ return (_bfd_generic_link_add_archive_symbols (abfd, info, xcoff_link_check_archive_element)); @@ -3356,9 +3362,24 @@ xcoff_build_ldsyms (h, p) struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; size_t len; - /* If all defined symbols should be exported, mark them now. */ + /* If this is a final link, and the symbol was defined as a common + symbol in a regular object file, and there was no definition in + any dynamic object, then the linker will have allocated space for + the symbol in a common section but the XCOFF_DEF_REGULAR flag + will not have been set. */ + if (h->root.type == bfd_link_hash_defined + && (h->flags & XCOFF_DEF_REGULAR) == 0 + && (h->flags & XCOFF_REF_REGULAR) != 0 + && (h->flags & XCOFF_DEF_DYNAMIC) == 0 + && (h->root.u.def.section->owner->flags & DYNAMIC) == 0) + h->flags |= XCOFF_DEF_REGULAR; + + /* If all defined symbols should be exported, mark them now. We + don't want to export the actual functions, just the function + descriptors. */ if (ldinfo->export_defineds - && (h->flags & XCOFF_DEF_REGULAR) != 0) + && (h->flags & XCOFF_DEF_REGULAR) != 0 + && h->root.root.string[0] != '.') h->flags |= XCOFF_EXPORT; /* We don't want to garbage collect symbols which are not defined in @@ -6039,8 +6060,7 @@ _bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd, /* Every symbol in a shared object is defined somewhere. */ val = 0; } - else if (! info->relocateable - && ! info->shared) + else if (! info->relocateable) { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section,