x86: Don't include cacheinfo.c in ld.so

Message ID 20170524031303.GA12000@gmail.com
State New, archived
Headers

Commit Message

H.J. Lu May 24, 2017, 3:13 a.m. UTC
  Since cacheinfo.c isn't used by ld.so, there is no need to include it
in ld.so.

Any comments.

H.J.
---
	* sysdeps/x86/cacheinfo.c: Skip if not in libc.
---
 sysdeps/x86/cacheinfo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Siddhesh Poyarekar May 24, 2017, 5:15 a.m. UTC | #1
On Wednesday 24 May 2017 08:43 AM, H.J. Lu wrote:
> Since cacheinfo.c isn't used by ld.so, there is no need to include it
> in ld.so.
> 
> Any comments.

Why is this necessary?  In what condition does cacheinfo.c get built
into ld.so?

Siddhesh

> H.J.
> ---
> 	* sysdeps/x86/cacheinfo.c: Skip if not in libc.
> ---
>  sysdeps/x86/cacheinfo.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
> index 43c0b63..12ffeef 100644
> --- a/sysdeps/x86/cacheinfo.c
> +++ b/sysdeps/x86/cacheinfo.c
> @@ -16,6 +16,8 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>  
> +#if IS_IN (libc)
> +
>  #include <assert.h>
>  #include <stdbool.h>
>  #include <stdlib.h>
> @@ -769,3 +770,5 @@ intel_bug_no_cache_info:
>       store becomes faster.  */
>    __x86_shared_non_temporal_threshold = __x86_shared_cache_size * 6;
>  }
> +
> +#endif
>
  
Andreas Schwab May 24, 2017, 7:40 a.m. UTC | #2
On Mai 23 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote:

> Since cacheinfo.c isn't used by ld.so,

It isn't?  According to librtld.map, it is referenced by
libc_pic.a(memmove.os) (__x86_shared_non_temporal_threshold).

I think the real issue is that ld.so is including the multiarch string
functions.

rtld-string +=strcmp-ssse3.os
rtld-string +=strcmp-sse2-unaligned.os
rtld-string +=memcmp-sse4.os
rtld-string +=memcpy-ssse3.os
rtld-string +=memmove-ssse3.os
rtld-string +=memcpy-ssse3-back.os
rtld-string +=memmove-ssse3-back.os
rtld-string +=memmove-avx512-no-vzeroupper.os
rtld-string +=stpcpy-ssse3.os
rtld-string +=stpcpy-sse2-unaligned.os
rtld-string +=strchr-sse2-no-bsf.os
rtld-string +=memcmp-ssse3.os
rtld-string +=memset-avx512-no-vzeroupper.os
rtld-string +=memmove-avx-unaligned-erms.os
rtld-string +=memmove-avx512-unaligned-erms.os
rtld-string +=memset-avx2-unaligned-erms.os
rtld-string +=memset-avx512-unaligned-erms.os

Andreas.
  
Andreas Schwab May 24, 2017, 8:07 a.m. UTC | #3
I got confused by the method this list is computed.  This is ok.

Andreas.
  

Patch

diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
index 43c0b63..12ffeef 100644
--- a/sysdeps/x86/cacheinfo.c
+++ b/sysdeps/x86/cacheinfo.c
@@ -16,6 +16,8 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#if IS_IN (libc)
+
 #include <assert.h>
 #include <stdbool.h>
 #include <stdlib.h>
@@ -769,3 +770,5 @@  intel_bug_no_cache_info:
      store becomes faster.  */
   __x86_shared_non_temporal_threshold = __x86_shared_cache_size * 6;
 }
+
+#endif