summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-10-15 14:57:55 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-10-15 14:57:55 +0000
commitecca98713a19ac7aac31886b4b15b806e63d9a99 (patch)
tree8606d4daeccd04e698371f934ba62278dd283d25 /bfd
parentff0929e51c0e9c26e0cf1e6b7229803ccd7cc769 (diff)
downloadbinutils-ecca98713a19ac7aac31886b4b15b806e63d9a99.tar.gz
binutils-ecca98713a19ac7aac31886b4b15b806e63d9a99.tar.bz2
binutils-ecca98713a19ac7aac31886b4b15b806e63d9a99.zip
bfd/
2005-10-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/1467 * elf-bfd.h (_bfd_elf_match_sections_by_type): New. (_bfd_generic_match_sections_by_type): New. Defined. * elf.c (_bfd_elf_match_sections_by_type): New. * libbfd-in.h (_bfd_generic_match_sections_by_type): New. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. * libbfd.c (_bfd_generic_match_sections_by_type): New. * targets.c (BFD_JUMP_TABLE_LINK): Initialize _bfd_match_sections_by_type with _bfd_generic_match_sections_by_type. (bfd_target): Add _bfd_match_sections_by_type. ld/ 2005-10-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/1467 * emultempl/elf32.em: Include "elf-bfd.h". (gld${EMULATION_NAME}_place_orphan): Check section type and don't use section name for ELF input sections. * ld.texinfo: Document orphan section processing. * ldlang.c (lang_output_section_find_by_flags): Match section types by calling bfd_match_sections_by_type.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog20
-rw-r--r--bfd/bfd-in2.h7
-rw-r--r--bfd/elf-bfd.h4
-rw-r--r--bfd/elf.c15
-rw-r--r--bfd/libbfd-in.h2
-rw-r--r--bfd/libbfd.c9
-rw-r--r--bfd/libbfd.h2
-rw-r--r--bfd/targets.c7
8 files changed, 66 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fdf28092563..e940c9398a3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,23 @@
+2005-10-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/1467
+ * elf-bfd.h (_bfd_elf_match_sections_by_type): New.
+ (_bfd_generic_match_sections_by_type): New. Defined.
+
+ * elf.c (_bfd_elf_match_sections_by_type): New.
+
+ * libbfd-in.h (_bfd_generic_match_sections_by_type): New.
+
+ * bfd-in2.h: Regenerated.
+ * libbfd.h: Likewise.
+
+ * libbfd.c (_bfd_generic_match_sections_by_type): New.
+
+ * targets.c (BFD_JUMP_TABLE_LINK): Initialize
+ _bfd_match_sections_by_type with
+ _bfd_generic_match_sections_by_type.
+ (bfd_target): Add _bfd_match_sections_by_type.
+
2005-10-08 Paul Brook <paul@codesourcery.com>
* elf32-arm.c: Move #include "elf/arm.h" after libbfd.h.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 347108157a7..1d93b0f3050 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -4926,6 +4926,7 @@ typedef struct bfd_target
NAME##_bfd_link_split_section, \
NAME##_bfd_gc_sections, \
NAME##_bfd_merge_sections, \
+ _bfd_generic_match_sections_by_type, \
NAME##_bfd_is_group_section, \
NAME##_bfd_discard_group, \
NAME##_section_already_linked \
@@ -4965,6 +4966,12 @@ typedef struct bfd_target
/* Attempt to merge SEC_MERGE sections. */
bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
+#define bfd_match_sections_by_type(abfd, asec, bbfd, bsec) \
+ BFD_SEND (abfd, _bfd_match_sections_by_type, (abfd, asec, bbfd, bsec))
+ /* Return TRUE if 2 section types are compatible. */
+ bfd_boolean (*_bfd_match_sections_by_type)
+ (bfd *, const asection *, bfd *, const asection *);
+
/* Is this section a member of a group? */
bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index f4c0ed888c8..d011a454ee7 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1474,6 +1474,10 @@ extern bfd_boolean _bfd_elf_slurp_version_tables
(bfd *, bfd_boolean);
extern bfd_boolean _bfd_elf_merge_sections
(bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_match_sections_by_type
+ (bfd *, const asection *, bfd *, const asection *);
+#define _bfd_generic_match_sections_by_type \
+ _bfd_elf_match_sections_by_type
extern bfd_boolean bfd_elf_is_group_section
(bfd *, const struct bfd_section *);
extern void _bfd_elf_section_already_linked
diff --git a/bfd/elf.c b/bfd/elf.c
index 435622d219d..3a139a0bcf0 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8502,3 +8502,18 @@ asection _bfd_elf_large_com_section
= BFD_FAKE_SECTION (_bfd_elf_large_com_section,
SEC_IS_COMMON, NULL, NULL, "LARGE_COMMON",
0);
+
+/* Return TRUE if 2 section types are compatible. */
+
+bfd_boolean
+_bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec,
+ bfd *bbfd, const asection *bsec)
+{
+ if (asec == NULL
+ || bsec == NULL
+ || abfd->xvec->flavour != bfd_target_elf_flavour
+ || bbfd->xvec->flavour != bfd_target_elf_flavour)
+ return TRUE;
+
+ return elf_section_type (asec) == elf_section_type (bsec);
+}
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 47595c6bf51..0290c84eda3 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -399,6 +399,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
#define _bfd_nolink_section_already_linked \
((void (*) (bfd *, struct bfd_section *)) bfd_void)
+extern bfd_boolean _bfd_generic_match_sections_by_type
+ (bfd *, const asection *, bfd *, const asection *);
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 66137bb6107..3b27e08a8f3 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1033,3 +1033,12 @@ _bfd_generic_find_line (bfd *abfd ATTRIBUTE_UNUSED,
{
return FALSE;
}
+
+bfd_boolean
+_bfd_generic_match_sections_by_type (bfd *abfd ATTRIBUTE_UNUSED,
+ const asection *asec ATTRIBUTE_UNUSED,
+ bfd *bbfd ATTRIBUTE_UNUSED,
+ const asection *bsec ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 6f3650b30bf..56ad092983f 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -404,6 +404,8 @@ extern bfd_boolean _bfd_generic_set_section_contents
((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
#define _bfd_nolink_section_already_linked \
((void (*) (bfd *, struct bfd_section *)) bfd_void)
+extern bfd_boolean _bfd_generic_match_sections_by_type
+ (bfd *, const asection *, bfd *, const asection *);
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
diff --git a/bfd/targets.c b/bfd/targets.c
index dd5e0972676..271954fd9c0 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -427,6 +427,7 @@ BFD_JUMP_TABLE macros.
. NAME##_bfd_link_split_section, \
. NAME##_bfd_gc_sections, \
. NAME##_bfd_merge_sections, \
+. _bfd_generic_match_sections_by_type, \
. NAME##_bfd_is_group_section, \
. NAME##_bfd_discard_group, \
. NAME##_section_already_linked \
@@ -466,6 +467,12 @@ BFD_JUMP_TABLE macros.
. {* Attempt to merge SEC_MERGE sections. *}
. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
.
+.#define bfd_match_sections_by_type(abfd, asec, bbfd, bsec) \
+. BFD_SEND (abfd, _bfd_match_sections_by_type, (abfd, asec, bbfd, bsec))
+. {* Return TRUE if 2 section types are compatible. *}
+. bfd_boolean (*_bfd_match_sections_by_type)
+. (bfd *, const asection *, bfd *, const asection *);
+.
. {* Is this section a member of a group? *}
. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
.