From ccd2ec6a8718548c570e4dead571af5c6ba0e2e3 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 24 Oct 2005 01:40:58 +0000 Subject: bfd/ 2005-10-23 H.J. Lu PR ld/1487 * elf-bfd.h (_bfd_generic_init_private_section_data): New. (_bfd_elf_init_private_section_data): New. * elf.c (elf_fake_sections): Don't set SHF_GROUP for relocatable link. (bfd_elf_set_group_contents): Don't handle relocatable link specially. (assign_section_numbers): If it isn't called by assembler, use the output section of elf_linked_to_section for SHF_LINK_ORDER. (_bfd_elf_init_private_section_data): New. (_bfd_elf_copy_private_section_data): Call it. * libbfd-in.h (_bfd_generic_init_private_section_data): New. * libbfd.c (_bfd_generic_init_private_section_data): New. * targets.c (BFD_JUMP_TABLE_COPY): Add _bfd_generic_init_private_section_data. (bfd_init_private_section_data): Likewise. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. ld/ 2005-10-23 H.J. Lu PR ld/1487 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Call bfd_match_sections_by_type to match section types. * ldlang.c (init_os): Take the input section. Call bfd_init_private_section_data if the input section isn't NULL. (exp_init_os): Pass NULL to init_os. (map_input_to_output_sections): Likewise. (lang_add_section): Pass the input section to init_os. ld/testsuite/ 2005-10-23 H.J. Lu PR ld/1487 * ld-ia64/tlspic.rd: Updated. --- ld/ChangeLog | 12 ++++++++++++ ld/emultempl/elf32.em | 5 +++-- ld/ldlang.c | 19 ++++++++++++------- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-ia64/tlspic.rd | 1 - 5 files changed, 32 insertions(+), 10 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index e40b47d..4d74ef9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2005-10-23 H.J. Lu + + PR ld/1487 + * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Call + bfd_match_sections_by_type to match section types. + + * ldlang.c (init_os): Take the input section. Call + bfd_init_private_section_data if the input section isn't NULL. + (exp_init_os): Pass NULL to init_os. + (map_input_to_output_sections): Likewise. + (lang_add_section): Pass the input section to init_os. + 2005-10-19 Paul Brook * emulparams/armelf.sh: Add .ARM.attributes to OTHER_SECTIONS. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index e1e37f1..0425d15 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1363,8 +1363,9 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) if (os != NULL && (os->bfd_section == NULL || os->bfd_section->flags == 0 - || ((!iself - || sh_type == elf_section_type (os->bfd_section)) + || (bfd_match_sections_by_type (output_bfd, + os->bfd_section, + s->owner, s) && ((s->flags ^ os->bfd_section->flags) & (SEC_LOAD | SEC_ALLOC)) == 0))) { diff --git a/ld/ldlang.c b/ld/ldlang.c index b82a7e5..7824d24 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1674,7 +1674,7 @@ sort_def_symbol (hash_entry, info) /* Initialize an output section. */ static void -init_os (lang_output_section_statement_type *s) +init_os (lang_output_section_statement_type *s, asection *isec) { if (s->bfd_section != NULL) return; @@ -1711,6 +1711,11 @@ init_os (lang_output_section_statement_type *s) if (s->load_base != NULL) exp_init_os (s->load_base); + + if (isec) + bfd_init_private_section_data (isec->owner, isec, + output_bfd, s->bfd_section, + &link_info); } /* Make sure that all output sections mentioned in an expression are @@ -1756,7 +1761,7 @@ exp_init_os (etree_type *exp) os = lang_output_section_find (exp->name.name); if (os != NULL && os->bfd_section == NULL) - init_os (os); + init_os (os, NULL); } } break; @@ -1833,7 +1838,7 @@ lang_add_section (lang_statement_list_type *ptr, flagword flags; if (output->bfd_section == NULL) - init_os (output); + init_os (output, section); first = ! output->bfd_section->linker_has_input; output->bfd_section->linker_has_input = 1; @@ -3099,7 +3104,7 @@ map_input_to_output_sections are initialized. */ exp_init_os (s->data_statement.exp); if (os != NULL && os->bfd_section == NULL) - init_os (os); + init_os (os, NULL); /* The output section gets contents, and then we inspect for any flags set in the input script which override any ALLOC. */ os->bfd_section->flags |= SEC_HAS_CONTENTS; @@ -3113,11 +3118,11 @@ map_input_to_output_sections case lang_padding_statement_enum: case lang_input_statement_enum: if (os != NULL && os->bfd_section == NULL) - init_os (os); + init_os (os, NULL); break; case lang_assignment_statement_enum: if (os != NULL && os->bfd_section == NULL) - init_os (os); + init_os (os, NULL); /* Make sure that any sections mentioned in the assignment are initialized. */ @@ -3145,7 +3150,7 @@ map_input_to_output_sections (s->address_statement.section_name)); if (aos->bfd_section == NULL) - init_os (aos); + init_os (aos, NULL); aos->addr_tree = s->address_statement.address; } break; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 8c228b1..82f9b1b 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-23 H.J. Lu + + PR ld/1487 + * ld-ia64/tlspic.rd: Updated. + 2005-10-21 H.J. Lu PR ld/1467 diff --git a/ld/testsuite/ld-ia64/tlspic.rd b/ld/testsuite/ld-ia64/tlspic.rd index 2e9b2c8..c1efeb5 100644 --- a/ld/testsuite/ld-ia64/tlspic.rd +++ b/ld/testsuite/ld-ia64/tlspic.rd @@ -61,7 +61,6 @@ Symbol table '.dynsym' contains [0-9]+ entries: .* NOTYPE +LOCAL +DEFAULT +UND * .* SECTION LOCAL +DEFAULT +7 * .* SECTION LOCAL +DEFAULT +8 * -.* SECTION LOCAL +DEFAULT +9 * .* SECTION LOCAL +DEFAULT +10 * .* SECTION LOCAL +DEFAULT +11 * .* SECTION LOCAL +DEFAULT +14 * -- cgit v1.1