aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2006-07-19 01:50:23 +0000
committerAlan Modra <amodra@gmail.com>2006-07-19 01:50:23 +0000
commit5061a8853b6f8fb5af87b8ff4a0f7a2460ad333b (patch)
treeb5e392f1de6b43f8e366486604178ea4c1c29046 /bfd
parent9148c4581c6a76a5acfea144685fdd700a103dfe (diff)
downloadgdb-5061a8853b6f8fb5af87b8ff4a0f7a2460ad333b.zip
gdb-5061a8853b6f8fb5af87b8ff4a0f7a2460ad333b.tar.gz
gdb-5061a8853b6f8fb5af87b8ff4a0f7a2460ad333b.tar.bz2
bfd/
* bfd-in.h (enum notice_asneeded_action): Define. * bfd-in2.h: Regenerate. * elflink.c (elf_link_add_object_symbols): Call linker "notice" function with NULL name for as-needed handling. ld/ * ld.h (handle_asneeded_cref): Declare. * ldcref.c: Include objalloc.h. (old_table, old_count, old_tab, alloc_mark): New variables. (tabsize, entsize, refsize, old_symcount): Likewise. (add_cref): Use bfd_hash_allocate for refs. (handle_asneeded_cref): New function. * ldmain.c (notice): Call handle_asneeded_cref for NULL name.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/bfd-in.h6
-rw-r--r--bfd/bfd-in2.h6
-rw-r--r--bfd/elflink.c16
4 files changed, 35 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4ce004e..55e6b54 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-19 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h (enum notice_asneeded_action): Define.
+ * bfd-in2.h: Regenerate.
+ * elflink.c (elf_link_add_object_symbols): Call linker "notice"
+ function with NULL name for as-needed handling.
+
2006-07-18 Paul Brook <paul@codesourcery.com>
* bfd-in2.h: Regenerate.
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index ff9dcd6..6ceb0db 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -638,6 +638,12 @@ enum dynamic_lib_link_class {
DYN_NO_NEEDED = 8
};
+enum notice_asneeded_action {
+ notice_as_needed,
+ notice_not_needed,
+ notice_needed
+};
+
extern bfd_boolean bfd_elf_record_link_assignment
(bfd *, struct bfd_link_info *, const char *, bfd_boolean,
bfd_boolean);
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 381ae55..b75c8e2 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -645,6 +645,12 @@ enum dynamic_lib_link_class {
DYN_NO_NEEDED = 8
};
+enum notice_asneeded_action {
+ notice_as_needed,
+ notice_not_needed,
+ notice_needed
+};
+
extern bfd_boolean bfd_elf_record_link_assignment
(bfd *, struct bfd_link_info *, const char *, bfd_boolean,
bfd_boolean);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index c52b42e..99f0acc 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3551,6 +3551,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (alloc_mark == NULL)
goto error_free_vers;
+ /* Make a special call to the linker "notice" function to
+ tell it that we are about to handle an as-needed lib. */
+ if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
+ notice_as_needed))
+ return FALSE;
+
+
/* Clone the symbol table and sym hashes. Remember some
pointers into the symbol table, and dynamic symbol count. */
old_hash = (char *) old_tab + tabsize;
@@ -4241,6 +4248,12 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
}
+ /* Make a special call to the linker "notice" function to
+ tell it that symbols added for crefs may need to be removed. */
+ if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
+ notice_not_needed))
+ return FALSE;
+
free (old_tab);
objalloc_free_block ((struct objalloc *) htab->root.table.memory,
alloc_mark);
@@ -4251,6 +4264,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (old_tab != NULL)
{
+ if (!(*info->callbacks->notice) (info, NULL, abfd, NULL,
+ notice_needed))
+ return FALSE;
free (old_tab);
old_tab = NULL;
}