qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix missing symbols in .rel/.rela.plt sections
@ 2010-01-31 11:22 Loïc Minier
  2010-02-06 21:23 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Loïc Minier @ 2010-01-31 11:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Loïc Minier

Fix .rel.plt sections in the output to not only include .rel.plt
sections from the input but also the .rel.iplt sections and to define
the hidden symbols __rel_iplt_start and __rel_iplt_end around
.rel.iplt as otherwise we get undefined references to these when
linking statically to a multilib libc.a.  This fixes the static build
under i386.

Apply similar logic to rela.plt/.iplt and __rela_iplt/_plt_start/_end to
fix the static build under amd64.

Signed-off-by: Loïc Minier <lool@dooz.org>
---
 i386.ld   |   16 ++++++++++++++--
 x86_64.ld |   16 ++++++++++++++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/i386.ld b/i386.ld
index f2dafec..f8df7bf 100644
--- a/i386.ld
+++ b/i386.ld
@@ -39,8 +39,20 @@ SECTIONS
   .rela.fini     : { *(.rela.fini)	}
   .rel.bss       : { *(.rel.bss)		}
   .rela.bss      : { *(.rela.bss)		}
-  .rel.plt       : { *(.rel.plt)		}
-  .rela.plt      : { *(.rela.plt)		}
+  .rel.plt      :
+  {
+    *(.rel.plt)
+    PROVIDE_HIDDEN (__rel_iplt_start = .);
+    *(.rel.iplt)
+    PROVIDE_HIDDEN (__rel_iplt_end = .);
+  }
+  .rela.plt       :
+  {
+    *(.rela.plt)
+    PROVIDE_HIDDEN (__rela_iplt_start = .);
+    *(.rela.iplt)
+    PROVIDE_HIDDEN (__rela_iplt_end = .);
+  }
   .init          : { *(.init)	} =0x47ff041f
   .text      :
   {
diff --git a/x86_64.ld b/x86_64.ld
index 24ea77d..46d8d4d 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -35,8 +35,20 @@ SECTIONS
   .rela.got       : { *(.rela.got) }
   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
-  .rel.plt        : { *(.rel.plt) }
-  .rela.plt       : { *(.rela.plt) }
+  .rel.plt      :
+  {
+    *(.rel.plt)
+    PROVIDE_HIDDEN (__rel_iplt_start = .);
+    *(.rel.iplt)
+    PROVIDE_HIDDEN (__rel_iplt_end = .);
+  }
+  .rela.plt       :
+  {
+    *(.rela.plt)
+    PROVIDE_HIDDEN (__rela_iplt_start = .);
+    *(.rela.iplt)
+    PROVIDE_HIDDEN (__rela_iplt_end = .);
+  }
   .init           :
   {
     KEEP (*(.init))
-- 
1.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix missing symbols in .rel/.rela.plt sections
  2010-01-31 11:22 [Qemu-devel] [PATCH] Fix missing symbols in .rel/.rela.plt sections Loïc Minier
@ 2010-02-06 21:23 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2010-02-06 21:23 UTC (permalink / raw)
  To: Loïc Minier; +Cc: qemu-devel

On Sun, Jan 31, 2010 at 12:22:52PM +0100, Loïc Minier wrote:
> Fix .rel.plt sections in the output to not only include .rel.plt
> sections from the input but also the .rel.iplt sections and to define
> the hidden symbols __rel_iplt_start and __rel_iplt_end around
> .rel.iplt as otherwise we get undefined references to these when
> linking statically to a multilib libc.a.  This fixes the static build
> under i386.
> 
> Apply similar logic to rela.plt/.iplt and __rela_iplt/_plt_start/_end to
> fix the static build under amd64.

Thanks, applied.

> Signed-off-by: Loïc Minier <lool@dooz.org>
> ---
>  i386.ld   |   16 ++++++++++++++--
>  x86_64.ld |   16 ++++++++++++++--
>  2 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/i386.ld b/i386.ld
> index f2dafec..f8df7bf 100644
> --- a/i386.ld
> +++ b/i386.ld
> @@ -39,8 +39,20 @@ SECTIONS
>    .rela.fini     : { *(.rela.fini)	}
>    .rel.bss       : { *(.rel.bss)		}
>    .rela.bss      : { *(.rela.bss)		}
> -  .rel.plt       : { *(.rel.plt)		}
> -  .rela.plt      : { *(.rela.plt)		}
> +  .rel.plt      :
> +  {
> +    *(.rel.plt)
> +    PROVIDE_HIDDEN (__rel_iplt_start = .);
> +    *(.rel.iplt)
> +    PROVIDE_HIDDEN (__rel_iplt_end = .);
> +  }
> +  .rela.plt       :
> +  {
> +    *(.rela.plt)
> +    PROVIDE_HIDDEN (__rela_iplt_start = .);
> +    *(.rela.iplt)
> +    PROVIDE_HIDDEN (__rela_iplt_end = .);
> +  }
>    .init          : { *(.init)	} =0x47ff041f
>    .text      :
>    {
> diff --git a/x86_64.ld b/x86_64.ld
> index 24ea77d..46d8d4d 100644
> --- a/x86_64.ld
> +++ b/x86_64.ld
> @@ -35,8 +35,20 @@ SECTIONS
>    .rela.got       : { *(.rela.got) }
>    .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
>    .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
> -  .rel.plt        : { *(.rel.plt) }
> -  .rela.plt       : { *(.rela.plt) }
> +  .rel.plt      :
> +  {
> +    *(.rel.plt)
> +    PROVIDE_HIDDEN (__rel_iplt_start = .);
> +    *(.rel.iplt)
> +    PROVIDE_HIDDEN (__rel_iplt_end = .);
> +  }
> +  .rela.plt       :
> +  {
> +    *(.rela.plt)
> +    PROVIDE_HIDDEN (__rela_iplt_start = .);
> +    *(.rela.iplt)
> +    PROVIDE_HIDDEN (__rela_iplt_end = .);
> +  }
>    .init           :
>    {
>      KEEP (*(.init))
> -- 
> 1.6.5
> 
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-06 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-31 11:22 [Qemu-devel] [PATCH] Fix missing symbols in .rel/.rela.plt sections Loïc Minier
2010-02-06 21:23 ` Aurelien Jarno

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 NNTP newsgroup(s).