/* Filter what symbols of the output file to include in the import
library if one is created. */
- unsigned int (*elf_backend_filter_implib_symbols)
- (struct bfd_link_info *, asymbol **, long);
+ size_t (*elf_backend_filter_implib_symbols)
+ (struct bfd_link_info *, asymbol **, size_t);
/* Copy any information related to dynamic linking from a pre-existing
symbol to a newly created symbol. Also called to copy flags and
(bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
extern void bfd_elf_set_group_contents
(bfd *, asection *, void *);
-extern unsigned int _bfd_elf_filter_global_symbols
- (struct bfd_link_info *, asymbol **, long) ATTRIBUTE_HIDDEN;
+extern size_t _bfd_elf_filter_implib_symbols
+ (struct bfd_link_info *, asymbol **, size_t) ATTRIBUTE_HIDDEN;
extern asection *_bfd_elf_check_kept_section
(asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
#define _bfd_elf_link_just_syms _bfd_generic_link_just_syms
Returns the number of symbols to keep. */
-unsigned int
-_bfd_elf_filter_global_symbols (struct bfd_link_info *info,
- asymbol **syms, long symcount)
+size_t
+_bfd_elf_filter_implib_symbols (struct bfd_link_info *info,
+ asymbol **syms, size_t symcount)
{
- long src_count, dst_count = 0;
+ size_t src_count, dst_count = 0;
for (src_count = 0; src_count < symcount; src_count++)
{
asymbol *sym = syms[src_count];
- char *name = (char *) bfd_asymbol_name (sym);
+ const char *name = bfd_asymbol_name (sym);
struct bfd_link_hash_entry *h;
if (!sym_is_global (info->output_bfd, sym))
Returns the number of symbols to keep. */
-static unsigned int
+static size_t
elf32_arm_filter_cmse_symbols (struct bfd_link_info *info,
- asymbol **syms, long symcount)
+ asymbol **syms, size_t symcount)
{
size_t maxnamelen;
char *cmse_name;
- long src_count, dst_count = 0;
+ size_t src_count, dst_count = 0;
struct elf32_arm_link_hash_table *htab;
htab = elf32_arm_hash_table (info);
symcount = 0;
maxnamelen = 128;
- cmse_name = (char *) bfd_malloc (maxnamelen);
+ cmse_name = bfd_malloc (maxnamelen);
BFD_ASSERT (cmse_name);
for (src_count = 0; src_count < symcount; src_count++)
struct elf32_arm_link_hash_entry *cmse_hash;
asymbol *sym;
flagword flags;
- char *name;
+ const char *name;
size_t namelen;
sym = syms[src_count];
flags = sym->flags;
- name = (char *) bfd_asymbol_name (sym);
+ name = bfd_asymbol_name (sym);
if ((flags & BSF_FUNCTION) != BSF_FUNCTION)
continue;
namelen = strlen (name) + sizeof (CMSE_PREFIX) + 1;
if (namelen > maxnamelen)
{
- cmse_name = (char *)
- bfd_realloc (cmse_name, namelen);
+ cmse_name = bfd_realloc (cmse_name, namelen);
maxnamelen = namelen;
}
snprintf (cmse_name, maxnamelen, "%s%s", CMSE_PREFIX, name);
Returns the number of symbols to keep. */
-static unsigned int
+static size_t
elf32_arm_filter_implib_symbols (struct bfd_link_info *info,
- asymbol **syms, long symcount)
+ asymbol **syms, size_t symcount)
{
struct elf32_arm_link_hash_table *globals = elf32_arm_hash_table (info);
if (globals->cmse_implib)
return elf32_arm_filter_cmse_symbols (info, syms, symcount);
else
- return _bfd_elf_filter_global_symbols (info, syms, symcount);
+ return _bfd_elf_filter_implib_symbols (info, syms, symcount);
}
/* Allocate target specific section data. */
long symcount;
long src_count;
elf_symbol_type *osymbuf;
- size_t amt;
implib_bfd = info->out_implib_bfd;
obed = get_elf_backend_data (obfd);
return false;
/* Read in the symbol table. */
- sympp = (asymbol **) bfd_malloc (symsize);
+ sympp = bfd_malloc (symsize);
if (sympp == NULL)
return false;
goto free_sym_buf;
/* Filter symbols to appear in the import library. */
- if (obed->elf_backend_filter_implib_symbols)
- symcount = obed->elf_backend_filter_implib_symbols (info, sympp, symcount);
- else
- symcount = _bfd_elf_filter_global_symbols (info, sympp, symcount);
+ symcount = obed->elf_backend_filter_implib_symbols (info, sympp, symcount);
if (symcount == 0)
{
bfd_set_error (bfd_error_no_symbols);
goto free_sym_buf;
}
-
/* Make symbols absolute. */
- amt = symcount * sizeof (*osymbuf);
- osymbuf = (elf_symbol_type *) bfd_alloc (implib_bfd, amt);
+ osymbuf = bfd_alloc (implib_bfd, symcount * sizeof (*osymbuf));
if (osymbuf == NULL)
goto free_sym_buf;
for (src_count = 0; src_count < symcount; src_count++)
{
- memcpy (&osymbuf[src_count], (elf_symbol_type *) sympp[src_count],
- sizeof (*osymbuf));
+ memcpy (&osymbuf[src_count], sympp[src_count], sizeof (*osymbuf));
osymbuf[src_count].symbol.section = bfd_abs_section_ptr;
osymbuf[src_count].internal_elf_sym.st_shndx = SHN_ABS;
osymbuf[src_count].symbol.value += sympp[src_count]->section->vma;
#define elf_backend_output_arch_syms NULL
#endif
#ifndef elf_backend_filter_implib_symbols
-#define elf_backend_filter_implib_symbols NULL
+#define elf_backend_filter_implib_symbols _bfd_elf_filter_implib_symbols
#endif
#ifndef elf_backend_copy_indirect_symbol
#define elf_backend_copy_indirect_symbol _bfd_elf_link_hash_copy_indirect