Line 1... |
Line 1... |
/* PowerPC-specific support for 32-bit ELF
|
/* PowerPC-specific support for 32-bit ELF
|
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
Written by Ian Lance Taylor, Cygnus Support.
|
Written by Ian Lance Taylor, Cygnus Support.
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
Line 1918... |
Line 1918... |
{
|
{
|
char data[128];
|
char data[128];
|
va_list ap;
|
va_list ap;
|
|
|
va_start (ap, note_type);
|
va_start (ap, note_type);
|
memset (data, 0, 32);
|
memset (data, 0, sizeof (data));
|
strncpy (data + 32, va_arg (ap, const char *), 16);
|
strncpy (data + 32, va_arg (ap, const char *), 16);
|
strncpy (data + 48, va_arg (ap, const char *), 80);
|
strncpy (data + 48, va_arg (ap, const char *), 80);
|
va_end (ap);
|
va_end (ap);
|
return elfcore_write_note (abfd, buf, bufsiz,
|
return elfcore_write_note (abfd, buf, bufsiz,
|
"CORE", note_type, data, sizeof (data));
|
"CORE", note_type, data, sizeof (data));
|
Line 2889... |
Line 2889... |
|| !bfd_set_section_alignment (abfd, s, 4))
|
|| !bfd_set_section_alignment (abfd, s, 4))
|
return FALSE;
|
return FALSE;
|
|
|
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
|
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
|
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
|
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
|
s = bfd_make_section_with_flags (abfd, ".rela.iplt", flags);
|
s = bfd_make_section_anyway_with_flags (abfd, ".rela.iplt", flags);
|
htab->reliplt = s;
|
htab->reliplt = s;
|
if (s == NULL
|
if (s == NULL
|
|| ! bfd_set_section_alignment (abfd, s, 2))
|
|| ! bfd_set_section_alignment (abfd, s, 2))
|
return FALSE;
|
return FALSE;
|
return TRUE;
|
return TRUE;
|
Line 2922... |
Line 2922... |
if (htab->glink == NULL
|
if (htab->glink == NULL
|
&& !ppc_elf_create_glink (abfd, info))
|
&& !ppc_elf_create_glink (abfd, info))
|
return FALSE;
|
return FALSE;
|
|
|
htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
|
htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
|
s = bfd_make_section_with_flags (abfd, ".dynsbss",
|
s = bfd_make_section_anyway_with_flags (abfd, ".dynsbss",
|
SEC_ALLOC | SEC_LINKER_CREATED);
|
SEC_ALLOC | SEC_LINKER_CREATED);
|
htab->dynsbss = s;
|
htab->dynsbss = s;
|
if (s == NULL)
|
if (s == NULL)
|
return FALSE;
|
return FALSE;
|
|
|
if (! info->shared)
|
if (! info->shared)
|
{
|
{
|
htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
|
htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
|
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
|
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
|
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
|
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
|
s = bfd_make_section_with_flags (abfd, ".rela.sbss", flags);
|
s = bfd_make_section_anyway_with_flags (abfd, ".rela.sbss", flags);
|
htab->relsbss = s;
|
htab->relsbss = s;
|
if (s == NULL
|
if (s == NULL
|
|| ! bfd_set_section_alignment (abfd, s, 2))
|
|| ! bfd_set_section_alignment (abfd, s, 2))
|
return FALSE;
|
return FALSE;
|
}
|
}
|
Line 2985... |
Line 2985... |
edir->elf.ref_regular |= eind->elf.ref_regular;
|
edir->elf.ref_regular |= eind->elf.ref_regular;
|
edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
|
edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
|
edir->elf.needs_plt |= eind->elf.needs_plt;
|
edir->elf.needs_plt |= eind->elf.needs_plt;
|
edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
|
edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
|
|
|
/* If we were called to copy over info for a weak sym, that's all. */
|
|
if (eind->elf.root.type != bfd_link_hash_indirect)
|
|
return;
|
|
|
|
if (eind->dyn_relocs != NULL)
|
if (eind->dyn_relocs != NULL)
|
{
|
{
|
if (edir->dyn_relocs != NULL)
|
if (edir->dyn_relocs != NULL)
|
{
|
{
|
struct elf_dyn_relocs **pp;
|
struct elf_dyn_relocs **pp;
|
Line 3020... |
Line 3016... |
|
|
edir->dyn_relocs = eind->dyn_relocs;
|
edir->dyn_relocs = eind->dyn_relocs;
|
eind->dyn_relocs = NULL;
|
eind->dyn_relocs = NULL;
|
}
|
}
|
|
|
|
/* If we were called to copy over info for a weak sym, that's all.
|
|
You might think dyn_relocs need not be copied over; After all,
|
|
both syms will be dynamic or both non-dynamic so we're just
|
|
moving reloc accounting around. However, ELIMINATE_COPY_RELOCS
|
|
code in ppc_elf_adjust_dynamic_symbol needs to check for
|
|
dyn_relocs in read-only sections, and it does so on what is the
|
|
DIR sym here. */
|
|
if (eind->elf.root.type != bfd_link_hash_indirect)
|
|
return;
|
|
|
/* Copy over the GOT refcount entries that we may have already seen to
|
/* Copy over the GOT refcount entries that we may have already seen to
|
the symbol which just became indirect. */
|
the symbol which just became indirect. */
|
edir->elf.got.refcount += eind->elf.got.refcount;
|
edir->elf.got.refcount += eind->elf.got.refcount;
|
eind->elf.got.refcount = 0;
|
eind->elf.got.refcount = 0;
|
|
|
Line 9127... |
Line 9133... |
#define elf_backend_init_index_section _bfd_elf_init_1_index_section
|
#define elf_backend_init_index_section _bfd_elf_init_1_index_section
|
#define elf_backend_post_process_headers _bfd_elf_set_osabi
|
#define elf_backend_post_process_headers _bfd_elf_set_osabi
|
|
|
#include "elf32-target.h"
|
#include "elf32-target.h"
|
|
|
|
/* FreeBSD Target */
|
|
|
|
#undef TARGET_LITTLE_SYM
|
|
#undef TARGET_LITTLE_NAME
|
|
|
|
#undef TARGET_BIG_SYM
|
|
#define TARGET_BIG_SYM bfd_elf32_powerpc_freebsd_vec
|
|
#undef TARGET_BIG_NAME
|
|
#define TARGET_BIG_NAME "elf32-powerpc-freebsd"
|
|
|
|
#undef ELF_OSABI
|
|
#define ELF_OSABI ELFOSABI_FREEBSD
|
|
|
|
#undef elf32_bed
|
|
#define elf32_bed elf32_powerpc_fbsd_bed
|
|
|
|
#include "elf32-target.h"
|
|
|
/* VxWorks Target */
|
/* VxWorks Target */
|
|
|
#undef TARGET_LITTLE_SYM
|
#undef TARGET_LITTLE_SYM
|
#undef TARGET_LITTLE_NAME
|
#undef TARGET_LITTLE_NAME
|
|
|
#undef TARGET_BIG_SYM
|
#undef TARGET_BIG_SYM
|
#define TARGET_BIG_SYM bfd_elf32_powerpc_vxworks_vec
|
#define TARGET_BIG_SYM bfd_elf32_powerpc_vxworks_vec
|
#undef TARGET_BIG_NAME
|
#undef TARGET_BIG_NAME
|
#define TARGET_BIG_NAME "elf32-powerpc-vxworks"
|
#define TARGET_BIG_NAME "elf32-powerpc-vxworks"
|
|
|
|
#undef ELF_OSABI
|
|
|
/* VxWorks uses the elf default section flags for .plt. */
|
/* VxWorks uses the elf default section flags for .plt. */
|
static const struct bfd_elf_special_section *
|
static const struct bfd_elf_special_section *
|
ppc_elf_vxworks_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
ppc_elf_vxworks_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
{
|
{
|
if (sec->name == NULL)
|
if (sec->name == NULL)
|