[PowerPC64] Fix reference to toc symbol

Message ID 20140325013906.GD18201@bubble.grove.modra.org
State Deferred
Delegated to: Adhemerval Zanella Netto
Headers

Commit Message

Alan Modra March 25, 2014, 1:39 a.m. UTC
  https://sourceware.org/ml/binutils/2014-03/msg00033.html removes the
"magic" treatment of symbols defined in a .toc section.  This results
in glibc failing to build correctly on powerpc64.  Fixed as follows.
This change is compatible with older binutils.

(Discovering this glibc bug led me to revert the binutils change since
it's a bit rude to prevent older glibc from building, but glibc still
ought to be fixed.)

	* sysdeps/powerpc/powerpc64/start.S: Add @toc to toc symbol reference.
  

Comments

Adhemerval Zanella Netto March 25, 2014, 7:06 p.m. UTC | #1
On 24-03-2014 22:39, Alan Modra wrote:
> https://sourceware.org/ml/binutils/2014-03/msg00033.html removes the
> "magic" treatment of symbols defined in a .toc section.  This results
> in glibc failing to build correctly on powerpc64.  Fixed as follows.
> This change is compatible with older binutils.
>
> (Discovering this glibc bug led me to revert the binutils change since
> it's a bit rude to prevent older glibc from building, but glibc still
> ought to be fixed.)
>
> 	* sysdeps/powerpc/powerpc64/start.S: Add @toc to toc symbol reference.
>
> diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S
> index 15e29d9..934c558 100644
> --- a/sysdeps/powerpc/powerpc64/start.S
> +++ b/sysdeps/powerpc/powerpc64/start.S
> @@ -74,7 +74,7 @@ ENTRY(_start)
>
>   /* put the address of start_addresses in r8...  **
>  ** PPC64 ABI uses R13 for thread local, so we leave it alone */
> -	ld	r8,.L01(r2)
> +	ld	r8,.L01@toc(r2)
>
>   /* and continue in libc-start, in glibc.  */
>  	b	JUMPTARGET(__libc_start_main)
>
The patch is ok, thanks Alan.
  

Patch

diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S
index 15e29d9..934c558 100644
--- a/sysdeps/powerpc/powerpc64/start.S
+++ b/sysdeps/powerpc/powerpc64/start.S
@@ -74,7 +74,7 @@  ENTRY(_start)
 
  /* put the address of start_addresses in r8...  **
 ** PPC64 ABI uses R13 for thread local, so we leave it alone */
-	ld	r8,.L01(r2)
+	ld	r8,.L01@toc(r2)
 
  /* and continue in libc-start, in glibc.  */
 	b	JUMPTARGET(__libc_start_main)