Add pc-relative 32-bit reloc to v850 port. Fixes ld-elf/merge test failure.

This commit is contained in:
Nick Clifton 2003-06-03 16:24:06 +00:00
parent 9aab5aa3a0
commit e30ddb24b3
10 changed files with 1404 additions and 963 deletions

View File

@ -1,3 +1,13 @@
2003-06-03 Nick Clifton <nickc@redhat.com>
* elf32-v850.c (v850_elf_howto_t): Rename R_V850_32to
R_V850_ABS32. Add entry for R_V850_REL32.
(v850_elf_reloc_map): Likewise.
(v850_elf_check_relocs): Likewise.
(v850_elf_perform_relocation): Likewise.
(v850_elf_final_link_relocate): Likewise. Include computation
to make R_V850_REl32 pc-relative.
2003-06-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* elf32-sh.c (sh_elf_size_dynamic_sections): Create .interp section

View File

@ -1,7 +1,7 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
"bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
"syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
"bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
"syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
"linker.c" and "simple.c".
Run "make headers" in your build bfd/ to regenerate. */
@ -1792,7 +1792,7 @@ enum bfd_architecture
#define bfd_mach_msp43 43
#define bfd_mach_msp44 44
#define bfd_mach_msp15 15
#define bfd_mach_msp16 16
#define bfd_mach_msp16 16
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
bfd_arch_last
@ -3480,14 +3480,14 @@ instruction opcode. */
BFD_RELOC_XTENSA_OP1,
BFD_RELOC_XTENSA_OP2,
/* Xtensa relocation to mark that the assembler expanded the
/* Xtensa relocation to mark that the assembler expanded the
instructions from an original target. The expansion size is
encoded in the reloc size. */
BFD_RELOC_XTENSA_ASM_EXPAND,
/* Xtensa relocation to mark that the linker should simplify
assembler-expanded instructions. This is commonly used
internally by the linker after analysis of a
/* Xtensa relocation to mark that the linker should simplify
assembler-expanded instructions. This is commonly used
internally by the linker after analysis of a
BFD_RELOC_XTENSA_ASM_EXPAND. */
BFD_RELOC_XTENSA_ASM_SIMPLIFY,
BFD_RELOC_UNUSED };

View File

