/* Intel 80386/80486-specific support for 32-bit ELF
- Copyright 1993-1997, 1998 Free Software Foundation, Inc.
+ Copyright 1993, 94-98, 1999 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
HOWTO(R_386_RELATIVE, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_GOTOFF, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF", true,0xffffffff,0xffffffff,false),
HOWTO(R_386_GOTPC, 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC", true,0xffffffff,0xffffffff,true),
- { 11 },
- { 12 },
- { 13 },
- { 14 },
- { 15 },
- { 16 },
- { 17 },
- { 18 },
- { 19 },
+ EMPTY_HOWTO (11),
+ EMPTY_HOWTO (12),
+ EMPTY_HOWTO (13),
+ EMPTY_HOWTO (14),
+ EMPTY_HOWTO (15),
+ EMPTY_HOWTO (16),
+ EMPTY_HOWTO (17),
+ EMPTY_HOWTO (18),
+ EMPTY_HOWTO (19),
/* The remaining relocs are a GNU extension. */
HOWTO(R_386_16, 0,1,16,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_16", true,0xffff,0xffff,false),
HOWTO(R_386_PC16, 0,1,16,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC16", true,0xffff,0xffff,true),
HOWTO(R_386_8, 0,0,8,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_8", true,0xff,0xff,false),
- HOWTO(R_386_PC8, 0,0,8,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC8", true,0xff,0xff,true),
+ HOWTO(R_386_PC8, 0,0,8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc,"R_386_PC8", true,0xff,0xff,true),
};
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type *
elf_i386_reloc_type_lookup (abfd, code)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
switch (code)
TRACE ("BFD_RELOC_32");
return &elf_howto_table[ (int)R_386_32 ];
+ case BFD_RELOC_CTOR:
+ TRACE ("BFD_RELOC_CTOR");
+ return &elf_howto_table[ (int)R_386_32 ];
+
case BFD_RELOC_32_PCREL:
TRACE ("BFD_RELOC_PC32");
return &elf_howto_table[ (int)R_386_PC32 ];
static void
elf_i386_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd;
- arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr ATTRIBUTE_UNUSED;
+ Elf32_Internal_Rela *dst ATTRIBUTE_UNUSED;
{
abort ();
}
static void
elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf32_Internal_Rel *dst;
{
if (srelgot == NULL
&& (h != NULL || info->shared))
{
- const char *srelgot_name;
-
- srelgot_name = info->combine_reloc ? ".gnu.reloc" : ".rel.got";
-
- srelgot = bfd_get_section_by_name (dynobj, srelgot_name);
+ srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
if (srelgot == NULL)
{
- srelgot = bfd_make_section (dynobj, srelgot_name);
+ srelgot = bfd_make_section (dynobj, ".rel.got");
if (srelgot == NULL
|| ! bfd_set_section_flags (dynobj, srelgot,
(SEC_ALLOC
&& strcmp (bfd_get_section_name (abfd, sec),
name + 4) == 0);
- if (info->combine_reloc)
- /* If we combine the relocation sections use change
- the name here. */
- name = ".gnu.reloc";
-
sreloc = bfd_get_section_by_name (dynobj, name);
if (sreloc == NULL)
{
static asection *
elf_i386_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
case bfd_link_hash_common:
return h->root.u.c.p->section;
+
+ default:
+ break;
}
}
}
static boolean
elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+ bfd *abfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ asection *sec ATTRIBUTE_UNUSED;
+ const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
{
/* ??? It would seem that the existing i386 code does no sort
of reference counting or whatnot on its GOT and PLT entries,
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
asection *srel;
- const char *srel_name = info->combine_reloc ? ".gnu.reloc" : ".rel.bss";
- srel = bfd_get_section_by_name (dynobj, srel_name);
+ srel = bfd_get_section_by_name (dynobj, ".rel.bss");
BFD_ASSERT (srel != NULL);
srel->_raw_size += sizeof (Elf32_External_Rel);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
not actually use these entries. Reset the size of .rel.got,
which will cause it to get stripped from the output file
below. */
- const char *s_name = info->combine_reloc ? ".gnu.reloc" : ".rel.got";
-
- s = bfd_get_section_by_name (dynobj, s_name);
+ s = bfd_get_section_by_name (dynobj, ".rel.got");
if (s != NULL)
s->_raw_size = 0;
}
plt = true;
}
}
- else if (strncmp (name, ".rel", 4) == 0
- || strcmp (name, ".gnu.reloc") == 0)
+ else if (strncmp (name, ".rel", 4) == 0)
{
if (s->_raw_size == 0)
{
if (strip)
{
- asection **spp;
-
- for (spp = &s->output_section->owner->sections;
- *spp != s->output_section;
- spp = &(*spp)->next)
- ;
- *spp = s->output_section->next;
- --s->output_section->owner->section_count;
-
+ _bfd_strip_section_from_output (s);
continue;
}
static boolean
elf_i386_discard_copies (h, ignore)
struct elf_i386_link_hash_entry *h;
- PTR ignore;
+ PTR ignore ATTRIBUTE_UNUSED;
{
struct elf_i386_pcrel_relocs_copied *s;
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic)
+ else if (info->shared && !info->symbolic && !info->no_undefined)
relocation = 0;
else
{
{
asection *srelgot;
Elf_Internal_Rel outrel;
- const char *srelgot_name;
-
- srelgot_name = (info->combine_reloc
- ? ".gnu.reloc" : ".rel.got");
- srelgot = bfd_get_section_by_name (dynobj, srelgot_name);
+ srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
if (name == NULL)
return false;
- if (info->combine_reloc)
- name = ".gnu.reloc";
-
- BFD_ASSERT ((strncmp (name, ".rel", 4) == 0
- && strcmp (bfd_get_section_name (input_bfd,
- input_section),
- name + 4) == 0)
- || strcmp (name, ".gnu.reloc") == 0);
+ BFD_ASSERT (strncmp (name, ".rel", 4) == 0
+ && strcmp (bfd_get_section_name (input_bfd,
+ input_section),
+ name + 4) == 0);
sreloc = bfd_get_section_by_name (dynobj, name);
BFD_ASSERT (sreloc != NULL);
asection *sgot;
asection *srel;
Elf_Internal_Rel rel;
- const char *srel_name = info->combine_reloc ? ".gnu.reloc" : ".rel.got";
/* This symbol has an entry in the global offset table. Set it
up. */
sgot = bfd_get_section_by_name (dynobj, ".got");
- srel = bfd_get_section_by_name (dynobj, srel_name);
+ srel = bfd_get_section_by_name (dynobj, ".rel.got");
BFD_ASSERT (sgot != NULL && srel != NULL);
rel.r_offset = (sgot->output_section->vma
{
asection *s;
Elf_Internal_Rel rel;
- const char *s_name = info->combine_reloc ? ".gnu.reloc" : ".rel.bss";
/* This symbol needs a copy reloc. Set it up. */
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak));
- s = bfd_get_section_by_name (h->root.u.def.section->owner, s_name);
+ s = bfd_get_section_by_name (h->root.u.def.section->owner,
+ ".rel.bss");
BFD_ASSERT (s != NULL);
rel.r_offset = (h->root.u.def.value
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL && sdyn != NULL);
+ BFD_ASSERT (sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
}
/* Fill in the first entry in the procedure linkage table. */
- if (splt->_raw_size > 0)
+ splt = bfd_get_section_by_name (dynobj, ".plt");
+ if (splt && splt->_raw_size > 0)
{
if (info->shared)
memcpy (splt->contents, elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE);
sgot->output_section->vma + sgot->output_offset + 8,
splt->contents + 8);
}
- }
- /* UnixWare sets the entsize of .plt to 4, although that doesn't
- really seem like the right value. */
- elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
+ /* UnixWare sets the entsize of .plt to 4, although that doesn't
+ really seem like the right value. */
+ elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
+ }
}
/* Fill in the first three entries in the global offset table. */