+2015-07-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/18735
+ * elflink.c (_bfd_elf_add_default_symbol): Add the default
+ symbol if not performing a relocatable link.
+ (elf_link_add_object_symbols): Adjust the default symbol if
+ not performing a relocatable link.
+
2015-07-29 H.J. Lu <hongjiu.lu@intel.com>
* elflink.c (elf_link_add_object_symbols): Remove
if (! override)
{
- bh = &hi->root;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
- 0, name, FALSE, collect, &bh)))
- return FALSE;
- hi = (struct elf_link_hash_entry *) bh;
+ /* Add the default symbol if not performing a relocatable link. */
+ if (! info->relocatable)
+ {
+ bh = &hi->root;
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, shortname, BSF_INDIRECT,
+ bfd_ind_section_ptr,
+ 0, name, FALSE, collect, &bh)))
+ return FALSE;
+ hi = (struct elf_link_hash_entry *) bh;
+ }
}
else
{
old_tab = NULL;
}
- /* Now that all the symbols from this input file are created, handle
- .symver foo, foo@BAR such that any relocs against foo become foo@BAR. */
- if (nondeflt_vers != NULL)
+ /* Now that all the symbols from this input file are created, if
+ not performing a relocatable link, handle .symver foo, foo@BAR
+ such that any relocs against foo become foo@BAR. */
+ if (!info->relocatable && nondeflt_vers != NULL)
{
bfd_size_type cnt, symidx;
+2015-07-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/18735
+ * ld-elf/pr18735.d: New file.
+ * ld-elf/pr18735.s: Likewise.
+
2015-07-29 H.J. Lu <hongjiu.lu@intel.com>
* ld-elf/pr18718.c (bar): Use noclone attribute only for GCC
--- /dev/null
+#ld: -r
+#readelf: -s
+
+Symbol table '.symtab' contains .* entries:
+#...
+[ ]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +foo@FOO
+[ ]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +bar@@FOO
+[ ]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +foo
+[ ]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +bar
+#pass