@ -25,9 +25,6 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@ -160,15 +157,9 @@
/* Define if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H

View File

@ -189,7 +189,7 @@ static reloc_howto_type v850_elf_howto_table[] =
FALSE), /* pcrel_offset */
/* Simple 32bit reloc. */
HOWTO (R_V850_32, /* type */
HOWTO (R_V850_ABS32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
@ -197,7 +197,7 @@ static reloc_howto_type v850_elf_howto_table[] =
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
v850_elf_reloc, /* special_function */
"R_V850_32", /* name */
"R_V850_ABS32", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
@ -518,6 +518,21 @@ static reloc_howto_type v850_elf_howto_table[] =
0, /* src_mask */
0, /* dst_mask */
TRUE), /* pcrel_offset */
/* Simple pc-relative 32bit reloc. */
HOWTO (R_V850_REL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
v850_elf_reloc, /* special_function */
"R_V850_REL32", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
};
/* Map BFD reloc types to V850 ELF reloc types. */
@ -538,7 +553,8 @@ static const struct v850_elf_reloc_map v850_elf_reloc_map[] =
{ BFD_RELOC_HI16_S, R_V850_HI16_S },
{ BFD_RELOC_HI16, R_V850_HI16 },
{ BFD_RELOC_LO16, R_V850_LO16 },
{ BFD_RELOC_32, R_V850_32 },
{ BFD_RELOC_32, R_V850_ABS32 },
{ BFD_RELOC_32_PCREL, R_V850_REL32 },
{ BFD_RELOC_16, R_V850_16 },
{ BFD_RELOC_8, R_V850_8 },
{ BFD_RELOC_V850_SDA_16_16_OFFSET, R_V850_SDA_16_16_OFFSET },
@ -672,7 +688,8 @@ v850_elf_check_relocs (abfd, info, sec, relocs)
case R_V850_HI16_S:
case R_V850_HI16:
case R_V850_LO16:
case R_V850_32:
case R_V850_ABS32:
case R_V850_REL32:
case R_V850_16:
case R_V850_8:
case R_V850_CALLT_6_7_OFFSET:
@ -905,7 +922,8 @@ v850_elf_perform_relocation (abfd, r_type, addend, address)
/* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
return bfd_reloc_notsupported;
case R_V850_32:
case R_V850_REL32:
case R_V850_ABS32:
bfd_put_32 (abfd, addend, address);
return bfd_reloc_ok;
@ -1466,11 +1484,17 @@ v850_elf_final_link_relocate (howto, input_bfd, output_bfd,
value = SEXT24 (value);
break;
case R_V850_REL32:
value -= (input_section->output_section->vma
+ input_section->output_offset
+ offset);
break;
case R_V850_HI16_S:
case R_V850_HI16:
case R_V850_LO16:
case R_V850_16:
case R_V850_32:
case R_V850_ABS32:
case R_V850_8:
break;

View File

@ -1,19 +1,19 @@
aix386-core.c
aix5ppc-core.c
aout0.c
aout32.c
aout64.c
aout-adobe.c
aout-arm.c
aout-cris.c
aoutf1.h
aout-ns32k.c
aout-sparcle.c
aout-target.h
aout-tic30.c
aout0.c
aout32.c
aout64.c
aoutf1.h
aoutx.h
archive.c
archive64.c
archive.c
archures.c
armnetbsd.c
bfd.c
@ -26,17 +26,21 @@ cf-i386lynx.c
cf-m68klynx.c
cf-sparclynx.c
cisco-core.c
coff64-rs6000.c
coff-a29k.c
coff-alpha.c
coff-apollo.c
coff-arm.c
coff-aux.c
coffcode.h
coffgen.c
coff-go32.c
coff-h8300.c
coff-h8500.c
coff-i386.c
coff-i860.c
coff-i960.c
cofflink.c
coff-m68k.c
coff-m88k.c
coff-mips.c
@ -46,6 +50,7 @@ coff-sh.c
coff-sparc.c
coff-stgo32.c
coff-svm68k.c
coffswap.h
coff-tic30.c
coff-tic4x.c
coff-tic54x.c
@ -54,11 +59,6 @@ coff-u68k.c
coff-w65.c
coff-we32k.c
coff-z8k.c
coff64-rs6000.c
coffcode.h
coffgen.c
cofflink.c
coffswap.h
corefile.c
cpu-a29k.c
cpu-alpha.c
@ -111,6 +111,7 @@ cpu-vax.c
cpu-w65.c
cpu-we32k.c
cpu-xstormy16.c
cpu-xtensa.c
cpu-z8k.c
demo64.c
dwarf1.c
@ -120,16 +121,10 @@ ecofflink.c
ecoffswap.h
efi-app-ia32.c
efi-app-ia64.c
elf-bfd.h
elf-eh-frame.c
elf-hppa.h
elf-m10200.c
elf-m10300.c
elf-strtab.c
elf.c
elf32-arc.c
elf32-arm.h
elf32-avr.c
elf32.c
elf32-cris.c
elf32-d10v.c
elf32-d30v.c
@ -149,6 +144,7 @@ elf32-iq2000.c
elf32-m32r.c
elf32-m68hc11.c
elf32-m68hc12.c
elf32-m68hc1x.c
elf32-m68k.c
elf32-m88k.c
elf32-mcore.c
@ -159,15 +155,16 @@ elf32-or32.c
elf32-pj.c
elf32-ppc.c
elf32-s390.c
elf32-sh.c
elf32-sh64-com.c
elf32-sh64.c
elf32-sh64-com.c
elf32-sh.c
elf32-sparc.c
elf32-v850.c
elf32-vax.c
elf32-xstormy16.c
elf32.c
elf32-xtensa.c
elf64-alpha.c
elf64.c
elf64-gen.c
elf64-hppa.c
elf64-hppa.h
@ -178,14 +175,20 @@ elf64-s390.c
elf64-sh64.c
elf64-sparc.c
elf64-x86-64.c
elf64.c
elfarm-nabi.c
elfarm-oabi.c
elf-bfd.h
elf.c
elfcode.h
elfcore.h
elf-eh-frame.c
elf-hppa.h
elflink.c
elflink.h
elf-m10200.c
elf-m10300.c
elfn32-mips.c
elf-strtab.c
elfxx-mips.c
epoc-pe-arm.c
epoc-pei-arm.c
@ -236,16 +239,16 @@ mipsbsd.c
mmo.c
netbsd.h
newsos3.c
nlm-target.h
nlm.c
nlm32-alpha.c
nlm32.c
nlm32-i386.c
nlm32-ppc.c
nlm32-sparc.c
nlm32.c
nlm64.c
nlm.c
nlmcode.h
nlmswap.h
nlm-target.h
ns32k.h
ns32knetbsd.c
oasys.c
@ -254,24 +257,24 @@ osf-core.c
pc532-mach.c
pdp11.c
pe-arm.c
pe-i386.c
pe-mcore.c
pe-mips.c
pe-ppc.c
pe-sh.c
pef-traceback.h
pef.c
pef.h
pef-traceback.h
pe-i386.c
pei-arm.c
peicode.h
pei-i386.c
pei-mcore.c
pei-mips.c
pei-ppc.c
pei-sh.c
peicode.h
pe-mcore.c
pe-mips.c
pe-ppc.c
pe-sh.c
ppcboot.c
reloc.c
reloc16.c
reloc.c
riscix.c
sco5-core.c
section.c
@ -282,8 +285,8 @@ sparclinux.c
sparclynx.c
sparcnetbsd.c
srec.c
stab-syms.c
stabs.c
stab-syms.c
sunos.c
syms.c
targets.c
@ -294,13 +297,15 @@ vaxbsd.c
vaxnetbsd.c
versados.c
version.h
vms.c
vms-gsd.c
vms.h
vms-hdr.c
vms-misc.c
vms-tir.c
vms.c
vms.h
xcoff-target.h
xcofflink.c
xcoff-target.h
xsym.c
xsym.h
xtensa-isa.c
xtensa-modules.c

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,9 @@
2003-06-03 Nick Clifton <nickc@redhat.com>
* tc-v850.c (tc-gen_reloc): Translate BFD_RELOC_32 into
BFD_RELOC_32_PCREL if the reloc is pc-relative. Do this
before calling bfd_reloc_type_lookup.
2003-06-02 Alan Modra <amodra@bigpond.net.au>
* read.c (emit_expr): Set dot_value.

View File

@ -2239,6 +2239,22 @@ tc_gen_reloc (seg, fixp)
reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if ( fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixp->fx_r_type == BFD_RELOC_V850_LONGCALL
|| fixp->fx_r_type == BFD_RELOC_V850_LONGJUMP
|| fixp->fx_r_type == BFD_RELOC_V850_ALIGN)
reloc->addend = fixp->fx_offset;
else
{
if (fixp->fx_r_type == BFD_RELOC_32
&& fixp->fx_pcrel)
fixp->fx_r_type = BFD_RELOC_32_PCREL;
reloc->addend = fixp->fx_addnumber;
}
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == (reloc_howto_type *) NULL)
@ -2253,16 +2269,6 @@ tc_gen_reloc (seg, fixp)
return NULL;
}
if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
reloc->addend = fixp->fx_offset;
else if ( fixp->fx_r_type == BFD_RELOC_V850_LONGCALL
|| fixp->fx_r_type == BFD_RELOC_V850_LONGJUMP
|| fixp->fx_r_type == BFD_RELOC_V850_ALIGN)
reloc->addend = fixp->fx_offset;
else
reloc->addend = fixp->fx_addnumber;
return reloc;
}

View File

@ -1,3 +1,8 @@
2003-06-03 Nick Clifton <nickc@redhat.com>
* v850.h (R_V850_32): Rename to R_V850_ABS32.
Add R_V850_REL32.
2003-05-15 Roland McGrath <roland@redhat.com>
* common.h (NT_AUXV, AT_*): New macros.

View File

@ -53,7 +53,7 @@ START_RELOC_NUMBERS (v850_reloc_type)
RELOC_NUMBER (R_V850_HI16_S, 3)
RELOC_NUMBER (R_V850_HI16, 4)
RELOC_NUMBER (R_V850_LO16, 5)
RELOC_NUMBER (R_V850_32, 6)
RELOC_NUMBER (R_V850_ABS32, 6)
RELOC_NUMBER (R_V850_16, 7)
RELOC_NUMBER (R_V850_8, 8)
RELOC_NUMBER( R_V850_SDA_16_16_OFFSET, 9) /* For ld.b, st.b, set1, clr1, not1, tst1, movea, movhi */
@ -75,6 +75,7 @@ START_RELOC_NUMBERS (v850_reloc_type)
RELOC_NUMBER (R_V850_LONGCALL, 25)
RELOC_NUMBER (R_V850_LONGJUMP, 26)
RELOC_NUMBER (R_V850_ALIGN, 27)
RELOC_NUMBER (R_V850_REL32, 28)
END_RELOC_NUMBERS (R_V850_max)