for a symbol which is being forced to be local.
* elf32-i386.c (elf_i386_relocate_section): Write out the
relocation value for a GOT reloc for a symbol which is turning
into a local symbol.
(elf_i386_finish_dynamic_symbol): If a symbol is turning into a
local symbol, write out a RELATIVE reloc rather than a GLOB_DAT
reloc.
* elf32-m68k.c, elf32-sparc.c: Corresponding changes.
Wed Jun 11 00:00:07 1997 Ian Lance Taylor <ian@cygnus.com>
+ * elflink.h (elf_link_output_extsym): Call finish_dynamic_symbol
+ for a symbol which is being forced to be local.
+ * elf32-i386.c (elf_i386_relocate_section): Write out the
+ relocation value for a GOT reloc for a symbol which is turning
+ into a local symbol.
+ (elf_i386_finish_dynamic_symbol): If a symbol is turning into a
+ local symbol, write out a RELATIVE reloc rather than a GLOB_DAT
+ reloc.
+ * elf32-m68k.c, elf32-sparc.c: Corresponding changes.
+
* elf32-i386.c (elf_i386_relocate_section): Get the relocation
value if the symbol is turning into a local symbol.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elflink.h (elf_link_add_object_symbols): Also read verneed
information by calling `_bfd_elf_slurp_version_tables'.
(elf_link_add_object_symbols): For undefined symbols look for
- version informaiton in the verneed records.
+ version information in the verneed records.
(elf_link_add_object_symbols): Use soname of shared object
for verneed record if it is available.
|| (r_type == R_386_GOT32
&& elf_hash_table (info)->dynamic_sections_created
&& (! info->shared
- || ! info->symbolic
+ || (! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
|| (info->shared
if (! elf_hash_table (info)->dynamic_sections_created
|| (info->shared
- && info->symbolic
+ && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
- locally. We must initialize this entry in the
- global offset table. Since the offset must
- always be a multiple of 4, we use the least
- significant bit to record whether we have
+ locally, or the symbol was forced to be local
+ because of a version file. We must initialize
+ this entry in the global offset table. Since the
+ offset must always be a multiple of 4, we use the
+ least significant bit to record whether we have
initialized it already.
When doing a dynamic link, we create a .rel.got
/* This symbol has an entry in the global offset table. Set it
up. */
- BFD_ASSERT (h->dynindx != -1);
-
sgot = bfd_get_section_by_name (dynobj, ".got");
srel = bfd_get_section_by_name (dynobj, ".rel.got");
BFD_ASSERT (sgot != NULL && srel != NULL);
+ (h->got_offset &~ 1));
/* If this is a -Bsymbolic link, and the symbol is defined
- locally, we just want to emit a RELATIVE reloc. The entry in
- the global offset table will already have been initialized in
- the relocate_section function. */
+ locally, we just want to emit a RELATIVE reloc. Likewise if
+ the symbol was forced to be local because of a version file.
+ The entry in the global offset table will already have been
+ initialized in the relocate_section function. */
if (info->shared
- && info->symbolic
+ && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
else
"_GLOBAL_OFFSET_TABLE_") != 0))
&& elf_hash_table (info)->dynamic_sections_created
&& (! info->shared
- || ! info->symbolic
+ || (! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
|| (info->shared
if (!elf_hash_table (info)->dynamic_sections_created
|| (info->shared
- && info->symbolic
+ && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
- locally. We must initialize this entry in the
- global offset table. Since the offset must
- always be a multiple of 4, we use the least
- significant bit to record whether we have
- initialized it already.
+ locally, or the symbol was forced to be local
+ because of a version file.. We must initialize
+ this entry in the global offset table. Since
+ the offset must always be a multiple of 4, we
+ use the least significant bit to record whether
+ we have initialized it already.
When doing a dynamic link, we create a .rela.got
relocation entry to initialize the value. This
/* This symbol has an entry in the global offset table. Set it
up. */
- BFD_ASSERT (h->dynindx != -1);
-
sgot = bfd_get_section_by_name (dynobj, ".got");
srela = bfd_get_section_by_name (dynobj, ".rela.got");
BFD_ASSERT (sgot != NULL && srela != NULL);
+ (h->got_offset &~ 1));
/* If this is a -Bsymbolic link, and the symbol is defined
- locally, we just want to emit a RELATIVE reloc. The entry in
- the global offset table will already have been initialized in
- the relocate_section function. */
+ locally, we just want to emit a RELATIVE reloc. Likewise if
+ the symbol was forced to be local because of a version file.
+ The entry in the global offset table will already have been
+ initialized in the relocate_section function. */
if (info->shared
- && info->symbolic
+ && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE);
|| r_type == R_SPARC_GOT22)
&& elf_hash_table (info)->dynamic_sections_created
&& (! info->shared
- || ! info->symbolic
+ || (! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
|| (info->shared
if (! elf_hash_table (info)->dynamic_sections_created
|| (info->shared
- && info->symbolic
+ && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
- locally. We must initialize this entry in the
- global offset table. Since the offset must
- always be a multiple of 4, we use the least
- significant bit to record whether we have
+ locally, or the symbol was forced to be local
+ because of a version file. We must initialize
+ this entry in the global offset table. Since the
+ offset must always be a multiple of 4, we use the
+ least significant bit to record whether we have
initialized it already.
When doing a dynamic link, we create a .rela.got
/* This symbol has an entry in the global offset table. Set it
up. */
- BFD_ASSERT (h->dynindx != -1);
-
sgot = bfd_get_section_by_name (dynobj, ".got");
srela = bfd_get_section_by_name (dynobj, ".rela.got");
BFD_ASSERT (sgot != NULL && srela != NULL);
+ (h->got_offset &~ 1));
/* If this is a -Bsymbolic link, and the symbol is defined
- locally, we just want to emit a RELATIVE reloc. The entry in
- the global offset table will already have been initialized in
- the relocate_section function. */
+ locally, we just want to emit a RELATIVE reloc. Likewise if
+ the symbol was forced to be local because of a version file.
+ The entry in the global offset table will already have been
+ initialized in the relocate_section function. */
if (info->shared
- && info->symbolic
+ && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
else
((struct elf_link_hash_entry *) h->root.u.i.link, data));
}
+ /* Give the processor backend a chance to tweak the symbol value,
+ and also to finish up anything that needs to be done for this
+ symbol. */
+ if ((h->dynindx != -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ && elf_hash_table (finfo->info)->dynamic_sections_created)
+ {
+ struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (finfo->output_bfd);
+ if (! ((*bed->elf_backend_finish_dynamic_symbol)
+ (finfo->output_bfd, finfo->info, h, &sym)))
+ {
+ eoinfo->failed = true;
+ return false;
+ }
+ }
+
/* If this symbol should be put in the .dynsym section, then put it
there now. We have already know the symbol index. We also fill
in the entry in the .hash section. */
sym.st_name = h->dynstr_index;
- /* Give the processor backend a chance to tweak the symbol
- value, and also to finish up anything that needs to be done
- for this symbol. */
- bed = get_elf_backend_data (finfo->output_bfd);
- if (! ((*bed->elf_backend_finish_dynamic_symbol)
- (finfo->output_bfd, finfo->info, h, &sym)))
- {
- eoinfo->failed = true;
- return false;
- }
-
elf_swap_symbol_out (finfo->output_bfd, &sym,
(PTR) (((Elf_External_Sym *)
finfo->dynsym_sec->contents)