Remove zero terminator for .eh_frame in libc.so [BZ #22053]

Message ID 20170831135308.GA26865@gmail.com
State New, archived
Headers

Commit Message

H.J. Lu Aug. 31, 2017, 1:53 p.m. UTC
  elf/sofini.c has a zero terminator for .eh_frame in libc.so.  It was
added before -eh-frame-hdr is added to ld.  Since -eh-frame-hdr is
always used to build libc.so, zero terminator in elf/sofini.c can be
removed.

Tested on x86-64.  OK for master?

H.J.
---
	[BZ #22053]
	* elf/sofini.c (__FRAME_END__): Removed.
---
 elf/sofini.c | 8 --------
 1 file changed, 8 deletions(-)
  

Comments

Alan Modra Sept. 1, 2017, 1:01 a.m. UTC | #1
On Thu, Aug 31, 2017 at 06:53:08AM -0700, H.J. Lu wrote:
> elf/sofini.c has a zero terminator for .eh_frame in libc.so.  It was
> added before -eh-frame-hdr is added to ld.  Since -eh-frame-hdr is
> always used to build libc.so, zero terminator in elf/sofini.c can be
> removed.

This might be true, but the real problem is that elf/sofini.os appears
on the libc.so link command line before -lgcc.

> Tested on x86-64.  OK for master?
> 
> H.J.
> ---
> 	[BZ #22053]
> 	* elf/sofini.c (__FRAME_END__): Removed.
> ---
>  elf/sofini.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/elf/sofini.c b/elf/sofini.c
> index 13e74b7903..7ec313be4e 100644
> --- a/elf/sofini.c
> +++ b/elf/sofini.c
> @@ -9,11 +9,3 @@ static void (*const __DTOR_END__[1]) (void)
>       __attribute__ ((used, section (".dtors")))
>       = { 0 };
>  #endif
> -
> -/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
> -   this would be the 'length' field in a real FDE.  */
> -
> -typedef unsigned int ui32 __attribute__ ((mode (SI)));
> -static const ui32 __FRAME_END__[1]
> -  __attribute__ ((used, section (".eh_frame")))
> -  = { 0 };
> -- 
> 2.13.5
>
  
H.J. Lu Sept. 1, 2017, 3:06 p.m. UTC | #2
On Thu, Aug 31, 2017 at 6:01 PM, Alan Modra <amodra@gmail.com> wrote:
> On Thu, Aug 31, 2017 at 06:53:08AM -0700, H.J. Lu wrote:
>> elf/sofini.c has a zero terminator for .eh_frame in libc.so.  It was
>> added before -eh-frame-hdr is added to ld.  Since -eh-frame-hdr is
>> always used to build libc.so, zero terminator in elf/sofini.c can be
>> removed.
>
> This might be true, but the real problem is that elf/sofini.os appears
> on the libc.so link command line before -lgcc.
>

This has been fixed for glibc 2.27.
  

Patch

diff --git a/elf/sofini.c b/elf/sofini.c
index 13e74b7903..7ec313be4e 100644
--- a/elf/sofini.c
+++ b/elf/sofini.c
@@ -9,11 +9,3 @@  static void (*const __DTOR_END__[1]) (void)
      __attribute__ ((used, section (".dtors")))
      = { 0 };
 #endif
-
-/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
-   this would be the 'length' field in a real FDE.  */
-
-typedef unsigned int ui32 __attribute__ ((mode (SI)));
-static const ui32 __FRAME_END__[1]
-  __attribute__ ((used, section (".eh_frame")))
-  = { 0 };