[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-07-11 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

Maciej W. Rozycki  changed:

   What|Removed |Added

 CC||ma...@linux-mips.org
 Resolution|DUPLICATE   |FIXED
   Assignee|unassigned at sourceware dot org   |ma...@linux-mips.org

--- Comment #6 from Maciej W. Rozycki  ---
Not really a duplicate, and fixed now.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-07-11 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #5 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9143e72c6d4ddefbcb41c0f6361ad140354145ef

commit 9143e72c6d4ddefbcb41c0f6361ad140354145ef
Author: Maciej W. Rozycki 
Date:   Wed Jul 11 17:44:45 2018 +0100

PR ld/22570: MIPS/BFD: Fix TLS relocation resolution for PIE executables

Correct a commit 0e1862bb401f ("Add output_type to bfd_link_info") issue
and use `bfd_link_dll' rather than `bfd_link_pic' in determining whether
to fully resolve GD, LD and IE TLS relocations referring to symbols
locally defined rather than deferring them to the load time by means of
dynamic relocations.

Such symbols cannot be preempted in PIE executables, which are
necessarily PIC, and therefore their values (thread pointer offsets) are
fixed at the static link time as is the associated module ID of the main
executable.

Given the `tlsbin-o32.s' and `tlsdyn-o32.s' sources from our test suite
this removes the absolute TLS relocations from the static:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE  VALUE
 R_MIPS_NONE   *ABS*
102c R_MIPS_TLS_TPREL32  *ABS*
1030 R_MIPS_TLS_DTPMOD32  *ABS*
1038 R_MIPS_TLS_DTPMOD32  *ABS*

and the dynamic:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE  VALUE
 R_MIPS_NONE   *ABS*
102c R_MIPS_TLS_TPREL32  *ABS*
1038 R_MIPS_TLS_DTPMOD32  *ABS*
1044 R_MIPS_TLS_DTPMOD32  *ABS*
1030 R_MIPS_TLS_DTPMOD32  tlsvar_gd
1034 R_MIPS_TLS_DTPREL32  tlsvar_gd
1040 R_MIPS_TLS_TPREL32  tlsvar_ie

PIE executable respectively, as reported by `objdump -R', and fills the
corresponding GOT slots with the values expected, as recorded with the
test cases added.  The new output from `objdump -R' is:

DYNAMIC RELOCATION RECORDS (none)

and:

DYNAMIC RELOCATION RECORDS
OFFSET   TYPE  VALUE
 R_MIPS_NONE   *ABS*
1030 R_MIPS_TLS_DTPMOD32  tlsvar_gd
1034 R_MIPS_TLS_DTPREL32  tlsvar_gd
1040 R_MIPS_TLS_TPREL32  tlsvar_ie

for the static and the dynamic executable respectively.

2018-07-11  Maciej W. Rozycki  
Rich Felker  

bfd/
PR ld/22570
* elfxx-mips.c (mips_tls_got_relocs): Use `bfd_link_dll' rather
than `bfd_link_pic' to determine whether dynamic relocations are
to be produced.
(mips_elf_initialize_tls_slots): Likewise.

ld/
PR ld/22570
* testsuite/ld-mips-elf/tlsbin-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsbin-pie-o32.got: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.d: New test.
* testsuite/ld-mips-elf/tlsdyn-pie-o32.got: New test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-03-31 Thread jeremip11 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

Jeremi  changed:

   What|Removed |Added

 CC||jeremip11 at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #4 from H.J. Lu  ---
Dup.

*** This bug has been marked as a duplicate of bug 22263 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #3 from H.J. Lu  ---
This looks like a dup of PR 22263.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread bugdal at aerifal dot cx
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #2 from Rich Felker  ---
Created attachment 10762
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10762=edit
proposed fix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread bugdal at aerifal dot cx
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #1 from Rich Felker  ---
The details of my assessment seem to have been written in terms of 2.25; with
the changes from commit 0e1862bb40, the problem is now use of bfd_link_pic
where bfd_link_dll was presumably intended. I'm attaching a patch which seems
to correct the issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/22570] ld fails to bind DTPMOD at link time for pie on mips

2017-12-07 Thread bugdal at aerifal dot cx
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

Rich Felker  changed:

   What|Removed |Added

 Target||mips*-*-*-*

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils