/* VxWorks support for ELF
- Copyright (C) 2005-2019 Free Software Foundation, Inc.
+ Copyright (C) 2005-2023 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Return true if symbol NAME, as defined by ABFD, is one of the special
__GOTT_BASE__ or __GOTT_INDEX__ symbols. */
-static bfd_boolean
+static bool
elf_vxworks_gott_symbol_p (bfd *abfd, const char *name)
{
char leading;
if (leading)
{
if (*name != leading)
- return FALSE;
+ return false;
name++;
}
return (strcmp (name, "__GOTT_BASE__") == 0
}
/* Tweak magic VxWorks symbols as they are loaded. */
-bfd_boolean
+bool
elf_vxworks_add_symbol_hook (bfd *abfd,
struct bfd_link_info *info,
Elf_Internal_Sym *sym,
*flagsp |= BSF_WEAK;
}
- return TRUE;
+ return true;
}
/* Perform VxWorks-specific handling of the create_dynamic_sections hook.
When creating an executable, set *SRELPLT2_OUT to the .rel(a).plt.unloaded
section. */
-bfd_boolean
+bool
elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info,
asection **srelplt2_out)
{
| SEC_LINKER_CREATED);
if (s == NULL
|| !bfd_set_section_alignment (s, bed->s->log_file_align))
- return FALSE;
+ return false;
*srelplt2_out = s;
}
htab->hgot->other &= ~ELF_ST_VISIBILITY (-1);
htab->hgot->forced_local = 0;
if (!bfd_elf_link_record_dynamic_symbol (info, htab->hgot))
- return FALSE;
+ return false;
}
if (htab->hplt)
{
htab->hplt->type = STT_FUNC;
}
- return TRUE;
+ return true;
}
/* Tweak magic VxWorks symbols as they are written to the output file. */
/* Copy relocations into the output file. Fixes up relocations against PLT
entries, then calls the generic routine. */
-bfd_boolean
+bool
elf_vxworks_emit_relocs (bfd *output_bfd,
asection *input_section,
Elf_Internal_Shdr *input_rel_hdr,
/* Set the sh_link and sh_info fields on the static plt relocation secton. */
-bfd_boolean
+bool
elf_vxworks_final_write_processing (bfd *abfd)
{
asection * sec;
/* Add the dynamic entries required by VxWorks. These point to the
tls sections. */
-bfd_boolean
+bool
elf_vxworks_add_dynamic_entries (bfd *output_bfd, struct bfd_link_info *info)
{
if (bfd_get_section_by_name (output_bfd, ".tls_data"))
if (!_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_START, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_SIZE, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_ALIGN, 0))
- return FALSE;
+ return false;
}
if (bfd_get_section_by_name (output_bfd, ".tls_vars"))
{
if (!_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_VARS_START, 0)
|| !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_VARS_SIZE, 0))
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/* If *DYN is one of the VxWorks-specific dynamic entries, then fill
in the value now and return TRUE. Otherwise return FALSE. */
-bfd_boolean
+bool
elf_vxworks_finish_dynamic_entry (bfd *output_bfd, Elf_Internal_Dyn *dyn)
{
asection *sec;
switch (dyn->d_tag)
{
default:
- return FALSE;
+ return false;
case DT_VX_WRS_TLS_DATA_START:
sec = bfd_get_section_by_name (output_bfd, ".tls_data");
dyn->d_un.d_val = sec->size;
break;
}
- return TRUE;
+ return true;
}
+/* Add dynamic tags. */
+bool
+_bfd_elf_maybe_vxworks_add_dynamic_tags (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bool need_dynamic_reloc)
+{
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+ return (_bfd_elf_add_dynamic_tags (output_bfd, info,
+ need_dynamic_reloc)
+ && (!htab->dynamic_sections_created
+ || htab->target_os != is_vxworks
+ || elf_vxworks_add_dynamic_entries (output_bfd, info)));
+}