#define LOG_FILE_ALIGN 2
#endif
-/* Static functions */
-
-static void elf_swap_ehdr_in
- PARAMS ((bfd *, const Elf_External_Ehdr *, Elf_Internal_Ehdr *));
-static void elf_swap_ehdr_out
- PARAMS ((bfd *, const Elf_Internal_Ehdr *, Elf_External_Ehdr *));
-static void elf_swap_shdr_in
- PARAMS ((bfd *, const Elf_External_Shdr *, Elf_Internal_Shdr *));
-static void elf_swap_shdr_out
- PARAMS ((bfd *, const Elf_Internal_Shdr *, Elf_External_Shdr *));
-
#define elf_stringtab_init _bfd_elf_stringtab_init
#define section_from_elf_index bfd_section_from_elf_index
-static bfd_boolean elf_slurp_reloc_table_from_section
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type,
- arelent *, asymbol **, bfd_boolean));
-
-static bfd_boolean elf_file_p PARAMS ((Elf_External_Ehdr *));
-
#ifdef DEBUG
-static void elf_debug_section PARAMS ((int, Elf_Internal_Shdr *));
-static void elf_debug_file PARAMS ((Elf_Internal_Ehdr *));
-static char *elf_symbol_flags PARAMS ((flagword));
+static void elf_debug_section (int, Elf_Internal_Shdr *);
+static void elf_debug_file (Elf_Internal_Ehdr *);
+static char *elf_symbol_flags (flagword);
#endif
\f
/* Structure swapping routines */
format. */
void
-elf_swap_symbol_in (abfd, psrc, pshn, dst)
- bfd *abfd;
- const PTR psrc;
- const PTR pshn;
- Elf_Internal_Sym *dst;
+elf_swap_symbol_in (bfd *abfd,
+ const void *psrc,
+ const void *pshn,
+ Elf_Internal_Sym *dst)
{
- const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
- const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
+ const Elf_External_Sym *src = psrc;
+ const Elf_External_Sym_Shndx *shndx = pshn;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = H_GET_32 (abfd, src->st_name);
format. */
void
-elf_swap_symbol_out (abfd, src, cdst, shndx)
- bfd *abfd;
- const Elf_Internal_Sym *src;
- PTR cdst;
- PTR shndx;
+elf_swap_symbol_out (bfd *abfd,
+ const Elf_Internal_Sym *src,
+ void *cdst,
+ void *shndx)
{
unsigned int tmp;
- Elf_External_Sym *dst = (Elf_External_Sym *) cdst;
+ Elf_External_Sym *dst = cdst;
H_PUT_32 (abfd, src->st_name, dst->st_name);
H_PUT_WORD (abfd, src->st_value, dst->st_value);
H_PUT_WORD (abfd, src->st_size, dst->st_size);
internal format. */
static void
-elf_swap_ehdr_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Ehdr *src;
- Elf_Internal_Ehdr *dst;
+elf_swap_ehdr_in (bfd *abfd,
+ const Elf_External_Ehdr *src,
+ Elf_Internal_Ehdr *dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
external format. */
static void
-elf_swap_ehdr_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Ehdr *src;
- Elf_External_Ehdr *dst;
+elf_swap_ehdr_out (bfd *abfd,
+ const Elf_Internal_Ehdr *src,
+ Elf_External_Ehdr *dst)
{
unsigned int tmp;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
ELF section header table entry in internal format. */
static void
-elf_swap_shdr_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Shdr *src;
- Elf_Internal_Shdr *dst;
+elf_swap_shdr_in (bfd *abfd,
+ const Elf_External_Shdr *src,
+ Elf_Internal_Shdr *dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
ELF section header table entry in external format. */
static void
-elf_swap_shdr_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Shdr *src;
- Elf_External_Shdr *dst;
+elf_swap_shdr_out (bfd *abfd,
+ const Elf_Internal_Shdr *src,
+ Elf_External_Shdr *dst)
{
/* note that all elements of dst are *arrays of unsigned char* already... */
H_PUT_32 (abfd, src->sh_name, dst->sh_name);
ELF program header table entry in internal format. */
void
-elf_swap_phdr_in (abfd, src, dst)
- bfd *abfd;
- const Elf_External_Phdr *src;
- Elf_Internal_Phdr *dst;
+elf_swap_phdr_in (bfd *abfd,
+ const Elf_External_Phdr *src,
+ Elf_Internal_Phdr *dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
}
void
-elf_swap_phdr_out (abfd, src, dst)
- bfd *abfd;
- const Elf_Internal_Phdr *src;
- Elf_External_Phdr *dst;
+elf_swap_phdr_out (bfd *abfd,
+ const Elf_Internal_Phdr *src,
+ Elf_External_Phdr *dst)
{
/* note that all elements of dst are *arrays of unsigned char* already... */
H_PUT_32 (abfd, src->p_type, dst->p_type);
/* Translate an ELF reloc from external format to internal format. */
void
-elf_swap_reloc_in (abfd, s, dst)
- bfd *abfd;
- const bfd_byte *s;
- Elf_Internal_Rela *dst;
+elf_swap_reloc_in (bfd *abfd,
+ const bfd_byte *s,
+ Elf_Internal_Rela *dst)
{
const Elf_External_Rel *src = (const Elf_External_Rel *) s;
dst->r_offset = H_GET_WORD (abfd, src->r_offset);
}
void
-elf_swap_reloca_in (abfd, s, dst)
- bfd *abfd;
- const bfd_byte *s;
- Elf_Internal_Rela *dst;
+elf_swap_reloca_in (bfd *abfd,
+ const bfd_byte *s,
+ Elf_Internal_Rela *dst)
{
const Elf_External_Rela *src = (const Elf_External_Rela *) s;
dst->r_offset = H_GET_WORD (abfd, src->r_offset);
/* Translate an ELF reloc from internal format to external format. */
void
-elf_swap_reloc_out (abfd, src, d)
- bfd *abfd;
- const Elf_Internal_Rela *src;
- bfd_byte *d;
+elf_swap_reloc_out (bfd *abfd,
+ const Elf_Internal_Rela *src,
+ bfd_byte *d)
{
Elf_External_Rel *dst = (Elf_External_Rel *) d;
H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
}
void
-elf_swap_reloca_out (abfd, src, d)
- bfd *abfd;
- const Elf_Internal_Rela *src;
- bfd_byte *d;
+elf_swap_reloca_out (bfd *abfd,
+ const Elf_Internal_Rela *src,
+ bfd_byte *d)
{
Elf_External_Rela *dst = (Elf_External_Rela *) d;
H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
H_PUT_SIGNED_WORD (abfd, src->r_addend, dst->r_addend);
}
-INLINE void
-elf_swap_dyn_in (abfd, p, dst)
- bfd *abfd;
- const PTR p;
- Elf_Internal_Dyn *dst;
+void
+elf_swap_dyn_in (bfd *abfd,
+ const void *p,
+ Elf_Internal_Dyn *dst)
{
- const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
+ const Elf_External_Dyn *src = p;
dst->d_tag = H_GET_WORD (abfd, src->d_tag);
dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val);
}
-INLINE void
-elf_swap_dyn_out (abfd, src, p)
- bfd *abfd;
- const Elf_Internal_Dyn *src;
- PTR p;
+void
+elf_swap_dyn_out (bfd *abfd,
+ const Elf_Internal_Dyn *src,
+ void *p)
{
- Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
+ Elf_External_Dyn *dst = p;
H_PUT_WORD (abfd, src->d_tag, dst->d_tag);
H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val);
First we validate the file by reading in the ELF header and checking
the magic number. */
-static INLINE bfd_boolean
-elf_file_p (x_ehdrp)
- Elf_External_Ehdr *x_ehdrp;
+static inline bfd_boolean
+elf_file_p (Elf_External_Ehdr *x_ehdrp)
{
return ((x_ehdrp->e_ident[EI_MAG0] == ELFMAG0)
&& (x_ehdrp->e_ident[EI_MAG1] == ELFMAG1)
file does not match the target vector. */
const bfd_target *
-elf_object_p (abfd)
- bfd *abfd;
+elf_object_p (bfd *abfd)
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
/* Read in the ELF header in external format. */
- if (bfd_bread ((PTR) & x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd)
- != sizeof (x_ehdr))
+ if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
goto got_wrong_format_error;
/* Read the first section header at index 0, and convert to internal
form. */
- if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
- != sizeof (x_shdr))
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
unsigned int num_sec;
amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
- i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ i_shdrp = bfd_alloc (abfd, amt);
if (!i_shdrp)
goto got_no_match;
num_sec = i_ehdrp->e_shnum;
num_sec += SHN_HIRESERVE + 1 - SHN_LORESERVE;
elf_numsections (abfd) = num_sec;
amt = sizeof (i_shdrp) * num_sec;
- elf_elfsections (abfd) = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
+ elf_elfsections (abfd) = bfd_alloc (abfd, amt);
if (!elf_elfsections (abfd))
goto got_no_match;
to internal form. */
for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
{
- if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
- != sizeof (x_shdr))
+ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
unsigned int i;
amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr);
- elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
+ elf_tdata (abfd)->phdr = bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
{
Elf_External_Phdr x_phdr;
- if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof x_phdr, abfd)
- != sizeof x_phdr)
+ if (bfd_bread (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
goto got_no_match;
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
}
/* Write out the relocs. */
void
-elf_write_relocs (abfd, sec, data)
- bfd *abfd;
- asection *sec;
- PTR data;
+elf_write_relocs (bfd *abfd, asection *sec, void *data)
{
- bfd_boolean *failedp = (bfd_boolean *) data;
+ bfd_boolean *failedp = data;
Elf_Internal_Shdr *rela_hdr;
bfd_vma addr_offset;
void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
rela_hdr = &elf_section_data (sec)->rel_hdr;
rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
- rela_hdr->contents = (PTR) bfd_alloc (abfd, rela_hdr->sh_size);
+ rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
if (rela_hdr->contents == NULL)
{
*failedp = TRUE;
/* Write out the program headers. */
int
-elf_write_out_phdrs (abfd, phdr, count)
- bfd *abfd;
- const Elf_Internal_Phdr *phdr;
- unsigned int count;
+elf_write_out_phdrs (bfd *abfd,
+ const Elf_Internal_Phdr *phdr,
+ unsigned int count)
{
while (count--)
{
Elf_External_Phdr extphdr;
elf_swap_phdr_out (abfd, phdr, &extphdr);
- if (bfd_bwrite (&extphdr, (bfd_size_type) sizeof (Elf_External_Phdr),
- abfd) != sizeof (Elf_External_Phdr))
+ if (bfd_bwrite (&extphdr, sizeof (Elf_External_Phdr), abfd)
+ != sizeof (Elf_External_Phdr))
return -1;
phdr++;
}
/* Write out the section headers and the ELF file header. */
bfd_boolean
-elf_write_shdrs_and_ehdr (abfd)
- bfd *abfd;
+elf_write_shdrs_and_ehdr (bfd *abfd)
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
amt = sizeof (x_ehdr);
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite ((PTR) & x_ehdr, amt, abfd) != amt)
+ || bfd_bwrite (&x_ehdr, amt, abfd) != amt)
return FALSE;
/* Some fields in the first section header handle overflow of ehdr
/* at this point we've concocted all the ELF sections... */
amt = i_ehdrp->e_shnum;
amt *= sizeof (*x_shdrp);
- x_shdrp = (Elf_External_Shdr *) bfd_alloc (abfd, amt);
+ x_shdrp = bfd_alloc (abfd, amt);
if (!x_shdrp)
return FALSE;
i_shdrp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
- || bfd_bwrite ((PTR) x_shdrp, amt, abfd) != amt)
+ || bfd_bwrite (x_shdrp, amt, abfd) != amt)
return FALSE;
/* need to dump the string table too... */
}
long
-elf_slurp_symbol_table (abfd, symptrs, dynamic)
- bfd *abfd;
- asymbol **symptrs; /* Buffer for generated bfd symbols */
- bfd_boolean dynamic;
+elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
{
Elf_Internal_Shdr *hdr;
Elf_Internal_Shdr *verhdr;
amt = symcount;
amt *= sizeof (elf_symbol_type);
- symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
+ symbase = bfd_zalloc (abfd, amt);
if (symbase == (elf_symbol_type *) NULL)
goto error_return;
if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0)
goto error_return;
- xverbuf = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size);
+ xverbuf = bfd_malloc (verhdr->sh_size);
if (xverbuf == NULL && verhdr->sh_size != 0)
goto error_return;
- if (bfd_bread ((PTR) xverbuf, verhdr->sh_size, abfd)
- != verhdr->sh_size)
+ if (bfd_bread (xverbuf, verhdr->sh_size, abfd) != verhdr->sh_size)
goto error_return;
}
them. */
static bfd_boolean
-elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
- relents, symbols, dynamic)
- bfd *abfd;
- asection *asect;
- Elf_Internal_Shdr *rel_hdr;
- bfd_size_type reloc_count;
- arelent *relents;
- asymbol **symbols;
- bfd_boolean dynamic;
+elf_slurp_reloc_table_from_section (bfd *abfd,
+ asection *asect,
+ Elf_Internal_Shdr *rel_hdr,
+ bfd_size_type reloc_count,
+ arelent *relents,
+ asymbol **symbols,
+ bfd_boolean dynamic)
{
struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
- PTR allocated = NULL;
+ void *allocated = NULL;
bfd_byte *native_relocs;
arelent *relent;
unsigned int i;
int entsize;
unsigned int symcount;
- allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
+ allocated = bfd_malloc (rel_hdr->sh_size);
if (allocated == NULL)
goto error_return;
!= rel_hdr->sh_size))
goto error_return;
- native_relocs = (bfd_byte *) allocated;
+ native_relocs = allocated;
entsize = rel_hdr->sh_entsize;
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
/* Read in and swap the external relocs. */
bfd_boolean
-elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
- bfd *abfd;
- asection *asect;
- asymbol **symbols;
- bfd_boolean dynamic;
+elf_slurp_reloc_table (bfd *abfd,
+ asection *asect,
+ asymbol **symbols,
+ bfd_boolean dynamic)
{
struct bfd_elf_section_data * const d = elf_section_data (asect);
Elf_Internal_Shdr *rel_hdr;
}
amt = (reloc_count + reloc_count2) * sizeof (arelent);
- relents = (arelent *) bfd_alloc (abfd, amt);
+ relents = bfd_alloc (abfd, amt);
if (relents == NULL)
return FALSE;
#ifdef DEBUG
static void
-elf_debug_section (num, hdr)
- int num;
- Elf_Internal_Shdr *hdr;
+elf_debug_section (int num, Elf_Internal_Shdr *hdr)
{
fprintf (stderr, "\nSection#%d '%s' 0x%.8lx\n", num,
hdr->bfd_section != NULL ? hdr->bfd_section->name : "",
}
static void
-elf_debug_file (ehdrp)
- Elf_Internal_Ehdr *ehdrp;
+elf_debug_file (Elf_Internal_Ehdr *ehdrp)
{
fprintf (stderr, "e_entry = 0x%.8lx\n", (long) ehdrp->e_entry);
fprintf (stderr, "e_phoff = %ld\n", (long) ehdrp->e_phoff);
}
static char *
-elf_symbol_flags (flags)
- flagword flags;
+elf_symbol_flags (flagword flags)
{
static char buffer[1024];
remote memory. */
bfd *
-NAME(_bfd_elf,bfd_from_remote_memory) (templ, ehdr_vma, loadbasep,
- target_read_memory)
- bfd *templ;
- bfd_vma ehdr_vma;
- bfd_vma *loadbasep;
- int (*target_read_memory) PARAMS ((bfd_vma vma, char *myaddr, int len));
+NAME(_bfd_elf,bfd_from_remote_memory)
+ (bfd *templ,
+ bfd_vma ehdr_vma,
+ bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int))
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
return NULL;
}
- x_phdrs = (Elf_External_Phdr *)
- bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
+ x_phdrs = bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
if (x_phdrs == NULL)
{
bfd_set_error (bfd_error_no_memory);
contents_size = last_phdr->p_offset + last_phdr->p_filesz;
/* Now we know the size of the whole image we want read in. */
- contents = (char *) bfd_zmalloc ((bfd_size_type) contents_size);
+ contents = bfd_zmalloc (contents_size);
if (contents == NULL)
{
free (x_phdrs);
memcpy (contents, &x_ehdr, sizeof x_ehdr);
/* Now we have a memory image of the ELF file contents. Make a BFD. */
- bim = ((struct bfd_in_memory *)
- bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
+ bim = bfd_malloc (sizeof (struct bfd_in_memory));
if (bim == NULL)
{
free (contents);
nbfd->xvec = templ->xvec;
bim->size = contents_size;
bim->buffer = contents;
- nbfd->iostream = (PTR) bim;
+ nbfd->iostream = bim;
nbfd->flags = BFD_IN_MEMORY;
nbfd->direction = read_direction;
nbfd->mtime = time (NULL);
#define ARCH_SIZE 0
#include "elf-bfd.h"
-static bfd_boolean elf_link_read_relocs_from_section
- PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *));
-
bfd_boolean
-_bfd_elf_create_got_section (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+_bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
{
flagword flags;
asection *s;
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, (const char *) NULL, FALSE,
- bed->collect, &bh)))
+ bed->got_symbol_offset, NULL, FALSE, bed->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
actual contents and size of these sections later. */
bfd_boolean
-_bfd_elf_link_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+_bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
flagword flags;
register asection *s;
code examines it to decide how to initialize the process. */
bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, (bfd_vma) 0,
- (const char *) 0, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
+ (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, 0, NULL, FALSE,
+ get_elf_backend_data (abfd)->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
/* Create dynamic sections when linking against a dynamic object. */
bfd_boolean
-_bfd_elf_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+_bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
flagword flags, pltflags;
asection *s;
struct bfd_link_hash_entry *bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s,
- (bfd_vma) 0, (const char *) NULL, FALSE,
- get_elf_backend_data (abfd)->collect, &bh)))
+ (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, 0, NULL,
+ FALSE, get_elf_backend_data (abfd)->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
one. */
bfd_boolean
-_bfd_elf_link_record_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+_bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
if (h->dynindx == -1)
{
{
size_t len = p - name + 1;
- alc = bfd_malloc ((bfd_size_type) len);
+ alc = bfd_malloc (len);
if (alc == NULL)
return FALSE;
memcpy (alc, name, len - 1);
this in case some dynamic object refers to this symbol. */
bfd_boolean
-bfd_elf_record_link_assignment (output_bfd, info, name, provide)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
- const char *name;
- bfd_boolean provide;
+bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info,
+ const char *name,
+ bfd_boolean provide)
{
struct elf_link_hash_entry *h;
in a discarded section, eg. a discarded link-once section symbol. */
int
-elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
- struct bfd_link_info *info;
- bfd *input_bfd;
- long input_indx;
+elf_link_record_local_dynamic_symbol (struct bfd_link_info *info,
+ bfd *input_bfd,
+ long input_indx)
{
bfd_size_type amt;
struct elf_link_local_dynamic_entry *entry;
return 1;
amt = sizeof (*entry);
- entry = (struct elf_link_local_dynamic_entry *) bfd_alloc (input_bfd, amt);
+ entry = bfd_alloc (input_bfd, amt);
if (entry == NULL)
return 0;
/* Go find the symbol, so that we can find it's name. */
if (!bfd_elf_get_elf_syms (input_bfd, &elf_tdata (input_bfd)->symtab_hdr,
- (size_t) 1, (size_t) input_indx,
- &entry->isym, esym, &eshndx))
+ 1, input_indx, &entry->isym, esym, &eshndx))
{
bfd_release (input_bfd, entry);
return 0;
/* Return the dynindex of a local dynamic symbol. */
long
-_bfd_elf_link_lookup_local_dynindx (info, input_bfd, input_indx)
- struct bfd_link_info *info;
- bfd *input_bfd;
- long input_indx;
+_bfd_elf_link_lookup_local_dynindx (struct bfd_link_info *info,
+ bfd *input_bfd,
+ long input_indx)
{
struct elf_link_local_dynamic_entry *e;
them are removed because they are marked as local. This is called
via elf_link_hash_traverse. */
-static bfd_boolean elf_link_renumber_hash_table_dynsyms
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
static bfd_boolean
-elf_link_renumber_hash_table_dynsyms (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
+ void *data)
{
- size_t *count = (size_t *) data;
+ size_t *count = data;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
the global symbols. */
unsigned long
-_bfd_elf_link_renumber_dynsyms (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
{
unsigned long dynsymcount = 0;
a shared object. */
bfd_boolean
-_bfd_elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, skip,
- override, type_change_ok, size_change_ok, dt_needed)
- bfd *abfd;
- struct bfd_link_info *info;
- const char *name;
- Elf_Internal_Sym *sym;
- asection **psec;
- bfd_vma *pvalue;
- struct elf_link_hash_entry **sym_hash;
- bfd_boolean *skip;
- bfd_boolean *override;
- bfd_boolean *type_change_ok;
- bfd_boolean *size_change_ok;
- bfd_boolean dt_needed;
+_bfd_elf_merge_symbol (bfd *abfd,
+ struct bfd_link_info *info,
+ const char *name,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ bfd_vma *pvalue,
+ struct elf_link_hash_entry **sym_hash,
+ bfd_boolean *skip,
+ bfd_boolean *override,
+ bfd_boolean *type_change_ok,
+ bfd_boolean *size_change_ok,
+ bfd_boolean dt_needed)
{
asection *sec;
struct elf_link_hash_entry *h;
indicates if it comes from a DT_NEEDED entry of a shared object. */
bfd_boolean
-_bfd_elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
- dynsym, override, dt_needed)
- bfd *abfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- const char *name;
- Elf_Internal_Sym *sym;
- asection **psec;
- bfd_vma *value;
- bfd_boolean *dynsym;
- bfd_boolean override;
- bfd_boolean dt_needed;
+_bfd_elf_add_default_symbol (bfd *abfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ const char *name,
+ Elf_Internal_Sym *sym,
+ asection **psec,
+ bfd_vma *value,
+ bfd_boolean *dynsym,
+ bfd_boolean override,
+ bfd_boolean dt_needed)
{
bfd_boolean type_change_ok;
bfd_boolean size_change_ok;
bh = &hi->root;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
- (bfd_vma) 0, name, FALSE, collect, &bh)))
+ 0, name, FALSE, collect, &bh)))
return FALSE;
hi = (struct elf_link_hash_entry *) bh;
}
bh = &hi->root;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT,
- bfd_ind_section_ptr, (bfd_vma) 0, name, FALSE, collect, &bh)))
+ bfd_ind_section_ptr, 0, name, FALSE, collect, &bh)))
return FALSE;
hi = (struct elf_link_hash_entry *) bh;
symbol table. It is called via elf_link_hash_traverse. */
bfd_boolean
-_bfd_elf_export_symbol (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
{
- struct elf_info_failed *eif = (struct elf_info_failed *) data;
+ struct elf_info_failed *eif = data;
/* Ignore indirect symbols. These are added by the versioning code. */
if (h->root.type == bfd_link_hash_indirect)
This function is called via elf_link_hash_traverse. */
bfd_boolean
-_bfd_elf_link_find_version_dependencies (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+_bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
+ void *data)
{
- struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
+ struct elf_find_verdep_info *rinfo = data;
Elf_Internal_Verneed *t;
Elf_Internal_Vernaux *a;
bfd_size_type amt;
if (t == NULL)
{
amt = sizeof *t;
- t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt);
+ t = bfd_zalloc (rinfo->output_bfd, amt);
if (t == NULL)
{
rinfo->failed = TRUE;
}
amt = sizeof *a;
- a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, amt);
+ a = bfd_zalloc (rinfo->output_bfd, amt);
/* Note that we are copying a string pointer here, and testing it
above. If bfd_elf_string_from_elf_section is ever changed to
local. This function is called via elf_link_hash_traverse. */
bfd_boolean
-_bfd_elf_link_assign_sym_version (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+_bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
{
struct elf_assign_sym_version_info *sinfo;
struct bfd_link_info *info;
char *p;
bfd_size_type amt;
- sinfo = (struct elf_assign_sym_version_info *) data;
+ sinfo = data;
info = sinfo->info;
if (h->root.type == bfd_link_hash_warning)
struct bfd_elf_version_expr *d;
len = p - h->root.root.string;
- alc = bfd_malloc ((bfd_size_type) len);
+ alc = bfd_malloc (len);
if (alc == NULL)
return FALSE;
memcpy (alc, h->root.root.string, len - 1);
return TRUE;
amt = sizeof *t;
- t = ((struct bfd_elf_version_tree *)
- bfd_alloc (sinfo->output_bfd, amt));
+ t = bfd_alloc (sinfo->output_bfd, amt);
if (t == NULL)
{
sinfo->failed = TRUE;
Returns FALSE if something goes wrong. */
static bfd_boolean
-elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
- internal_relocs)
- bfd *abfd;
- Elf_Internal_Shdr *shdr;
- PTR external_relocs;
- Elf_Internal_Rela *internal_relocs;
+elf_link_read_relocs_from_section (bfd *abfd,
+ Elf_Internal_Shdr *shdr,
+ void *external_relocs,
+ Elf_Internal_Rela *internal_relocs)
{
struct elf_backend_data *bed;
- void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+ void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
const bfd_byte *erela;
const bfd_byte *erelaend;
Elf_Internal_Rela *irela;
REL_HDR2 relocations. */
Elf_Internal_Rela *
-_bfd_elf_link_read_relocs (abfd, o, external_relocs, internal_relocs,
- keep_memory)
- bfd *abfd;
- asection *o;
- PTR external_relocs;
- Elf_Internal_Rela *internal_relocs;
- bfd_boolean keep_memory;
+_bfd_elf_link_read_relocs (bfd *abfd,
+ asection *o,
+ void *external_relocs,
+ Elf_Internal_Rela *internal_relocs,
+ bfd_boolean keep_memory)
{
Elf_Internal_Shdr *rel_hdr;
- PTR alloc1 = NULL;
+ void *alloc1 = NULL;
Elf_Internal_Rela *alloc2 = NULL;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
size = o->reloc_count;
size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
if (keep_memory)
- internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
+ internal_relocs = bfd_alloc (abfd, size);
else
- internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size);
+ internal_relocs = alloc2 = bfd_malloc (size);
if (internal_relocs == NULL)
goto error_return;
}
if (elf_section_data (o)->rel_hdr2)
size += elf_section_data (o)->rel_hdr2->sh_size;
- alloc1 = (PTR) bfd_malloc (size);
+ alloc1 = bfd_malloc (size);
if (alloc1 == NULL)
goto error_return;
external_relocs = alloc1;
section header for a section containing relocations for O. */
bfd_boolean
-_bfd_elf_link_size_reloc_section (abfd, rel_hdr, o)
- bfd *abfd;
- Elf_Internal_Shdr *rel_hdr;
- asection *o;
+_bfd_elf_link_size_reloc_section (bfd *abfd,
+ Elf_Internal_Shdr *rel_hdr,
+ asection *o)
{
bfd_size_type reloc_count;
bfd_size_type num_rel_hashes;
allocate it with bfd_alloc rather than malloc. Also since we
cannot be sure that the contents will actually be filled in,
we zero the allocated space. */
- rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
+ rel_hdr->contents = bfd_zalloc (abfd, rel_hdr->sh_size);
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return FALSE;
{
struct elf_link_hash_entry **p;
- p = ((struct elf_link_hash_entry **)
- bfd_zmalloc (num_rel_hashes
- * sizeof (struct elf_link_hash_entry *)));
+ p = bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
if (p == NULL)
return FALSE;
OUTPUT_BFD. */
bfd_boolean
-_bfd_elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
- internal_relocs)
- bfd *output_bfd;
- asection *input_section;
- Elf_Internal_Shdr *input_rel_hdr;
- Elf_Internal_Rela *internal_relocs;
+_bfd_elf_link_output_relocs (bfd *output_bfd,
+ asection *input_section,
+ Elf_Internal_Shdr *input_rel_hdr,
+ Elf_Internal_Rela *internal_relocs)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
asection *output_section;
unsigned int *rel_countp = NULL;
struct elf_backend_data *bed;
- void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
output_section = input_section->output_section;
output_rel_hdr = NULL;
the face of future changes. */
bfd_boolean
-_bfd_elf_fix_symbol_flags (h, eif)
- struct elf_link_hash_entry *h;
- struct elf_info_failed *eif;
+_bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
+ struct elf_info_failed *eif)
{
/* If this symbol was mentioned in a non-ELF file, try to set
DEF_REGULAR and REF_REGULAR correctly. This is the only way to
recursively. */
bfd_boolean
-_bfd_elf_adjust_dynamic_symbol (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+_bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
{
- struct elf_info_failed *eif = (struct elf_info_failed *) data;
+ struct elf_info_failed *eif = data;
bfd *dynobj;
struct elf_backend_data *bed;
H->WEAKDEF before it finds H? */
h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
- if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, (PTR) eif))
+ if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, eif))
return FALSE;
}
to reflect the object merging within the sections. */
bfd_boolean
-_bfd_elf_link_sec_merge_syms (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+_bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
{
asection *sec;
&& ((sec = h->root.u.def.section)->flags & SEC_MERGE)
&& sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
- bfd *output_bfd = (bfd *) data;
+ bfd *output_bfd = data;
h->root.u.def.value =
_bfd_merged_section_offset (output_bfd,
&h->root.u.def.section,
elf_section_data (sec)->sec_info,
- h->root.u.def.value, (bfd_vma) 0);
+ h->root.u.def.value, 0);
}
return TRUE;
considered to bind dynamically. */
bfd_boolean
-_bfd_elf_dynamic_symbol_p (h, info, ignore_protected)
- struct elf_link_hash_entry *h;
- struct bfd_link_info *info;
- bfd_boolean ignore_protected;
+_bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
+ struct bfd_link_info *info,
+ bfd_boolean ignore_protected)
{
bfd_boolean binding_stays_local_p;
undefined symbols and weak symbols. */
bfd_boolean
-_bfd_elf_symbol_refs_local_p (h, info, local_protected)
- struct elf_link_hash_entry *h;
- struct bfd_link_info *info;
- bfd_boolean local_protected;
+_bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
+ struct bfd_link_info *info,
+ bfd_boolean local_protected)
{
/* If it's a local sym, of course we resolve locally. */
if (h == NULL)
/* ELF linker code. */
-static bfd_boolean is_global_data_symbol_definition
- PARAMS ((bfd *, Elf_Internal_Sym *));
-static bfd_boolean elf_link_is_defined_archive_symbol
- PARAMS ((bfd *, carsym *));
-static bfd_boolean elf_link_add_object_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_link_add_archive_symbols
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_finalize_dynstr
- PARAMS ((bfd *, struct bfd_link_info *));
-static bfd_boolean elf_collect_hash_codes
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static size_t compute_bucket_count
- PARAMS ((struct bfd_link_info *));
-static void elf_link_adjust_relocs
- PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int,
- struct elf_link_hash_entry **));
-static int elf_link_sort_cmp1
- PARAMS ((const void *, const void *));
-static int elf_link_sort_cmp2
- PARAMS ((const void *, const void *));
-static size_t elf_link_sort_relocs
- PARAMS ((bfd *, struct bfd_link_info *, asection **));
-static bfd_boolean elf_section_ignore_discarded_relocs
- PARAMS ((asection *));
+static bfd_boolean elf_link_add_object_symbols (bfd *, struct bfd_link_info *);
+static bfd_boolean elf_link_add_archive_symbols (bfd *,
+ struct bfd_link_info *);
+static bfd_boolean elf_finalize_dynstr (bfd *, struct bfd_link_info *);
+static bfd_boolean elf_collect_hash_codes (struct elf_link_hash_entry *,
+ void *);
+static bfd_boolean elf_section_ignore_discarded_relocs (asection *);
/* Given an ELF BFD, add symbols to the global hash table as
appropriate. */
bfd_boolean
-elf_bfd_link_add_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{
switch (bfd_get_format (abfd))
{
\f
/* Return TRUE iff this is a non-common, definition of a non-function symbol. */
static bfd_boolean
-is_global_data_symbol_definition (abfd, sym)
- bfd * abfd ATTRIBUTE_UNUSED;
- Elf_Internal_Sym * sym;
+is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED,
+ Elf_Internal_Sym *sym)
{
/* Local symbols do not count, but target specific ones might. */
if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL
whose archive map contains a mention of SYMDEF, and determine if
the symbol is defined in this element. */
static bfd_boolean
-elf_link_is_defined_archive_symbol (abfd, symdef)
- bfd * abfd;
- carsym * symdef;
+elf_link_is_defined_archive_symbol (bfd * abfd, carsym * symdef)
{
Elf_Internal_Shdr * hdr;
bfd_size_type symcount;
bfd_boolean result;
abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
- if (abfd == (bfd *) NULL)
+ if (abfd == NULL)
return FALSE;
if (! bfd_check_format (abfd, bfd_object))
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
isym->st_name);
- if (name == (const char *) NULL)
+ if (name == NULL)
break;
if (strcmp (name, symdef->name) == 0)
table until nothing further is resolved. */
static bfd_boolean
-elf_link_add_archive_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
{
symindex c;
bfd_boolean *defined = NULL;
if (! bfd_has_map (abfd))
{
/* An empty archive is a special case. */
- if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
+ if (bfd_openr_next_archived_file (abfd, NULL) == NULL)
return TRUE;
bfd_set_error (bfd_error_no_armap);
return FALSE;
return TRUE;
amt = c;
amt *= sizeof (bfd_boolean);
- defined = (bfd_boolean *) bfd_zmalloc (amt);
- included = (bfd_boolean *) bfd_zmalloc (amt);
- if (defined == (bfd_boolean *) NULL || included == (bfd_boolean *) NULL)
+ defined = bfd_zmalloc (amt);
+ included = bfd_zmalloc (amt);
+ if (defined == NULL || included == NULL)
goto error_return;
symdefs = bfd_ardata (abfd)->symdefs;
/* First check with only one `@'. */
len = strlen (symdef->name);
- copy = bfd_alloc (abfd, (bfd_size_type) len);
+ copy = bfd_alloc (abfd, len);
if (copy == NULL)
goto error_return;
first = p - symdef->name + 1;
/* We need to include this archive member. */
element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
- if (element == (bfd *) NULL)
+ if (element == NULL)
goto error_return;
if (! bfd_check_format (element, bfd_object))
return TRUE;
error_return:
- if (defined != (bfd_boolean *) NULL)
+ if (defined != NULL)
free (defined);
- if (included != (bfd_boolean *) NULL)
+ if (included != NULL)
free (included);
return FALSE;
}
/* Add symbols from an ELF object file to the linker hash table. */
static bfd_boolean
-elf_link_add_object_symbols (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean (*add_symbol_hook)
- PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *));
+ (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
+ const char **, flagword *, asection **, bfd_vma *);
bfd_boolean (*check_relocs)
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
+ (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
bfd_boolean collect;
Elf_Internal_Shdr *hdr;
bfd_size_type symcount;
}
sz = bfd_section_size (abfd, s);
- msg = (char *) bfd_alloc (abfd, sz + 1);
+ msg = bfd_alloc (abfd, sz + 1);
if (msg == NULL)
goto error_return;
- if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz))
+ if (! bfd_get_section_contents (abfd, s, msg, 0, sz))
goto error_return;
msg[sz] = '\0';
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg,
- FALSE, collect, (struct bfd_link_hash_entry **) NULL)))
+ (info, abfd, name, BSF_WARNING, s, 0, msg,
+ FALSE, collect, NULL)))
goto error_return;
if (! info->relocatable)
int elfsec;
unsigned long shlink;
- dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size);
+ dynbuf = bfd_malloc (s->_raw_size);
if (dynbuf == NULL)
goto error_return;
- if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf,
- (file_ptr) 0, s->_raw_size))
+ if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size))
goto error_free_dyn;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
- n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ n = bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
anm = bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
- memcpy (anm, fnm, (size_t) amt);
+ memcpy (anm, fnm, amt);
n->name = anm;
n->by = abfd;
n->next = NULL;
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
- n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ n = bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
anm = bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
- memcpy (anm, fnm, (size_t) amt);
+ memcpy (anm, fnm, amt);
n->name = anm;
n->by = abfd;
n->next = NULL;
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
- n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ n = bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
free (dynbuf);
goto error_return;
}
- memcpy (anm, fnm, (size_t) amt);
+ memcpy (anm, fnm, amt);
n->name = anm;
n->by = abfd;
n->next = NULL;
}
}
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex))
+ if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex))
goto error_return;
}
/* We store a pointer to the hash table entry for each external
symbol. */
amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt);
+ sym_hash = bfd_alloc (abfd, amt);
if (sym_hash == NULL)
goto error_free_sym;
elf_sym_hashes (abfd) = sym_hash;
Elf_Internal_Shdr *versymhdr;
versymhdr = &elf_tdata (abfd)->dynversym_hdr;
- extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
+ extversym = bfd_malloc (versymhdr->sh_size);
if (extversym == NULL)
goto error_free_sym;
amt = versymhdr->sh_size;
if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0
- || bfd_bread ((PTR) extversym, amt, abfd) != amt)
+ || bfd_bread (extversym, amt, abfd) != amt)
goto error_free_vers;
}
}
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
isym->st_name);
- if (name == (const char *) NULL)
+ if (name == NULL)
goto error_free_vers;
if (isym->st_shndx == SHN_COMMON
/* The hook function sets the name to NULL if this symbol
should be skipped for some reason. */
- if (name == (const char *) NULL)
+ if (name == NULL)
continue;
}
/* Sanity check that all possibilities were handled. */
- if (sec == (asection *) NULL)
+ if (sec == NULL)
{
bfd_set_error (bfd_error_bad_value);
goto error_free_vers;
&& isym->st_shndx != SHN_UNDEF)
++newlen;
- newname = (char *) bfd_alloc (abfd, (bfd_size_type) newlen);
+ newname = bfd_alloc (abfd, newlen);
if (newname == NULL)
goto error_free_vers;
memcpy (newname, name, namelen);
}
if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, name, flags, sec, value, (const char *) NULL,
- FALSE, collect, (struct bfd_link_hash_entry **) sym_hash)))
+ (info, abfd, name, flags, sec, value, NULL, FALSE, collect,
+ (struct bfd_link_hash_entry **) sym_hash)))
goto error_free_vers;
h = *sym_hash;
}
}
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex))
+ if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex))
goto error_free_vers;
}
}
|| bfd_is_abs_section (o->output_section))
continue;
- internal_relocs
- = _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ internal_relocs = _bfd_elf_link_read_relocs (abfd, o, NULL, NULL,
+ info->keep_memory);
if (internal_relocs == NULL)
goto error_return;
/* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n;
- n = ((struct elf_link_loaded_list *)
- bfd_alloc (abfd, sizeof (struct elf_link_loaded_list)));
+ n = bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
if (n == NULL)
goto error_return;
n->abfd = abfd;
/* Add an entry to the .dynamic table. */
bfd_boolean
-elf_add_dynamic_entry (info, tag, val)
- struct bfd_link_info *info;
- bfd_vma tag;
- bfd_vma val;
+elf_add_dynamic_entry (struct bfd_link_info *info, bfd_vma tag, bfd_vma val)
{
Elf_Internal_Dyn dyn;
bfd *dynobj;
BFD_ASSERT (s != NULL);
newsize = s->_raw_size + sizeof (Elf_External_Dyn);
- newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
+ newcontents = bfd_realloc (s->contents, newsize);
if (newcontents == NULL)
return FALSE;
Therefore the result is always a good payoff between few collisions
(= short chain lengths) and table size. */
static size_t
-compute_bucket_count (info)
- struct bfd_link_info *info;
+compute_bucket_count (struct bfd_link_info *info)
{
size_t dynsymcount = elf_hash_table (info)->dynsymcount;
size_t best_size = 0;
optimizations. */
amt = dynsymcount;
amt *= sizeof (unsigned long int);
- hashcodes = (unsigned long int *) bfd_malloc (amt);
+ hashcodes = bfd_malloc (amt);
if (hashcodes == NULL)
return 0;
hashcodesp = hashcodes;
since the size could be large. */
amt = maxsize;
amt *= sizeof (unsigned long int);
- counts = (unsigned long int *) bfd_malloc (amt);
+ counts = bfd_malloc (amt);
if (counts == NULL)
{
free (hashcodes);
addresses of the various sections. */
bfd_boolean
-NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
- filter_shlib,
- auxiliary_filters, info, sinterpptr,
- verdefs)
- bfd *output_bfd;
- const char *soname;
- const char *rpath;
- const char *filter_shlib;
- const char * const *auxiliary_filters;
- struct bfd_link_info *info;
- asection **sinterpptr;
- struct bfd_elf_version_tree *verdefs;
+NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd,
+ const char *soname,
+ const char *rpath,
+ const char *filter_shlib,
+ const char * const *auxiliary_filters,
+ struct bfd_link_info *info,
+ asection **sinterpptr,
+ struct bfd_elf_version_tree *verdefs)
{
bfd_size_type soname_indx;
bfd *dynobj;
soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
soname, TRUE);
if (soname_indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SONAME,
- soname_indx))
+ || ! elf_add_dynamic_entry (info, DT_SONAME, soname_indx))
return FALSE;
}
if (info->symbolic)
{
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMBOLIC,
- (bfd_vma) 0))
+ if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
return FALSE;
info->flags |= DF_SYMBOLIC;
}
if (info->new_dtags)
_bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_RPATH, indx)
+ || ! elf_add_dynamic_entry (info, DT_RPATH, indx)
|| (info->new_dtags
- && ! elf_add_dynamic_entry (info, (bfd_vma) DT_RUNPATH,
- indx)))
+ && ! elf_add_dynamic_entry (info, DT_RUNPATH, indx)))
return FALSE;
}
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
filter_shlib, TRUE);
if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_FILTER, indx))
+ || ! elf_add_dynamic_entry (info, DT_FILTER, indx))
return FALSE;
}
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
*p, TRUE);
if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_AUXILIARY,
- indx))
+ || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
return FALSE;
}
}
{
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_export_symbol,
- (PTR) &eif);
+ &eif);
if (eif.failed)
return FALSE;
}
verlen = strlen (verstr);
newlen = namelen + verlen + 3;
- newname = (char *) bfd_malloc ((bfd_size_type) newlen);
+ newname = bfd_malloc (newlen);
if (newname == NULL)
return FALSE;
memcpy (newname, name, namelen);
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_link_assign_sym_version,
- (PTR) &asvinfo);
+ &asvinfo);
if (asvinfo.failed)
return FALSE;
the backend pick a reasonable value for them. */
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_adjust_dynamic_symbol,
- (PTR) &eif);
+ &eif);
if (eif.failed)
return FALSE;
&& (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
| ELF_LINK_HASH_DEF_REGULAR)) != 0)
{
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_INIT, (bfd_vma) 0))
+ if (! elf_add_dynamic_entry (info, DT_INIT, 0))
return FALSE;
}
h = (info->fini_function
&& (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
| ELF_LINK_HASH_DEF_REGULAR)) != 0)
{
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FINI, (bfd_vma) 0))
+ if (! elf_add_dynamic_entry (info, DT_FINI, 0))
return FALSE;
}
return FALSE;
}
- if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY,
- (bfd_vma) 0)
- || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ,
- (bfd_vma) 0))
+ if (!elf_add_dynamic_entry (info, DT_PREINIT_ARRAY, 0)
+ || !elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0))
return FALSE;
}
if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
{
- if (!elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAY,
- (bfd_vma) 0)
- || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ,
- (bfd_vma) 0))
+ if (!elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0)
+ || !elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0))
return FALSE;
}
if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL)
{
- if (!elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAY,
- (bfd_vma) 0)
- || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ,
- (bfd_vma) 0))
+ if (!elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0)
+ || !elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0))
return FALSE;
}
bfd_size_type strsize;
strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_HASH, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRTAB, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMTAB, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRSZ, strsize)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMENT,
- (bfd_vma) sizeof (Elf_External_Sym)))
+ if (! elf_add_dynamic_entry (info, DT_HASH, 0)
+ || ! elf_add_dynamic_entry (info, DT_STRTAB, 0)
+ || ! elf_add_dynamic_entry (info, DT_SYMTAB, 0)
+ || ! elf_add_dynamic_entry (info, DT_STRSZ, strsize)
+ || ! elf_add_dynamic_entry (info, DT_SYMENT,
+ sizeof (Elf_External_Sym)))
return FALSE;
}
}
}
s->_raw_size = size;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = bfd_alloc (output_bfd, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return FALSE;
bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
- (bfd_vma) 0, (const char *) NULL, FALSE,
+ 0, NULL, FALSE,
get_elf_backend_data (dynobj)->collect, &bh)))
return FALSE;
h = (struct elf_link_hash_entry *) bh;
}
}
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEF, (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEFNUM,
- (bfd_vma) cdefs))
+ if (! elf_add_dynamic_entry (info, DT_VERDEF, 0)
+ || ! elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs))
return FALSE;
elf_tdata (output_bfd)->cverdefs = cdefs;
if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS))
{
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags))
+ if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
return FALSE;
}
info->flags_1 &= ~ (DF_1_INITFIRST
| DF_1_NODELETE
| DF_1_NOOPEN);
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS_1,
- info->flags_1))
+ if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
return FALSE;
}
elf_link_hash_traverse (elf_hash_table (info),
_bfd_elf_link_find_version_dependencies,
- (PTR) &sinfo);
+ &sinfo);
if (elf_tdata (output_bfd)->verref == NULL)
_bfd_strip_section_from_output (info, s);
}
s->_raw_size = size;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = bfd_alloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return FALSE;
}
}
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEED,
- (bfd_vma) 0)
- || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEEDNUM,
- (bfd_vma) crefs))
+ if (! elf_add_dynamic_entry (info, DT_VERNEED, 0)
+ || ! elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs))
return FALSE;
elf_tdata (output_bfd)->cverrefs = crefs;
else
{
s->_raw_size = dynsymcount * sizeof (Elf_External_Versym);
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
+ s->contents = bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return FALSE;
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERSYM, (bfd_vma) 0))
+ if (! elf_add_dynamic_entry (info, DT_VERSYM, 0))
return FALSE;
}
s = bfd_get_section_by_name (dynobj, ".dynsym");
BFD_ASSERT (s != NULL);
s->_raw_size = dynsymcount * sizeof (Elf_External_Sym);
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->contents = bfd_alloc (output_bfd, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return FALSE;
isym.st_info = 0;
isym.st_other = 0;
isym.st_shndx = 0;
- elf_swap_symbol_out (output_bfd, &isym, (PTR) s->contents, (PTR) 0);
+ elf_swap_symbol_out (output_bfd, &isym, s->contents, 0);
}
/* Compute the size of the hashing table. As a side effect this
BFD_ASSERT (s != NULL);
hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
- s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
+ s->contents = bfd_zalloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return FALSE;
- bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount,
- s->contents);
- bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) dynsymcount,
+ bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
+ bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
s->contents + hash_entry_size);
elf_hash_table (info)->bucketcount = bucketcount;
s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
- if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NULL, (bfd_vma) 0))
+ if (! elf_add_dynamic_entry (info, DT_NULL, 0))
return FALSE;
}
/* This function is used to adjust offsets into .dynstr for
dynamic symbols. This is called via elf_link_hash_traverse. */
-static bfd_boolean elf_adjust_dynstr_offsets
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
static bfd_boolean
-elf_adjust_dynstr_offsets (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
{
- struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
+ struct elf_strtab_hash *dynstr = data;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
them. */
static bfd_boolean
-elf_finalize_dynstr (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
{
struct elf_link_local_dynamic_entry *entry;
struct elf_strtab_hash *dynstr = elf_hash_table (info)->dynstr;
/* Buffer large enough to hold contents of any section. */
bfd_byte *contents;
/* Buffer large enough to hold external relocs of any section. */
- PTR external_relocs;
+ void *external_relocs;
/* Buffer large enough to hold internal relocs of any section. */
Elf_Internal_Rela *internal_relocs;
/* Buffer large enough to hold external local symbols of any input
};
static bfd_boolean elf_link_output_sym
- PARAMS ((struct elf_final_link_info *, const char *,
- Elf_Internal_Sym *, asection *));
+ (struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *);
static bfd_boolean elf_link_flush_output_syms
- PARAMS ((struct elf_final_link_info *));
+ (struct elf_final_link_info *);
static bfd_boolean elf_link_output_extsym
- PARAMS ((struct elf_link_hash_entry *, PTR));
-static bfd_boolean elf_link_check_versioned_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+ (struct elf_link_hash_entry *, void *);
static bfd_boolean elf_link_input_bfd
- PARAMS ((struct elf_final_link_info *, bfd *));
+ (struct elf_final_link_info *, bfd *);
static bfd_boolean elf_reloc_link_order
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- struct bfd_link_order *));
+ (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
/* This struct is used to pass information to elf_link_output_extsym. */
REL_HDR (there are COUNT of them), using the data in REL_HASH. */
static void
-elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
- bfd *abfd;
- Elf_Internal_Shdr *rel_hdr;
- unsigned int count;
- struct elf_link_hash_entry **rel_hash;
+elf_link_adjust_relocs (bfd *abfd,
+ Elf_Internal_Shdr *rel_hdr,
+ unsigned int count,
+ struct elf_link_hash_entry **rel_hash)
{
unsigned int i;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_byte *erela;
- void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
- void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
+ void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
{
};
static int
-elf_link_sort_cmp1 (A, B)
- const PTR A;
- const PTR B;
+elf_link_sort_cmp1 (const void *A, const void *B)
{
- struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
- struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
+ const struct elf_link_sort_rela *a = A;
+ const struct elf_link_sort_rela *b = B;
int relativea, relativeb;
relativea = a->type == reloc_class_relative;
}
static int
-elf_link_sort_cmp2 (A, B)
- const PTR A;
- const PTR B;
+elf_link_sort_cmp2 (const void *A, const void *B)
{
- struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
- struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
+ const struct elf_link_sort_rela *a = A;
+ const struct elf_link_sort_rela *b = B;
int copya, copyb;
if (a->offset < b->offset)
}
static size_t
-elf_link_sort_relocs (abfd, info, psec)
- bfd *abfd;
- struct bfd_link_info *info;
- asection **psec;
+elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
{
asection *reldyn;
bfd_size_type count, size;
struct elf_link_sort_rela *sq;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
int i2e = bed->s->int_rels_per_ext_rel;
- void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
- void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
+ void (*swap_in) (bfd *, const bfd_byte *, Elf_Internal_Rela *);
+ void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
struct bfd_link_order *lo;
reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
if (sort == NULL)
{
(*info->callbacks->warning)
- (info, _("Not enough memory to sort relocations"), 0, abfd, 0,
- (bfd_vma) 0);
+ (info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0);
return 0;
}
}
}
- qsort (sort, (size_t) count, sort_elt, elf_link_sort_cmp1);
+ qsort (sort, count, sort_elt, elf_link_sort_cmp1);
for (i = 0, p = sort; i < count; i++, p += sort_elt)
{
sp->offset = sq->rela->r_offset;
}
- qsort (s_non_relative, (size_t) count - ret, sort_elt, elf_link_sort_cmp2);
+ qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2);
for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next)
if (lo->type == bfd_indirect_link_order)
/* Do the final step of an ELF link. */
bfd_boolean
-elf_bfd_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean dynamic;
bfd_boolean emit_relocs;
finfo.symbuf_count = 0;
finfo.shndxbuf_size = 0;
finfo.first_tls_sec = NULL;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
+ for (o = abfd->sections; o != NULL; o = o->next)
if ((o->flags & SEC_THREAD_LOCAL) != 0
&& (o->flags & SEC_LOAD) != 0)
{
max_sym_count = 0;
max_sym_shndx_count = 0;
merged = FALSE;
- for (o = abfd->sections; o != (asection *) NULL; o = o->next)
+ for (o = abfd->sections; o != NULL; o = o->next)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
o->reloc_count = 0;
{
Elf_Internal_Rela * relocs;
- relocs
- = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
+ info->keep_memory);
reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs);
if (! info->relocatable && merged)
elf_link_hash_traverse (elf_hash_table (info),
- _bfd_elf_link_sec_merge_syms, (PTR) abfd);
+ _bfd_elf_link_sec_merge_syms, abfd);
/* Figure out the file positions for everything but the symbol table
and the relocs. We set symcount to force assign_section_numbers
finfo.symbuf_size = max_sym_count;
amt = finfo.symbuf_size;
amt *= sizeof (Elf_External_Sym);
- finfo.symbuf = (Elf_External_Sym *) bfd_malloc (amt);
+ finfo.symbuf = bfd_malloc (amt);
if (finfo.symbuf == NULL)
goto error_return;
if (elf_numsections (abfd) > SHN_LORESERVE)
amt = 2 * max_sym_count + elf_numsections (abfd) + 1000;
finfo.shndxbuf_size = amt;
amt *= sizeof (Elf_External_Sym_Shndx);
- finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt);
+ finfo.symshndxbuf = bfd_zmalloc (amt);
if (finfo.symshndxbuf == NULL)
goto error_return;
}
elfsym.st_info = 0;
elfsym.st_other = 0;
elfsym.st_shndx = SHN_UNDEF;
- if (! elf_link_output_sym (&finfo, (const char *) NULL,
- &elfsym, bfd_und_section_ptr))
+ if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr))
goto error_return;
}
elfsym.st_value = 0;
else
elfsym.st_value = o->vma;
- if (! elf_link_output_sym (&finfo, (const char *) NULL,
- &elfsym, o))
+ if (! elf_link_output_sym (&finfo, NULL, &elfsym, o))
goto error_return;
if (i == SHN_LORESERVE - 1)
i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
files. */
if (max_contents_size != 0)
{
- finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
+ finfo.contents = bfd_malloc (max_contents_size);
if (finfo.contents == NULL)
goto error_return;
}
if (max_external_reloc_size != 0)
{
- finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size);
+ finfo.external_relocs = bfd_malloc (max_external_reloc_size);
if (finfo.external_relocs == NULL)
goto error_return;
}
{
amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
amt *= sizeof (Elf_Internal_Rela);
- finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
+ finfo.internal_relocs = bfd_malloc (amt);
if (finfo.internal_relocs == NULL)
goto error_return;
}
if (max_sym_count != 0)
{
amt = max_sym_count * sizeof (Elf_External_Sym);
- finfo.external_syms = (Elf_External_Sym *) bfd_malloc (amt);
+ finfo.external_syms = bfd_malloc (amt);
if (finfo.external_syms == NULL)
goto error_return;
amt = max_sym_count * sizeof (Elf_Internal_Sym);
- finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
+ finfo.internal_syms = bfd_malloc (amt);
if (finfo.internal_syms == NULL)
goto error_return;
amt = max_sym_count * sizeof (long);
- finfo.indices = (long *) bfd_malloc (amt);
+ finfo.indices = bfd_malloc (amt);
if (finfo.indices == NULL)
goto error_return;
amt = max_sym_count * sizeof (asection *);
- finfo.sections = (asection **) bfd_malloc (amt);
+ finfo.sections = bfd_malloc (amt);
if (finfo.sections == NULL)
goto error_return;
}
if (max_sym_shndx_count != 0)
{
amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
- finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ finfo.locsym_shndx = bfd_malloc (amt);
if (finfo.locsym_shndx == NULL)
goto error_return;
}
eoinfo.finfo = &finfo;
eoinfo.localsyms = TRUE;
elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- (PTR) &eoinfo);
+ &eoinfo);
if (eoinfo.failed)
return FALSE;
sym.st_shndx = indx;
sym.st_value = s->vma;
dest = dynsym + elf_section_data (s)->dynindx;
- elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
+ elf_swap_symbol_out (abfd, &sym, dest, 0);
}
last_local = bfd_count_sections (abfd);
last_local = e->dynindx;
dest = dynsym + e->dynindx;
- elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
+ elf_swap_symbol_out (abfd, &sym, dest, 0);
}
}
eoinfo.localsyms = FALSE;
eoinfo.finfo = &finfo;
elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- (PTR) &eoinfo);
+ &eoinfo);
if (eoinfo.failed)
return FALSE;
if (bed->elf_backend_output_arch_syms)
{
typedef bfd_boolean (*out_sym_func)
- PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *));
+ (void *, const char *, Elf_Internal_Sym *, asection *);
if (! ((*bed->elf_backend_output_arch_syms)
- (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym)))
+ (abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
return FALSE;
}
off, TRUE);
if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bwrite ((PTR) finfo.symshndxbuf, amt, abfd) != amt))
+ || (bfd_bwrite (finfo.symshndxbuf, amt, abfd) != amt))
return FALSE;
}
/* Add a symbol to the output symbol table. */
static bfd_boolean
-elf_link_output_sym (finfo, name, elfsym, input_sec)
- struct elf_final_link_info *finfo;
- const char *name;
- Elf_Internal_Sym *elfsym;
- asection *input_sec;
+elf_link_output_sym (struct elf_final_link_info *finfo,
+ const char *name,
+ Elf_Internal_Sym *elfsym,
+ asection *input_sec)
{
Elf_External_Sym *dest;
Elf_External_Sym_Shndx *destshndx;
bfd_boolean (*output_symbol_hook)
- PARAMS ((bfd *, struct bfd_link_info *info, const char *,
- Elf_Internal_Sym *, asection *));
+ (bfd *, struct bfd_link_info *info, const char *,
+ Elf_Internal_Sym *, asection *);
output_symbol_hook = get_elf_backend_data (finfo->output_bfd)->
elf_backend_link_output_symbol_hook;
return FALSE;
}
- if (name == (const char *) NULL || *name == '\0')
+ if (name == NULL || *name == '\0')
elfsym->st_name = 0;
else if (input_sec->flags & SEC_EXCLUDE)
elfsym->st_name = 0;
destshndx += bfd_get_symcount (finfo->output_bfd);
}
- elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx);
+ elf_swap_symbol_out (finfo->output_bfd, elfsym, dest, destshndx);
finfo->symbuf_count += 1;
bfd_get_symcount (finfo->output_bfd) += 1;
/* Flush the output symbols to the file. */
static bfd_boolean
-elf_link_flush_output_syms (finfo)
- struct elf_final_link_info *finfo;
+elf_link_flush_output_syms (struct elf_final_link_info *finfo)
{
if (finfo->symbuf_count > 0)
{
pos = hdr->sh_offset + hdr->sh_size;
amt = finfo->symbuf_count * sizeof (Elf_External_Sym);
if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt)
+ || bfd_bwrite (finfo->symbuf, amt, finfo->output_bfd) != amt)
return FALSE;
hdr->sh_size += amt;
which may be satisfied by a versioned symbol in another DSO. */
static bfd_boolean
-elf_link_check_versioned_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+elf_link_check_versioned_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
bfd *abfd;
struct elf_link_loaded_list *loaded;
/* Read in any version definitions. */
versymhdr = &elf_tdata (input)->dynversym_hdr;
- extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
+ extversym = bfd_malloc (versymhdr->sh_size);
if (extversym == NULL)
goto error_ret;
if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread ((PTR) extversym, versymhdr->sh_size, input)
+ || (bfd_bread (extversym, versymhdr->sh_size, input)
!= versymhdr->sh_size))
{
free (extversym);
global symbols. */
static bfd_boolean
-elf_link_output_extsym (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
{
- struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
+ struct elf_outext_info *eoinfo = data;
struct elf_final_link_info *finfo = eoinfo->finfo;
bfd_boolean strip;
Elf_Internal_Sym sym;
{
if (! ((*finfo->info->callbacks->undefined_symbol)
(finfo->info, h->root.root.string, h->root.u.undef.abfd,
- (asection *) NULL, (bfd_vma) 0, TRUE)))
+ NULL, 0, TRUE)))
{
eoinfo->failed = TRUE;
return FALSE;
sym.st_name = h->dynstr_index;
esym = (Elf_External_Sym *) finfo->dynsym_sec->contents + h->dynindx;
- elf_swap_symbol_out (finfo->output_bfd, &sym, (PTR) esym, (PTR) 0);
+ elf_swap_symbol_out (finfo->output_bfd, &sym, esym, 0);
bucketcount = elf_hash_table (finfo->info)->bucketcount;
bucket = h->elf_hash_value % bucketcount;
bucketpos = ((bfd_byte *) finfo->hash_sec->contents
+ (bucket + 2) * hash_entry_size);
chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, (bfd_vma) h->dynindx,
- bucketpos);
+ bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
((bfd_byte *) finfo->hash_sec->contents
+ (bucketcount + 2 + h->dynindx) * hash_entry_size));
don't have to keep them in memory. */
static bfd_boolean
-elf_link_input_bfd (finfo, input_bfd)
- struct elf_final_link_info *finfo;
- bfd *input_bfd;
+elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
bfd_boolean (*relocate_section)
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+ (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
bfd *output_bfd;
Elf_Internal_Shdr *symtab_hdr;
size_t locsymcount;
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,
elf_section_data (isec)->sec_info,
- isym->st_value, (bfd_vma) 0);
+ isym->st_value, 0);
}
else if (isym->st_shndx == SHN_ABS)
isec = bfd_abs_section_ptr;
else
{
contents = finfo->contents;
- if (! bfd_get_section_contents (input_bfd, o, contents,
- (file_ptr) 0, o->_raw_size))
+ if (! bfd_get_section_contents (input_bfd, o, contents, 0,
+ o->_raw_size))
return FALSE;
}
Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2;
unsigned int next_erel;
bfd_boolean (*reloc_emitter)
- PARAMS ((bfd *, asection *, Elf_Internal_Shdr *,
- Elf_Internal_Rela *));
+ (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
bfd_boolean rela_normal;
input_rel_hdr = &elf_section_data (o)->rel_hdr;
with -Ur. */
static bfd_boolean
-elf_reloc_link_order (output_bfd, info, output_section, link_order)
- bfd *output_bfd;
- struct bfd_link_info *info;
- asection *output_section;
- struct bfd_link_order *link_order;
+elf_reloc_link_order (bfd *output_bfd,
+ struct bfd_link_info *info,
+ asection *output_section,
+ struct bfd_link_order *link_order)
{
reloc_howto_type *howto;
long indx;
else
{
if (! ((*info->callbacks->unattached_reloc)
- (info, link_order->u.reloc.p->u.name, (bfd *) NULL,
- (asection *) NULL, (bfd_vma) 0)))
+ (info, link_order->u.reloc.p->u.name, NULL, NULL, 0)))
return FALSE;
indx = 0;
}
const char *sym_name;
size = bfd_get_reloc_size (howto);
- buf = (bfd_byte *) bfd_zmalloc (size);
- if (buf == (bfd_byte *) NULL)
+ buf = bfd_zmalloc (size);
+ if (buf == NULL)
return FALSE;
- rstat = _bfd_relocate_contents (howto, output_bfd, (bfd_vma) addend, buf);
+ rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
switch (rstat)
{
case bfd_reloc_ok:
else
sym_name = link_order->u.reloc.p->u.name;
if (! ((*info->callbacks->reloc_overflow)
- (info, sym_name, howto->name, addend,
- (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
+ (info, sym_name, howto->name, addend, NULL, NULL, 0)))
{
free (buf);
return FALSE;
}
break;
}
- ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
- (file_ptr) link_order->offset, size);
+ ok = bfd_set_section_contents (output_bfd, output_section, buf,
+ link_order->offset, size);
free (buf);
if (! ok)
return FALSE;
\f
/* Garbage collect unused sections. */
-static bfd_boolean elf_gc_mark
- PARAMS ((struct bfd_link_info *, asection *,
- asection * (*) (asection *, struct bfd_link_info *,
- Elf_Internal_Rela *, struct elf_link_hash_entry *,
- Elf_Internal_Sym *)));
-
-static bfd_boolean elf_gc_sweep
- PARAMS ((struct bfd_link_info *,
- bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *)));
-
static bfd_boolean elf_gc_sweep_symbol
- PARAMS ((struct elf_link_hash_entry *, PTR));
+ (struct elf_link_hash_entry *, void *);
static bfd_boolean elf_gc_allocate_got_offsets
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean elf_gc_propagate_vtable_entries_used
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean elf_gc_smash_unused_vtentry_relocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
+ (struct elf_link_hash_entry *, void *);
/* The mark phase of garbage collection. For a given section, mark
it and any sections in this section's group, and all the sections
which define symbols to which it refers. */
typedef asection * (*gc_mark_hook_fn)
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *);
static bfd_boolean
-elf_gc_mark (info, sec, gc_mark_hook)
- struct bfd_link_info *info;
- asection *sec;
- gc_mark_hook_fn gc_mark_hook;
+elf_gc_mark (struct bfd_link_info *info,
+ asection *sec,
+ gc_mark_hook_fn gc_mark_hook)
{
bfd_boolean ret;
asection *group_sec;
}
/* Read the relocations. */
- relstart = _bfd_elf_link_read_relocs (input_bfd, sec, NULL,
- (Elf_Internal_Rela *) NULL,
+ relstart = _bfd_elf_link_read_relocs (input_bfd, sec, NULL, NULL,
info->keep_memory);
if (relstart == NULL)
{
/* The sweep phase of garbage collection. Remove all garbage sections. */
typedef bfd_boolean (*gc_sweep_hook_fn)
- PARAMS ((bfd *, struct bfd_link_info *, asection *,
- const Elf_Internal_Rela *));
+ (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
static bfd_boolean
-elf_gc_sweep (info, gc_sweep_hook)
- struct bfd_link_info *info;
- gc_sweep_hook_fn gc_sweep_hook;
+elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook)
{
bfd *sub;
bfd_boolean r;
internal_relocs
- = _bfd_elf_link_read_relocs (o->owner, o, NULL,
- (Elf_Internal_Rela *) NULL,
+ = _bfd_elf_link_read_relocs (o->owner, o, NULL, NULL,
info->keep_memory);
if (internal_relocs == NULL)
return FALSE;
{
int i = 0;
- elf_link_hash_traverse (elf_hash_table (info),
- elf_gc_sweep_symbol,
- (PTR) &i);
+ elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol, &i);
elf_hash_table (info)->dynsymcount = i;
}
/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */
static bfd_boolean
-elf_gc_sweep_symbol (h, idxptr)
- struct elf_link_hash_entry *h;
- PTR idxptr;
+elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *idxptr)
{
- int *idx = (int *) idxptr;
+ int *idx = idxptr;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
elf_link_hash_traverse. */
static bfd_boolean
-elf_gc_propagate_vtable_entries_used (h, okp)
- struct elf_link_hash_entry *h;
- PTR okp;
+elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
{
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
static bfd_boolean
-elf_gc_smash_unused_vtentry_relocs (h, okp)
- struct elf_link_hash_entry *h;
- PTR okp;
+elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
{
asection *sec;
bfd_vma hstart, hend;
hstart = h->root.u.def.value;
hend = hstart + h->size;
- relstart = _bfd_elf_link_read_relocs (sec->owner, sec, NULL,
- (Elf_Internal_Rela *) NULL, TRUE);
+ relstart = _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE);
if (!relstart)
return *(bfd_boolean *) okp = FALSE;
bed = get_elf_backend_data (sec->owner);
/* Do mark and sweep of unused sections. */
bfd_boolean
-elf_gc_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
{
bfd_boolean ok = TRUE;
bfd *sub;
asection * (*gc_mark_hook)
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *));
+ (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *h, Elf_Internal_Sym *);
if (!get_elf_backend_data (abfd)->can_gc_sections
|| info->relocatable || info->emitrelocations
/* Apply transitive closure to the vtable entry usage info. */
elf_link_hash_traverse (elf_hash_table (info),
elf_gc_propagate_vtable_entries_used,
- (PTR) &ok);
+ &ok);
if (!ok)
return FALSE;
/* Kill the vtable relocations that were not used. */
elf_link_hash_traverse (elf_hash_table (info),
elf_gc_smash_unused_vtentry_relocs,
- (PTR) &ok);
+ &ok);
if (!ok)
return FALSE;
/* Called from check_relocs to record the existance of a VTINHERIT reloc. */
bfd_boolean
-elf_gc_record_vtinherit (abfd, sec, h, offset)
- bfd *abfd;
- asection *sec;
- struct elf_link_hash_entry *h;
- bfd_vma offset;
+elf_gc_record_vtinherit (bfd *abfd,
+ asection *sec,
+ struct elf_link_hash_entry *h,
+ bfd_vma offset)
{
struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
struct elf_link_hash_entry **search, *child;
/* Called from check_relocs to record the existance of a VTENTRY reloc. */
bfd_boolean
-elf_gc_record_vtentry (abfd, sec, h, addend)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *sec ATTRIBUTE_UNUSED;
- struct elf_link_hash_entry *h;
- bfd_vma addend;
+elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ struct elf_link_hash_entry *h,
+ bfd_vma addend)
{
struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int log_file_align = bed->s->log_file_align;
if (ptr)
{
- ptr = bfd_realloc (ptr - 1, (bfd_size_type) bytes);
+ ptr = bfd_realloc (ptr - 1, bytes);
if (ptr != NULL)
{
}
}
else
- ptr = bfd_zmalloc ((bfd_size_type) bytes);
+ ptr = bfd_zmalloc (bytes);
if (ptr == NULL)
return FALSE;
we're done. Should be called from final_link. */
bfd_boolean
-elf_gc_common_finalize_got_offsets (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_gc_common_finalize_got_offsets (bfd *abfd,
+ struct bfd_link_info *info)
{
bfd *i;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
adjust_dynamic_symbol */
elf_link_hash_traverse (elf_hash_table (info),
elf_gc_allocate_got_offsets,
- (PTR) &gotoff);
+ &gotoff);
return TRUE;
}
to real got offsets. */
static bfd_boolean
-elf_gc_allocate_got_offsets (h, offarg)
- struct elf_link_hash_entry *h;
- PTR offarg;
+elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *offarg)
{
- bfd_vma *off = (bfd_vma *) offarg;
+ bfd_vma *off = offarg;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
got entry reference counting is enabled. */
bfd_boolean
-elf_gc_common_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
{
if (!elf_gc_common_finalize_got_offsets (abfd, info))
return FALSE;
all hash value of the exported symbols in an array. */
static bfd_boolean
-elf_collect_hash_codes (h, data)
- struct elf_link_hash_entry *h;
- PTR data;
+elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
{
- unsigned long **valuep = (unsigned long **) data;
+ unsigned long **valuep = data;
const char *name;
char *p;
unsigned long ha;
p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
- alc = bfd_malloc ((bfd_size_type) (p - name + 1));
- memcpy (alc, name, (size_t) (p - name));
+ alc = bfd_malloc (p - name + 1);
+ memcpy (alc, name, p - name);
alc[p - name] = '\0';
name = alc;
}
}
bfd_boolean
-elf_reloc_symbol_deleted_p (offset, cookie)
- bfd_vma offset;
- PTR cookie;
+elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
{
- struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie;
+ struct elf_reloc_cookie *rcookie = cookie;
if (rcookie->bad_symtab)
rcookie->rel = rcookie->rels;
which is true for all known assemblers. */
bfd_boolean
-elf_bfd_discard_info (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+elf_bfd_discard_info (bfd *output_bfd, struct bfd_link_info *info)
{
struct elf_reloc_cookie cookie;
asection *stab, *eh;
cookie.rels = NULL;
count = stab->reloc_count;
if (count != 0)
- cookie.rels
- = _bfd_elf_link_read_relocs (abfd, stab, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ cookie.rels = _bfd_elf_link_read_relocs (abfd, stab, NULL, NULL,
+ info->keep_memory);
if (cookie.rels != NULL)
{
cookie.rel = cookie.rels;
cookie.rels = NULL;
count = eh->reloc_count;
if (count != 0)
- cookie.rels
- = _bfd_elf_link_read_relocs (abfd, eh, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ cookie.rels = _bfd_elf_link_read_relocs (abfd, eh, NULL, NULL,
+ info->keep_memory);
cookie.rel = cookie.rels;
cookie.relend = cookie.rels;
if (cookie.rels != NULL)
}
static bfd_boolean
-elf_section_ignore_discarded_relocs (sec)
- asection *sec;
+elf_section_ignore_discarded_relocs (asection *sec)
{
struct elf_backend_data *bed;