diff options
author | Chris Demetriou <cgd@google.com> | 2002-01-30 02:14:19 +0000 |
---|---|---|
committer | Chris Demetriou <cgd@google.com> | 2002-01-30 02:14:19 +0000 |
commit | 4514d474edfcad976dc870d8e68c406f2a7b5e62 (patch) | |
tree | 80b73eabb9f65f4ccac9b7da0beed436cd7bd841 /gas | |
parent | fcc76bea372c593cd34dfada143ed5d9baa92997 (diff) | |
download | gdb-4514d474edfcad976dc870d8e68c406f2a7b5e62.zip gdb-4514d474edfcad976dc870d8e68c406f2a7b5e62.tar.gz gdb-4514d474edfcad976dc870d8e68c406f2a7b5e62.tar.bz2 |
2002-01-29 Chris Demetriou <cgd@broadcom.com>
* config/tc-mips.c (tc_gen_reloc): Arrange for
BFD_RELOC_PCREL_HI16_S relocations to be output relative to
their LO16 parts, even for ELF.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 41 |
2 files changed, 32 insertions, 15 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 5ee5bbf..08d43c0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2002-01-29 Chris Demetriou <cgd@broadcom.com> + + * config/tc-mips.c (tc_gen_reloc): Arrange for + BFD_RELOC_PCREL_HI16_S relocations to be output relative to + their LO16 parts, even for ELF. + 2002-01-29 Daniel Jacobowitz <drow@mvista.com> * config/tc-i386.c: Protect definitions of true and false diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index daecc98..0da9b8b 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -12269,32 +12269,43 @@ tc_gen_reloc (section, fixp) as_fatal (_("Double check fx_r_type in tc-mips.c:tc_gen_reloc")); fixp->fx_r_type = BFD_RELOC_GPREL32; } - else if (fixp->fx_pcrel == 0 || OUTPUT_FLAVOR == bfd_target_elf_flavour) - reloc->addend = fixp->fx_addnumber; else if (fixp->fx_r_type == BFD_RELOC_PCREL_LO16) { - /* We use a special addend for an internal RELLO reloc. */ - if (symbol_section_p (fixp->fx_addsy)) - reloc->addend = reloc->address - S_GET_VALUE (fixp->fx_subsy); + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + reloc->addend = fixp->fx_addnumber; else - reloc->addend = fixp->fx_addnumber + reloc->address; + { + /* We use a special addend for an internal RELLO reloc. */ + if (symbol_section_p (fixp->fx_addsy)) + reloc->addend = reloc->address - S_GET_VALUE (fixp->fx_subsy); + else + reloc->addend = fixp->fx_addnumber + reloc->address; + } } else if (fixp->fx_r_type == BFD_RELOC_PCREL_HI16_S) { assert (fixp->fx_next != NULL && fixp->fx_next->fx_r_type == BFD_RELOC_PCREL_LO16); - /* We use a special addend for an internal RELHI reloc. The - reloc is relative to the RELLO; adjust the addend + + /* The reloc is relative to the RELLO; adjust the addend accordingly. */ - if (symbol_section_p (fixp->fx_addsy)) - reloc->addend = (fixp->fx_next->fx_frag->fr_address - + fixp->fx_next->fx_where - - S_GET_VALUE (fixp->fx_subsy)); + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + reloc->addend = fixp->fx_next->fx_addnumber; else - reloc->addend = (fixp->fx_addnumber - + fixp->fx_next->fx_frag->fr_address - + fixp->fx_next->fx_where); + { + /* We use a special addend for an internal RELHI reloc. */ + if (symbol_section_p (fixp->fx_addsy)) + reloc->addend = (fixp->fx_next->fx_frag->fr_address + + fixp->fx_next->fx_where + - S_GET_VALUE (fixp->fx_subsy)); + else + reloc->addend = (fixp->fx_addnumber + + fixp->fx_next->fx_frag->fr_address + + fixp->fx_next->fx_where); + } } + else if (fixp->fx_pcrel == 0 || OUTPUT_FLAVOR == bfd_target_elf_flavour) + reloc->addend = fixp->fx_addnumber; else { if (OUTPUT_FLAVOR != bfd_target_aout_flavour) |