aboutsummaryrefslogtreecommitdiff
path: root/bfd/xcofflink.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@geoffk.org>2000-09-06 21:21:51 +0000
committerGeoffrey Keating <geoffk@geoffk.org>2000-09-06 21:21:51 +0000
commit492055e63351f3e50634e94b60bb146ede9a537b (patch)
treee88a93bda19b367ce78974e97c58d25a07a21ebd /bfd/xcofflink.c
parent566ad7d7ea28f14f3c005daaa916a437e2a60e93 (diff)
downloadgdb-492055e63351f3e50634e94b60bb146ede9a537b.zip
gdb-492055e63351f3e50634e94b60bb146ede9a537b.tar.gz
gdb-492055e63351f3e50634e94b60bb146ede9a537b.tar.bz2
* xcofflink.c (xcoff_link_input_bfd): Include the .tocbss
pseduo-section when determining where the TOC ends. * coff-rs6000.c (_bfd_xcoff_swap_aux_out): Use bfd_h_put_16 to output x_tvndx as it is only two bytes wide. * coff-rs6000.c (xcoff_howto_table): A modifiable branch-absolute reloc is 26 or 32 bits wide. * coff-rs6000.c (_bfd_xcoff_rtype2howto): The bitsize is irrelevant for relocs that don't change anything. Also look at the full 6 bits of bitsize.
Diffstat (limited to 'bfd/xcofflink.c')
-rw-r--r--bfd/xcofflink.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index f518fdf..4b265cc 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -4679,22 +4679,40 @@ xcoff_link_input_bfd (finfo, input_bfd)
else
{
bfd_vma tocval, tocend;
+ bfd *inp;
tocval = ((*csectpp)->output_section->vma
+ (*csectpp)->output_offset
+ isym.n_value
- (*csectpp)->vma);
+
/* We want to find out if tocval is a good value to use
as the TOC anchor--that is, whether we can access all
of the TOC using a 16 bit offset from tocval. This
test assumes that the TOC comes at the end of the
output section, as it does in the default linker
- script. FIXME: This doesn't handle .tocbss sections
- created from XMC_TD common symbols correctly. */
-
+ script. */
tocend = ((*csectpp)->output_section->vma
+ (*csectpp)->output_section->_raw_size);
-
+ for (inp = finfo->info->input_bfds;
+ inp != NULL;
+ inp = inp->link_next)
+ {
+ asection *o;
+
+ for (o = inp->sections; o != NULL; o = o->next)
+ if (strcmp (o->name, ".tocbss") == 0)
+ {
+ bfd_vma new_toc_end;
+ new_toc_end = (o->output_section->vma
+ + o->output_offset
+ + o->_cooked_size);
+ if (new_toc_end > tocend)
+ tocend = new_toc_end;
+ }
+
+ }
+
if (tocval + 0x10000 < tocend)
{
(*_bfd_error_handler)