aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-cris.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2002-04-05 23:11:32 +0000
committerHans-Peter Nilsson <hp@axis.com>2002-04-05 23:11:32 +0000
commit44aa49bb657358081e576f3201c79bdeb310c879 (patch)
tree45f2fd485507977c106ce7cf1bcc94cbf5a46065 /bfd/elf32-cris.c
parentc69255e19cb25c86cdc32e164c75ffe9651ed6ed (diff)
downloadgdb-44aa49bb657358081e576f3201c79bdeb310c879.zip
gdb-44aa49bb657358081e576f3201c79bdeb310c879.tar.gz
gdb-44aa49bb657358081e576f3201c79bdeb310c879.tar.bz2
* elf32-cris.c (cris_elf_howto_table) <R_CRIS_16_PCREL,
R_CRIS_32_PCREL>: Fix typo in name. (cris_elf_check_relocs): Always create .rela.got here when R_CRIS_16_GOTPLT or R_CRIS_32_GOTPLT is seen. (elf_cris_adjust_gotplt_to_got): Don't create .rela.got here; assume it's created.
Diffstat (limited to 'bfd/elf32-cris.c')
-rw-r--r--bfd/elf32-cris.c80
1 files changed, 35 insertions, 45 deletions
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 2348cd4..ab72483 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -180,7 +180,7 @@ static reloc_howto_type cris_elf_howto_table [] =
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
- "R_CRIS_16", /* name */
+ "R_CRIS_16_PCREL", /* name */
false, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
@@ -195,7 +195,7 @@ static reloc_howto_type cris_elf_howto_table [] =
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
- "R_CRIS_32", /* name */
+ "R_CRIS_32_PCREL", /* name */
false, /* partial_inplace */
0x00000000, /* src_mask */
0xffffffff, /* dst_mask */
@@ -1957,28 +1957,9 @@ elf_cris_adjust_gotplt_to_got (h, p)
h->gotplt_refcount = -1;
- /* We always have a .got section when there are dynamic
- relocs. */
- BFD_ASSERT (sgot != NULL /* Surely have .got section. */);
-
- /* We might have had a PLT but with no GOT entry and
- further no GOT reloc section at all needed before.
- Add it. */
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
-
- if (srelgot == NULL
- || !bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
+ /* We always have a .got and a .rela.got section if there were
+ GOTPLT relocs in input. */
+ BFD_ASSERT (sgot != NULL && srelgot != NULL);
/* Allocate space in the .got section. */
sgot->_raw_size += 4;
@@ -2368,8 +2349,38 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
specific GOT entry). */
switch (r_type)
{
+ /* For R_CRIS_16_GOTPLT and R_CRIS_32_GOTPLT, we need a GOT
+ entry only for local symbols. Unfortunately, we don't know
+ until later on if there's a version script that forces the
+ symbol local. We must have the .rela.got section in place
+ before we know if the symbol looks global now, so we need
+ to treat the reloc just like for R_CRIS_16_GOT and
+ R_CRIS_32_GOT. */
+ case R_CRIS_16_GOTPLT:
+ case R_CRIS_32_GOTPLT:
case R_CRIS_16_GOT:
case R_CRIS_32_GOT:
+ if (srelgot == NULL
+ && (h != NULL || info->shared))
+ {
+ srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ if (srelgot == NULL)
+ {
+ srelgot = bfd_make_section (dynobj, ".rela.got");
+ if (srelgot == NULL
+ || !bfd_set_section_flags (dynobj, srelgot,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || !bfd_set_section_alignment (dynobj, srelgot, 2))
+ return false;
+ }
+ }
+ /* Fall through. */
+
case R_CRIS_32_GOTREL:
case R_CRIS_32_PLT_GOTREL:
if (sgot == NULL)
@@ -2416,27 +2427,6 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
case R_CRIS_16_GOT:
case R_CRIS_32_GOT:
/* This symbol requires a global offset table entry. */
-
- if (srelgot == NULL
- && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rela.got");
- if (srelgot == NULL
- || !bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
- }
-
if (h != NULL)
{
if (h->got.refcount == 0)