* Fixes to _bfd_mips_elf_hide_symbol
@ 2007-08-11 13:06 Richard Sandiford
2007-08-13 18:45 ` Thiemo Seufer
0 siblings, 1 reply; 5+ messages in thread
From: Richard Sandiford @ 2007-08-11 13:06 UTC (permalink / raw)
To: binutils; +Cc: kaminaga
This patch fixes two related problems. The first is an internal error
on VxWorks, the second is that we create unnecessary local GOT entries
for all MIPS targets. One instance of the second problem was reported
by Hiroki Kaminaga:
http://sources.redhat.com/ml/binutils/2006-11/msg00331.html
and he identified the guilty code here:
http://sources.redhat.com/ml/binutils/2006-12/msg00022.html
To recap, check_relocs looks at all the input relocations and
records which symbols will need a GOT entry. If a local symbol
(in the STB_LOCAL sense) requires a GOT entry, the function calls
mips_elf_record_local_got_symbol; if a global symbol requires a GOT
entry, the function calls mips_elf_record_global_got_symbol. Note that
symbol visibility does not affect this treatment; check_relocs calls
mips_elf_record_global_got_symbol for symbols that it could already
prove are hidden or protected. Thus local_gotno only accounts for
relocations against STB_LOCAL symbols. We rely on _bfd_mips_elf_hide_symbol
to adjust local_gotno for forced-local symbols.
Also, the MIPS port tries to calculate the GOT layout during
always_size_sections, before adjust_dynamic_symbol has been called for
each symbol. Thus _bfd_mips_elf_hide_symbol has to cope with cases
we've already counted a forced-local symbol as a global symbol.
So, onto the problems:
1. _bfd_mips_elf_hide_symbol only copes with cases where a symbol
was passed to mips_elf_record_global_got_symbol. This is fine
for SVR4-style targets, but isn't enough on VxWorks. If a symbol
is only mentioned in CALL relocations, not GOT relocations, it will
not have a .got entry at all; we will have assumed that all the CALL
relocations will use a .got.plt entry instead. Thus we should
check for the case where a symbol needs a PLT entry and has not
been passed to mips_elf_record_global_got_symbol.
2. In a similar vein, we currently use:
g->global_gotno == 0 && g->global_gotsym == NULL
to check whether the GOT size as been calculated, but this is
not tight enough on VxWorks: we may need to do (1) when there
are no global GOT entries at all.
3. _bfd_mips_hide_symbol has:
else if (g->global_gotno == 0 && g->global_gotsym == NULL)
/* If we haven't got through GOT allocation yet, just bump up the
number of local entries, as this symbol won't be counted as
global. */
g->local_gotno++;
but this is far too conservative. We don't know whether the
symbol is used in a GOT relocation or not.
4. I think the check:
g->global_gotno == 0 && g->global_gotsym == NULL
triggers for non-VxWorks targets when no global GOT entries are
needed. Thus the code could adjust local_gotno even after
always_size_sections.
5. There's an off-by-one error in mips_elf_create_local_got_entry:
entry.gotidx = MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
...
if (g->assigned_gotno >= g->local_gotno)
{
(*loc)->gotidx = -1;
/* We didn't allocate enough space in the GOT. */
(*_bfd_error_handler)
(_("not enough GOT space for local GOT entries"));
bfd_set_error (bfd_error_bad_value);
return NULL;
}
I.e. we don't allow cases where g->assigned_gotno == g->local_gotno - 1
on entry.
The patch below fixes this by:
a. Making mips_elf_record_global_got_symbol increment local_gotno
for each forced-local symbol.
b. Making _bfd_mips_elf_hide_symbol increment local_gotno only
in cases where check_relocs has already requested a PLT or
global GOT entry.
c. Introducing a new state variable to say whether we've already
already computed the GOT sizes.
d. Making _bfd_mips_elf_hide_symbol adjust global_gotno (and, for
the new VxWorks case, sgot->size) only if the new state variable
added in (c) is true.
e. Changing ">=" to ">" in (5).
Thus (a) and (b) in combination make sure that local_gotno is always
incremented for forced-local GOT entries, without caring whether
mips_elf_record_global_got_symbol or _bfd_mips_elf_hide_symbol is
called first. (c) and (d) make sure that we only adjust the global
GOT count and GOT size if those values have already been calculated.
I think a new state variable is the cleanest approach here;
sgot->size > 0 might work, but seems less obvious.
It might be argued that the code needs a bigger overhaul, but I think
this is a strict improvement on what we have now.
The patch fixes the attached testcase for VxWorks. (The "bar" symbol
is needed because of (2)). The combination of fixes for (3) and
possibly (4) also removes an unncessary local GOT entry into two
of the TLS cases and the VxWorks shared library test.
Before the patch, Hiroki's testcase had 15 local GOT entries with
--gc-sections and 10 without. After the patch it has 9 local GOT
entries for both. I've verified that it still runs correctly
on a Broadcom board.
Tested on mips-linux-gnu, mips64-linux-gnu and mips-wrs-vxworks.
OK to install?
Richard
bfd/
* elfxx-mips.c (mips_elf_link_hash_table): Add computed_got_sizes.
(mips_elf_record_global_got_symbol): Increment local_gotno for
each forced-local symbol.
(_bfd_mips_elf_check_relocs): Pass forced-local call symbols to
mips_elf_record_global_got_symbol for VxWorks too.
(_bfd_mips_elf_always_size_sections): Set it to true after computing
the GOT size.
(_bfd_mips_elf_hide_symbol): Increase local_gotno whenever
got.offset == 1. Only adjust global_gotno if computed_got_sizes.
For VxWorks, add a local entry when hiding a symbol that needs a
plt but has not been marked as needing a global got entry.
(_bfd_mips_elf_link_hash_table_create): Set computed_got_sizes to
false.
ld/testsuite/
* ld-mips-elf/vxworks-forced-local-1.d,
* ld-mips-elf/vxworks-forced-local-1.s,
* ld-mips-elf/vxworks-forced-local-1.ver: New test.
* ld-mips-elf/mips-elf.exp: Run it.
* ld-mips-elf/tlsdyn-o32-2.d: Adjust for removal of unnecessary
local GOT entry.
* ld-mips-elf/tlsdyn-o32-2.got: Likewise.
* ld-mips-elf/tlsdyn-o32-3.d: Likewise.
* ld-mips-elf/tlsdyn-o32-3.got: Likewise.
* ld-mips-elf/vxworks1-lib.dd: Likewise.
* ld-mips-elf/vxworks1-lib.rd: Likewise.
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.212
diff -u -p -r1.212 elfxx-mips.c
--- bfd/elfxx-mips.c 22 Jul 2007 16:45:06 -0000 1.212
+++ bfd/elfxx-mips.c 11 Aug 2007 12:54:27 -0000
@@ -323,6 +323,8 @@ struct mips_elf_link_hash_table
bfd_vma rld_value;
/* This is set if we see any mips16 stub sections. */
bfd_boolean mips16_stubs_seen;
+ /* True if we've computed the size of the GOT. */
+ bfd_boolean computed_got_sizes;
/* True if we're generating code for VxWorks. */
bfd_boolean is_vxworks;
/* True if we already reported the small-data section overflow. */
@@ -2691,7 +2693,7 @@ mips_elf_create_local_got_entry (bfd *ab
memcpy (*loc, &entry, sizeof entry);
- if (g->assigned_gotno >= g->local_gotno)
+ if (g->assigned_gotno > g->local_gotno)
{
(*loc)->gotidx = -1;
/* We didn't allocate enough space in the GOT. */
@@ -2876,11 +2878,15 @@ mips_elf_record_global_got_symbol (struc
if (h->got.offset != MINUS_ONE)
return TRUE;
- /* By setting this to a value other than -1, we are indicating that
- there needs to be a GOT entry for H. Avoid using zero, as the
- generic ELF copy_indirect_symbol tests for <= 0. */
if (tls_flag == 0)
- h->got.offset = 1;
+ {
+ /* By setting this to a value other than -1, we are indicating that
+ there needs to be a GOT entry for H. Avoid using zero, as the
+ generic ELF copy_indirect_symbol tests for <= 0. */
+ h->got.offset = 1;
+ if (h->forced_local)
+ g->local_gotno++;
+ }
return TRUE;
}
@@ -6528,7 +6534,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, s
/* VxWorks call relocations point the function's .got.plt
entry, which will be allocated by adjust_dynamic_symbol.
Otherwise, this symbol requires a global GOT entry. */
- if (!htab->is_vxworks
+ if ((!htab->is_vxworks || h->forced_local)
&& !mips_elf_record_global_got_symbol (h, abfd, info, g, 0))
return FALSE;
@@ -7312,6 +7318,7 @@ _bfd_mips_elf_always_size_sections (bfd
g->tls_assigned_gotno = g->global_gotno + g->local_gotno;
htab_traverse (g->got_entries, mips_elf_initialize_tls_index, g);
}
+ htab->computed_got_sizes = TRUE;
return TRUE;
}
@@ -9671,6 +9678,7 @@ _bfd_mips_elf_hide_symbol (struct bfd_li
asection *got;
struct mips_got_info *g;
struct mips_elf_link_hash_entry *h;
+ struct mips_elf_link_hash_table *htab;
h = (struct mips_elf_link_hash_entry *) entry;
if (h->forced_local)
@@ -9678,6 +9686,7 @@ _bfd_mips_elf_hide_symbol (struct bfd_li
h->forced_local = force_local;
dynobj = elf_hash_table (info)->dynobj;
+ htab = mips_elf_hash_table (info);
if (dynobj != NULL && force_local && h->root.type != STT_TLS
&& (got = mips_elf_got_section (dynobj, TRUE)) != NULL
&& (g = mips_elf_section_data (got)->u.got_info) != NULL)
@@ -9715,20 +9724,30 @@ _bfd_mips_elf_hide_symbol (struct bfd_li
gg->assigned_gotno--;
}
}
- else if (g->global_gotno == 0 && g->global_gotsym == NULL)
- /* If we haven't got through GOT allocation yet, just bump up the
- number of local entries, as this symbol won't be counted as
- global. */
- g->local_gotno++;
else if (h->root.got.offset == 1)
{
- /* If we're past non-multi-GOT allocation and this symbol had
- been marked for a global got entry, give it a local entry
- instead. */
- BFD_ASSERT (g->global_gotno > 0);
+ /* check_relocs didn't know that this symbol would be
+ forced-local, so add an extra local got entry. */
g->local_gotno++;
- g->global_gotno--;
+ if (htab->computed_got_sizes)
+ {
+ /* We'll have treated this symbol as global rather
+ than local. */
+ BFD_ASSERT (g->global_gotno > 0);
+ g->global_gotno--;
+ }
}
+ else if (htab->is_vxworks && h->root.needs_plt)
+ {
+ /* check_relocs didn't know that this symbol would be
+ forced-local, so add an extra local got entry. */
+ g->local_gotno++;
+ if (htab->computed_got_sizes)
+ /* The symbol is only used in call relocations, so we'll
+ have assumed it only needs a .got.plt entry. Increase
+ the size of .got accordingly. */
+ got->size += MIPS_ELF_GOT_SIZE (dynobj);
+ }
}
_bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
@@ -10189,6 +10208,7 @@ _bfd_mips_elf_link_hash_table_create (bf
ret->use_rld_obj_head = FALSE;
ret->rld_value = 0;
ret->mips16_stubs_seen = FALSE;
+ ret->computed_got_sizes = FALSE;
ret->is_vxworks = FALSE;
ret->small_data_overflow_reported = FALSE;
ret->srelbss = NULL;
Index: ld/testsuite/ld-mips-elf/vxworks-forced-local-1.d
===================================================================
RCS file: ld/testsuite/ld-mips-elf/vxworks-forced-local-1.d
diff -N ld/testsuite/ld-mips-elf/vxworks-forced-local-1.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-mips-elf/vxworks-forced-local-1.d 11 Aug 2007 12:54:27 -0000
@@ -0,0 +1,12 @@
+#as: -mips2 -mvxworks-pic
+#source: vxworks-forced-local-1.s
+#ld: -shared -Tvxworks1.ld --version-script vxworks-forced-local-1.ver
+#readelf: --relocs
+
+Relocation section '\.rela\.dyn' .*
+.*
+0008140c 00000002 R_MIPS_32 *00080810
+00081410 00000002 R_MIPS_32 *00080814
+00081414 00000002 R_MIPS_32 *00080818
+00081418 00000302 R_MIPS_32 *00000000 *bar \+ 0
+#pass
Index: ld/testsuite/ld-mips-elf/vxworks-forced-local-1.s
===================================================================
RCS file: ld/testsuite/ld-mips-elf/vxworks-forced-local-1.s
diff -N ld/testsuite/ld-mips-elf/vxworks-forced-local-1.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-mips-elf/vxworks-forced-local-1.s 11 Aug 2007 12:54:27 -0000
@@ -0,0 +1,13 @@
+ .globl foo1
+ .globl foo2
+ .globl foo3
+ lw $4,%call16(foo1)($gp)
+ lw $4,%call16(foo2)($gp)
+ lw $4,%call16(foo3)($gp)
+ lw $4,%got(bar)($gp)
+foo1:
+ nop
+foo2:
+ nop
+foo3:
+ nop
Index: ld/testsuite/ld-mips-elf/vxworks-forced-local-1.ver
===================================================================
RCS file: ld/testsuite/ld-mips-elf/vxworks-forced-local-1.ver
diff -N ld/testsuite/ld-mips-elf/vxworks-forced-local-1.ver
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-mips-elf/vxworks-forced-local-1.ver 11 Aug 2007 12:54:27 -0000
@@ -0,0 +1 @@
+{ local: foo*; };
Index: ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf.exp,v
retrieving revision 1.46
diff -u -p -r1.46 mips-elf.exp
--- ld/testsuite/ld-mips-elf/mips-elf.exp 1 Aug 2007 17:41:30 -0000 1.46
+++ ld/testsuite/ld-mips-elf/mips-elf.exp 11 Aug 2007 12:54:27 -0000
@@ -44,6 +44,7 @@ if {[istarget "mips*-*-vxworks"]} {
}
run_ld_link_tests $mipsvxtests
run_dump_test "vxworks1-static"
+ run_dump_test "vxworks-forced-local-1"
return
}
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d,v
retrieving revision 1.4
diff -u -p -r1.4 tlsdyn-o32-2.d
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d 20 Oct 2006 07:57:02 -0000 1.4
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d 11 Aug 2007 12:54:27 -0000
@@ -11,20 +11,20 @@ Disassembly of section .text:
.*: afbe0008 sw s8,8\(sp\)
.*: 03a0f021 move s8,sp
.*: afbc0000 sw gp,0\(sp\)
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848048 addiu a0,gp,-32696
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848044 addiu a0,gp,-32700
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 2784803c addiu a0,gp,-32708
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848038 addiu a0,gp,-32712
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848034 addiu a0,gp,-32716
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848030 addiu a0,gp,-32720
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
@@ -33,10 +33,10 @@ Disassembly of section .text:
.*: 24638000 addiu v1,v1,-32768
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
- .*: 8f838050 lw v1,-32688\(gp\)
+ .*: 8f83804c lw v1,-32692\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
- .*: 8f838044 lw v1,-32700\(gp\)
+ .*: 8f838040 lw v1,-32704\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
@@ -61,20 +61,20 @@ Disassembly of section .text:
.*: afbe0008 sw s8,8\(sp\)
.*: 03a0f021 move s8,sp
.*: afbc0000 sw gp,0\(sp\)
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848048 addiu a0,gp,-32696
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848044 addiu a0,gp,-32700
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 2784803c addiu a0,gp,-32708
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848038 addiu a0,gp,-32712
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848034 addiu a0,gp,-32716
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848030 addiu a0,gp,-32720
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
@@ -83,10 +83,10 @@ Disassembly of section .text:
.*: 24638000 addiu v1,v1,-32768
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
- .*: 8f838050 lw v1,-32688\(gp\)
+ .*: 8f83804c lw v1,-32692\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
- .*: 8f838044 lw v1,-32700\(gp\)
+ .*: 8f838040 lw v1,-32704\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got,v
retrieving revision 1.4
diff -u -p -r1.4 tlsdyn-o32-2.got
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got 20 Oct 2006 07:57:02 -0000 1.4
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got 11 Aug 2007 12:54:27 -0000
@@ -4,17 +4,17 @@
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE \*ABS\*
-10000058 R_MIPS_TLS_DTPMOD32 tlsbin_gd
-1000005c R_MIPS_TLS_DTPREL32 tlsbin_gd
-1000004c R_MIPS_TLS_DTPMOD32 tlsvar_gd
-10000050 R_MIPS_TLS_DTPREL32 tlsvar_gd
-10000054 R_MIPS_TLS_TPREL32 tlsvar_ie
-10000060 R_MIPS_TLS_TPREL32 tlsbin_ie
+10000054 R_MIPS_TLS_DTPMOD32 tlsbin_gd
+10000058 R_MIPS_TLS_DTPREL32 tlsbin_gd
+10000048 R_MIPS_TLS_DTPMOD32 tlsvar_gd
+1000004c R_MIPS_TLS_DTPREL32 tlsvar_gd
+10000050 R_MIPS_TLS_TPREL32 tlsvar_ie
+1000005c R_MIPS_TLS_TPREL32 tlsbin_ie
Contents of section .got:
10000020 00000000 80000000 00000000 00000000 .*
- 10000030 00000000 00000000 00000000 00000000 .*
- 10000040 0040053c 00000001 00000000 00000000 .*
+ 10000030 00000000 00000000 00000000 0040053c .*
+ 10000040 00000001 00000000 00000000 00000000 .*
10000050 00000000 00000000 00000000 00000000 .*
- 10000060 00000000 00000000 00000000 00000000 .*
+ 10000060 00000000 00000000 00000000 .*
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d,v
retrieving revision 1.4
diff -u -p -r1.4 tlsdyn-o32-3.d
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d 20 Oct 2006 07:57:02 -0000 1.4
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d 11 Aug 2007 12:54:27 -0000
@@ -11,20 +11,20 @@ Disassembly of section .text:
.*: afbe0008 sw s8,8\(sp\)
.*: 03a0f021 move s8,sp
.*: afbc0000 sw gp,0\(sp\)
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848048 addiu a0,gp,-32696
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848044 addiu a0,gp,-32700
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 2784803c addiu a0,gp,-32708
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848038 addiu a0,gp,-32712
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848034 addiu a0,gp,-32716
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848030 addiu a0,gp,-32720
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
@@ -33,10 +33,10 @@ Disassembly of section .text:
.*: 24638000 addiu v1,v1,-32768
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
- .*: 8f838050 lw v1,-32688\(gp\)
+ .*: 8f83804c lw v1,-32692\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
- .*: 8f838044 lw v1,-32700\(gp\)
+ .*: 8f838040 lw v1,-32704\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
@@ -57,20 +57,20 @@ Disassembly of section .text:
.*: afbe0008 sw s8,8\(sp\)
.*: 03a0f021 move s8,sp
.*: afbc0000 sw gp,0\(sp\)
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848048 addiu a0,gp,-32696
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848044 addiu a0,gp,-32700
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 2784803c addiu a0,gp,-32708
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848038 addiu a0,gp,-32712
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
.*: 00000000 nop
- .*: 8f998030 lw t9,-32720\(gp\)
- .*: 27848034 addiu a0,gp,-32716
+ .*: 8f99802c lw t9,-32724\(gp\)
+ .*: 27848030 addiu a0,gp,-32720
.*: 0320f809 jalr t9
.*: 00000000 nop
.*: 8fdc0000 lw gp,0\(s8\)
@@ -79,10 +79,10 @@ Disassembly of section .text:
.*: 24638000 addiu v1,v1,-32768
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
- .*: 8f838050 lw v1,-32688\(gp\)
+ .*: 8f83804c lw v1,-32692\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
- .*: 8f838044 lw v1,-32700\(gp\)
+ .*: 8f838040 lw v1,-32704\(gp\)
.*: 00000000 nop
.*: 00621821 addu v1,v1,v0
.*: 7c02283b rdhwr v0,\$5
Index: ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got,v
retrieving revision 1.4
diff -u -p -r1.4 tlsdyn-o32-3.got
--- ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got 20 Oct 2006 07:57:02 -0000 1.4
+++ ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got 11 Aug 2007 12:54:27 -0000
@@ -4,17 +4,17 @@
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
00000000 R_MIPS_NONE \*ABS\*
-10000058 R_MIPS_TLS_DTPMOD32 tlsbin_gd
-1000005c R_MIPS_TLS_DTPREL32 tlsbin_gd
-1000004c R_MIPS_TLS_DTPMOD32 tlsvar_gd
-10000050 R_MIPS_TLS_DTPREL32 tlsvar_gd
-10000054 R_MIPS_TLS_TPREL32 tlsvar_ie
-10000060 R_MIPS_TLS_TPREL32 tlsbin_ie
+10000054 R_MIPS_TLS_DTPMOD32 tlsbin_gd
+10000058 R_MIPS_TLS_DTPREL32 tlsbin_gd
+10000048 R_MIPS_TLS_DTPMOD32 tlsvar_gd
+1000004c R_MIPS_TLS_DTPREL32 tlsvar_gd
+10000050 R_MIPS_TLS_TPREL32 tlsvar_ie
+1000005c R_MIPS_TLS_TPREL32 tlsbin_ie
Contents of section .got:
- 10000020 00000000 80000000 00000000 00000000 ................
- 10000030 00000000 00000000 00000000 00000000 ................
- 10000040 004005ec 00000001 00000000 00000000 .@..............
- 10000050 00000000 00000000 00000000 00000000 ................
- 10000060 00000000 00000000 00000000 00000000 ................
+ 10000020 00000000 80000000 00000000 00000000 .*
+ 10000030 00000000 00000000 00000000 004005ec .*
+ 10000040 00000001 00000000 00000000 00000000 .*
+ 10000050 00000000 00000000 00000000 00000000 .*
+ 10000060 00000000 00000000 00000000 .*
Index: ld/testsuite/ld-mips-elf/vxworks1-lib.dd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/vxworks1-lib.dd,v
retrieving revision 1.1
diff -u -p -r1.1 vxworks1-lib.dd
--- ld/testsuite/ld-mips-elf/vxworks1-lib.dd 22 Mar 2006 09:28:15 -0000 1.1
+++ ld/testsuite/ld-mips-elf/vxworks1-lib.dd 11 Aug 2007 12:54:27 -0000
@@ -22,7 +22,7 @@ Disassembly of section \.text:
80c0c: 3c1c0000 lui gp,0x0
80c10: 8f9c0000 lw gp,0\(gp\)
80c14: 8f9c0000 lw gp,0\(gp\)
- 80c18: 8f820014 lw v0,20\(gp\)
+ 80c18: 8f820010 lw v0,16\(gp\)
80c1c: 8c430000 lw v1,0\(v0\)
80c20: 24630001 addiu v1,v1,1
80c24: ac430000 sw v1,0\(v0\)
Index: ld/testsuite/ld-mips-elf/vxworks1-lib.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/vxworks1-lib.rd,v
retrieving revision 1.3
diff -u -p -r1.3 vxworks1-lib.rd
--- ld/testsuite/ld-mips-elf/vxworks1-lib.rd 15 May 2007 12:22:34 -0000 1.3
+++ ld/testsuite/ld-mips-elf/vxworks1-lib.rd 11 Aug 2007 12:54:27 -0000
@@ -9,9 +9,8 @@ Relocation section '\.rela\.dyn' at offs
00081804 00000002 R_MIPS_32 00081800
00081808 .*02 R_MIPS_32 00081808 dglobal \+ 0
0008180c .*02 R_MIPS_32 00000000 dexternal \+ 0
-00081424 .*02 R_MIPS_32 00081c00 x \+ 0
-00000000 00000000 R_MIPS_NONE 00000000
-#...
+00081420 .*02 R_MIPS_32 00081c00 x \+ 0
+
Relocation section '\.rela\.plt' at offset .* contains 2 entries:
Offset Info Type Sym\.Value Sym\. Name \+ Addend
00081400 .*7f R_MIPS_JUMP_SLOT 00000000 sexternal \+ 0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fixes to _bfd_mips_elf_hide_symbol
2007-08-11 13:06 Fixes to _bfd_mips_elf_hide_symbol Richard Sandiford
@ 2007-08-13 18:45 ` Thiemo Seufer
2007-08-19 11:04 ` Thiemo Seufer
0 siblings, 1 reply; 5+ messages in thread
From: Thiemo Seufer @ 2007-08-13 18:45 UTC (permalink / raw)
To: binutils, kaminaga, richard
Richard Sandiford wrote:
[snip]
> Tested on mips-linux-gnu, mips64-linux-gnu and mips-wrs-vxworks.
> OK to install?
>
> Richard
>
>
> bfd/
> * elfxx-mips.c (mips_elf_link_hash_table): Add computed_got_sizes.
> (mips_elf_record_global_got_symbol): Increment local_gotno for
> each forced-local symbol.
> (_bfd_mips_elf_check_relocs): Pass forced-local call symbols to
> mips_elf_record_global_got_symbol for VxWorks too.
> (_bfd_mips_elf_always_size_sections): Set it to true after computing
> the GOT size.
> (_bfd_mips_elf_hide_symbol): Increase local_gotno whenever
> got.offset == 1. Only adjust global_gotno if computed_got_sizes.
> For VxWorks, add a local entry when hiding a symbol that needs a
> plt but has not been marked as needing a global got entry.
> (_bfd_mips_elf_link_hash_table_create): Set computed_got_sizes to
> false.
>
> ld/testsuite/
> * ld-mips-elf/vxworks-forced-local-1.d,
> * ld-mips-elf/vxworks-forced-local-1.s,
> * ld-mips-elf/vxworks-forced-local-1.ver: New test.
> * ld-mips-elf/mips-elf.exp: Run it.
> * ld-mips-elf/tlsdyn-o32-2.d: Adjust for removal of unnecessary
> local GOT entry.
> * ld-mips-elf/tlsdyn-o32-2.got: Likewise.
> * ld-mips-elf/tlsdyn-o32-3.d: Likewise.
> * ld-mips-elf/tlsdyn-o32-3.got: Likewise.
> * ld-mips-elf/vxworks1-lib.dd: Likewise.
> * ld-mips-elf/vxworks1-lib.rd: Likewise.
Ok.
Thiemo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fixes to _bfd_mips_elf_hide_symbol
2007-08-13 18:45 ` Thiemo Seufer
@ 2007-08-19 11:04 ` Thiemo Seufer
2007-08-20 8:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 5+ messages in thread
From: Thiemo Seufer @ 2007-08-19 11:04 UTC (permalink / raw)
To: drow, richard; +Cc: binutils, kaminaga
Thiemo Seufer wrote:
> Richard Sandiford wrote:
> [snip]
> > Tested on mips-linux-gnu, mips64-linux-gnu and mips-wrs-vxworks.
> > OK to install?
> >
> > Richard
> >
> >
> > bfd/
> > * elfxx-mips.c (mips_elf_link_hash_table): Add computed_got_sizes.
> > (mips_elf_record_global_got_symbol): Increment local_gotno for
> > each forced-local symbol.
> > (_bfd_mips_elf_check_relocs): Pass forced-local call symbols to
> > mips_elf_record_global_got_symbol for VxWorks too.
> > (_bfd_mips_elf_always_size_sections): Set it to true after computing
> > the GOT size.
> > (_bfd_mips_elf_hide_symbol): Increase local_gotno whenever
> > got.offset == 1. Only adjust global_gotno if computed_got_sizes.
> > For VxWorks, add a local entry when hiding a symbol that needs a
> > plt but has not been marked as needing a global got entry.
> > (_bfd_mips_elf_link_hash_table_create): Set computed_got_sizes to
> > false.
> >
> > ld/testsuite/
> > * ld-mips-elf/vxworks-forced-local-1.d,
> > * ld-mips-elf/vxworks-forced-local-1.s,
> > * ld-mips-elf/vxworks-forced-local-1.ver: New test.
> > * ld-mips-elf/mips-elf.exp: Run it.
> > * ld-mips-elf/tlsdyn-o32-2.d: Adjust for removal of unnecessary
> > local GOT entry.
> > * ld-mips-elf/tlsdyn-o32-2.got: Likewise.
> > * ld-mips-elf/tlsdyn-o32-3.d: Likewise.
> > * ld-mips-elf/tlsdyn-o32-3.got: Likewise.
> > * ld-mips-elf/vxworks1-lib.dd: Likewise.
> > * ld-mips-elf/vxworks1-lib.rd: Likewise.
>
> Ok.
Richard, Daniel, I think this should also go in the 2.18 branch.
Thiemo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fixes to _bfd_mips_elf_hide_symbol
2007-08-19 11:04 ` Thiemo Seufer
@ 2007-08-20 8:30 ` Daniel Jacobowitz
2007-08-20 13:49 ` Richard Sandiford
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-08-20 8:30 UTC (permalink / raw)
To: Thiemo Seufer; +Cc: richard, binutils, kaminaga
On Sat, Aug 18, 2007 at 01:55:35PM +0100, Thiemo Seufer wrote:
> Richard, Daniel, I think this should also go in the 2.18 branch.
I have no objection; Richard, could you apply it?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fixes to _bfd_mips_elf_hide_symbol
2007-08-20 8:30 ` Daniel Jacobowitz
@ 2007-08-20 13:49 ` Richard Sandiford
0 siblings, 0 replies; 5+ messages in thread
From: Richard Sandiford @ 2007-08-20 13:49 UTC (permalink / raw)
To: Thiemo Seufer; +Cc: binutils, kaminaga
Daniel Jacobowitz <drow@false.org> writes:
> On Sat, Aug 18, 2007 at 01:55:35PM +0100, Thiemo Seufer wrote:
>> Richard, Daniel, I think this should also go in the 2.18 branch.
>
> I have no objection; Richard, could you apply it?
Sure. Done after testing on mips64-linux-gnu and mips-wrs-vxworks.
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-20 12:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-11 13:06 Fixes to _bfd_mips_elf_hide_symbol Richard Sandiford
2007-08-13 18:45 ` Thiemo Seufer
2007-08-19 11:04 ` Thiemo Seufer
2007-08-20 8:30 ` Daniel Jacobowitz
2007-08-20 13:49 ` Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).