public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@redhat.com>
To: binutils@sourceware.org
Subject: [M68K] Fix TLS_GD relocation against localized symbol
Date: Tue, 01 Feb 2011 15:16:00 -0000	[thread overview]
Message-ID: <m3oc6vu6np.fsf@redhat.com> (raw)

A TLS_GD relocation is associated with two GOT slots, with the
relocation value actually being put in the second slot.  When adjusting
this relocation against a localized symbol read the value from the
second slot, not the first one.

Andreas.

2011-02-01  Andreas Schwab  <schwab@redhat.com>

	* elf32-m68k.c (elf_m68k_finish_dynamic_symbol): For a TLS_GD
	relocation read the value from the second GOT slot.

Index: elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.124
diff -a -u -p -a -u -p -r1.124 elf32-m68k.c
--- elf32-m68k.c	25 Oct 2010 15:54:14 -0000	1.124
+++ elf32-m68k.c	1 Feb 2011 15:01:39 -0000
@@ -1,6 +1,6 @@
 /* Motorola 68k series support for 32-bit ELF
    Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -4390,6 +4390,11 @@ elf_m68k_finish_dynamic_symbol (output_b
 		  break;
 
 		case R_68K_TLS_GD32:
+		  /* The value for this relocation is actually put in
+		     the second GOT slot.  */
+		  relocation = bfd_get_signed_32 (output_bfd,
+						  (sgot->contents
+						   + got_entry_offset + 4));
 		  relocation += dtpoff_base (info);
 		  break;
 

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

             reply	other threads:[~2011-02-01 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-01 15:16 Andreas Schwab [this message]
2011-02-14  9:46 ` Andreas Schwab
2011-02-22 15:32   ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3oc6vu6np.fsf@redhat.com \
    --to=schwab@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).