From 74f0fb5065323b33bef71dfcbbd9b595c88c6c0c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 15 Jan 2008 07:25:49 +0000 Subject: bfd/ PR 5604 * elf-bfd.h (struct elf_backend_data): Add gc_keep. Remove param names from others. (_bfd_elf_gc_keep): Declare. * elfxx-target.h (elf_backend_gc_keep): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_gc_keep): New function. (bfd_elf_gc_sections): Call gc_keep. * elf64-ppc.c (elf_backend_gc_keep): Define. (struct _ppc64_elf_section_data): Move .opd related fields to a struct so they don't occupy the same storage. Adjust accesses throughout file. (ppc64_elf_gc_keep): New function, split out from.. (ppc64_elf_gc_mark_hook): ..here. Don't call _bfd_elf_gc_mark to mark .opd section, just set gc_mark. (ppc64_elf_edit_opd): Remove no_opd_opt parm. Don't set opd->adjust unless we are changing .opd. Test non-NULL opd->adjust at all accesses throughout file. * elf64-ppc.h (ppc64_elf_edit_opd): Update prototype. ld/ PR 5604 * ldlang.c (lang_gc_sections): Move code to set SEC_KEEP on entry syms to _bfd_elf_gc_keep. * emultempl/ppc64elf.em (ppc_before_allocation): Don't call ppc64_elf_edit_opd if no_opd_opt. --- ld/ChangeLog | 8 ++++++++ ld/emultempl/ppc64elf.em | 7 ++++--- ld/ldlang.c | 22 +--------------------- 3 files changed, 13 insertions(+), 24 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 372422d..64e6a08 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2008-01-15 Alan Modra + + PR 5604 + * ldlang.c (lang_gc_sections): Move code to set SEC_KEEP on entry + syms to _bfd_elf_gc_keep. + * emultempl/ppc64elf.em (ppc_before_allocation): Don't call + ppc64_elf_edit_opd if no_opd_opt. + 2008-01-11 Tristan Gingold Eric Botcazou diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index d5578c3..b23ae43 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -1,5 +1,6 @@ # This shell script emits a C file. -*- C -*- -# Copyright 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004, 2005, 2007, 2008 +# Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -103,8 +104,8 @@ ppc_before_allocation (void) { if (stub_file != NULL) { - if (!ppc64_elf_edit_opd (output_bfd, &link_info, no_opd_opt, - non_overlapping_opd)) + if (!no_opd_opt + && !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd)) einfo ("%X%P: can not edit %s %E\n", "opd"); if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt) diff --git a/ld/ldlang.c b/ld/ldlang.c index 63326e5..ec5f000 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1,6 +1,6 @@ /* Linker command language support. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU Binutils. @@ -5670,30 +5670,10 @@ lang_gc_sections_1 (lang_statement_union_type *s) static void lang_gc_sections (void) { - struct bfd_link_hash_entry *h; - ldlang_undef_chain_list_type *ulist; - /* Keep all sections so marked in the link script. */ lang_gc_sections_1 (statement_list.head); - /* Keep all sections containing symbols undefined on the command-line, - and the section containing the entry symbol. */ - - for (ulist = link_info.gc_sym_list; ulist; ulist = ulist->next) - { - h = bfd_link_hash_lookup (link_info.hash, ulist->name, - FALSE, FALSE, FALSE); - - if (h != NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak) - && ! bfd_is_abs_section (h->u.def.section)) - { - h->u.def.section->flags |= SEC_KEEP; - } - } - /* SEC_EXCLUDE is ignored when doing a relocatable link, except in the special case of debug info. (See bfd/stabs.c) Twiddle the flag here, to simplify later linker code. */ -- cgit v1.1