aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-12-18 12:15:35 +0000
committerJakub Jelinek <jakub@redhat.com>2001-12-18 12:15:35 +0000
commit6b9b879a0267f1d994d3d4fbdcbcc2d6643498df (patch)
tree2a1339c63dc23a0489e64506aa735f71abf3a2c8
parentb667df2e28e04351ea2ee5b6fd32b51d4a302130 (diff)
downloadgdb-6b9b879a0267f1d994d3d4fbdcbcc2d6643498df.zip
gdb-6b9b879a0267f1d994d3d4fbdcbcc2d6643498df.tar.gz
gdb-6b9b879a0267f1d994d3d4fbdcbcc2d6643498df.tar.bz2
* ldgram.y (vers_node): Support anonymous version tags.
* ldlang.c (lang_register_vers_node): Ensure anonymous version tag is not defined together with non-anonymous versions. * ld.texinfo: Document it. * elflink.h (size_dynamic_sections): Skip anonymous version tag. (elf_link_assign_sym_version): Don't count anonymous version tag.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.h7
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/ld.texinfo9
-rw-r--r--ld/ldgram.y6
-rw-r--r--ld/ldlang.c19
6 files changed, 50 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e760aa3..723bfbf 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2001-12-18 Jakub Jelinek <jakub@redhat.com>
+ * elflink.h (size_dynamic_sections): Skip anonymous version tag.
+ (elf_link_assign_sym_version): Don't count anonymous version tag.
+
+2001-12-18 Jakub Jelinek <jakub@redhat.com>
+
* elf-eh-frame.c (struct cie): Add make_lsda_relative.
(struct eh_cie_fde): Add lsda_encoding, lsda_offset,
make_lsda_relative.
diff --git a/bfd/elflink.h b/bfd/elflink.h
index f5eb277..0087260 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -3246,6 +3246,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
just linking a regular application. */
verdefs = asvinfo.verdefs;
+ /* Skip anonymous version tag. */
+ if (verdefs != NULL && verdefs->vernum == 0)
+ verdefs = verdefs->next;
+
if (verdefs == NULL)
_bfd_strip_section_from_output (info, s);
else
@@ -4307,6 +4311,9 @@ elf_link_assign_sym_version (h, data)
t->used = true;
version_index = 1;
+ /* Don't count anonymous version tag. */
+ if (sinfo->verdefs != NULL && sinfo->verdefs->vernum == 0)
+ version_index = 0;
for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next)
++version_index;
t->vernum = version_index;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7ce98c8..c4f9443 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2001-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ * ldgram.y (vers_node): Support anonymous version tags.
+ * ldlang.c (lang_register_vers_node): Ensure anonymous version
+ tag is not defined together with non-anonymous versions.
+ * ld.texinfo: Document it.
+
2001-12-18 Nick Clifton <nickc@cambridge.redhat.com>
* po/tr.po: New file: Turkish translation.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 1967ef5..5594446 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -3685,6 +3685,15 @@ they might suggest to the person reading them. The @samp{2.0} version
could just as well have appeared in between @samp{1.1} and @samp{1.2}.
However, this would be a confusing way to write a version script.
+Node name can be omited, provided it is the only version node
+in the version script. Such version script doesn't assign any versions to
+symbols, only selects which symbols will be globally visible out and which
+won't.
+
+@smallexample
+@{ global: foo; bar; local: *; @}
+#end smallexample
+
When you link an application against a shared library that has versioned
symbols, the application itself knows which version of each symbol it
requires, and it also knows which version nodes it needs from each
diff --git a/ld/ldgram.y b/ld/ldgram.y
index c57ad15..f1924a0 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -1061,7 +1061,11 @@ vers_nodes:
;
vers_node:
- VERS_TAG '{' vers_tag '}' ';'
+ '{' vers_tag '}' ';'
+ {
+ lang_register_vers_node (NULL, $2, NULL);
+ }
+ | VERS_TAG '{' vers_tag '}' ';'
{
lang_register_vers_node ($1, $3, NULL);
}
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 9994cf8..afce0fa 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5031,6 +5031,16 @@ lang_register_vers_node (name, version, deps)
struct bfd_elf_version_tree *t, **pp;
struct bfd_elf_version_expr *e1;
+ if (name == NULL)
+ name = "";
+
+ if ((name[0] == '\0' && lang_elf_version_info != NULL)
+ || (lang_elf_version_info && lang_elf_version_info->name[0] == '\0'))
+ {
+ einfo (_("%X%P: anonymous version tag cannot be combined with other version tags\n"));
+ return;
+ }
+
/* Make sure this node has a unique name. */
for (t = lang_elf_version_info; t != NULL; t = t->next)
if (strcmp (t->name, name) == 0)
@@ -5067,8 +5077,13 @@ lang_register_vers_node (name, version, deps)
version->deps = deps;
version->name = name;
- ++version_index;
- version->vernum = version_index;
+ if (name[0] != '\0')
+ {
+ ++version_index;
+ version->vernum = version_index;
+ }
+ else
+ version->vernum = 0;
for (pp = &lang_elf_version_info; *pp != NULL; pp = &(*pp)->next)
;