From 8d7f2d507e59bbf0f1effe250337a6deeb5d7602 Mon Sep 17 00:00:00 2001 From: obrien Date: Fri, 11 Oct 2002 06:15:47 +0000 Subject: Merge rev 1.2 (teach `ld' how to access FreeBSD's ld ELF hints) into Binutils 2.13.1 snap. --- contrib/binutils/ld/emultempl/elf32.em | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'contrib/binutils') diff --git a/contrib/binutils/ld/emultempl/elf32.em b/contrib/binutils/ld/emultempl/elf32.em index f09d1a8..ad0935a 100644 --- a/contrib/binutils/ld/emultempl/elf32.em +++ b/contrib/binutils/ld/emultempl/elf32.em @@ -284,6 +284,13 @@ gld${EMULATION_NAME}_try_needed (name, force) return false; } + /* For DT_NEEDED, they have to match. */ + if (abfd->xvec != output_bfd->xvec) + { + bfd_close (abfd); + return false; + } + /* Check whether this object would include any conflicting library versions. If FORCE is set, then we skip this check; we use this the second time around, if we couldn't find any compatible @@ -1178,7 +1185,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) #define HAVE_SECTION(hold, name) \ (hold.os != NULL || (hold.os = lang_output_section_find (name)) != NULL) - if (s->flags & SEC_EXCLUDE) + if ((s->flags & SEC_EXCLUDE) != 0 && !link_info.relocateable) { if (s->output_section == NULL) s->output_section = bfd_abs_section_ptr; @@ -1293,7 +1300,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) lang_leave_output_section_statement ((bfd_vma) 0, "*default*", - (struct lang_output_section_phdr_list *) NULL, "*default*"); + (struct lang_output_section_phdr_list *) NULL, NULL); if (config.build_constructors && *ps == '\0') { @@ -1313,7 +1320,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) /* Restore the global list pointer. */ stat_ptr = old; - if (place != NULL) + if (place != NULL && os->bfd_section != NULL) { asection *snew, **pps; @@ -1409,7 +1416,7 @@ gld${EMULATION_NAME}_finish () /* Do the assignments again. */ lang_do_assignments (stat_ptr->head, abs_output_section, - (fill_type) 0, (bfd_vma) 0); + (fill_type *) 0, (bfd_vma) 0); } } EOF @@ -1447,13 +1454,17 @@ echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME} sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c fi if test -n "$GENERATE_SHLIB_SCRIPT" ; then +if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then echo ' ; else if (link_info.shared && link_info.combreloc) return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c +fi echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c fi +if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c +fi echo ' ; else return' >> e${EMULATION_NAME}.c sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c echo '; }' >> e${EMULATION_NAME}.c @@ -1612,6 +1623,8 @@ cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c <