This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [BZ #20072] x86 init_cpu_features is called twice in static executable


In static executable, since init_cpu_features is called early from
__libc_start_main, there is no need to call it again in dl_platform_init.

Tested on x86 and x86-64.  Any comments, feedbacks?

H.J.
---
	[BZ #20072]
	* sysdeps/i386/dl-machine.h (dl_platform_init): Call
	init_cpu_features only if SHARED is defined.
	* sysdeps/x86_64/dl-machine.h (dl_platform_init): Likewise.
---
 sysdeps/i386/dl-machine.h   | 2 ++
 sysdeps/x86_64/dl-machine.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 130bcf5..9c34a90 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -237,7 +237,9 @@ dl_platform_init (void)
     /* Avoid an empty string which would disturb us.  */
     GLRO(dl_platform) = NULL;
 
+#ifdef SHARED
   init_cpu_features (&GLRO(dl_x86_cpu_features));
+#endif
 }
 
 static inline Elf32_Addr
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 980ca73..6998d0b 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -224,7 +224,9 @@ dl_platform_init (void)
     /* Avoid an empty string which would disturb us.  */
     GLRO(dl_platform) = NULL;
 
+#ifdef SHARED
   init_cpu_features (&GLRO(dl_x86_cpu_features));
+#endif
 }
 
 static inline ElfW(Addr)
-- 
2.5.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]