public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] elf: Only build tst-unique{1, 2} if compiler supports gnu_unique_object
Date: Mon,  4 Apr 2022 12:58:41 +0000 (GMT)	[thread overview]
Message-ID: <20220404125841.EEB083858009@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=41451cc4f948c673acd6040b927f3df90727a3e8

commit 41451cc4f948c673acd6040b927f3df90727a3e8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Mar 28 21:20:01 2022 +0000

    elf: Only build tst-unique{1,2} if compiler supports gnu_unique_object

Diff:
---
 configure    | 23 +++++++++++++++++++++++
 configure.ac | 17 +++++++++++++++++
 elf/Makefile | 20 ++++++++++++++------
 3 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 6abcd4f479..7c5bf74237 100755
--- a/configure
+++ b/configure
@@ -6804,6 +6804,29 @@ $as_echo "$libc_cv_cc_charset_ascii" >&6; }
 config_vars="$config_vars
 config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports gnu_unique_object" >&5
+$as_echo_n "checking if $CC supports gnu_unique_object... " >&6; }
+if ${libc_cv_cc_gnu_unique_object+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.S <<EOF
+.type foo, %gnu_unique_object;
+.globl foo;
+foo:
+EOF
+libc_cv_cc_gnu_unique_object=no
+if ${CC-cc} $CFLAGS $CPPFLAGS -c conftest.S 1>&5 2>&5;
+then
+  LC_ALL=C $READELF -s conftest.o | grep -q 'UNIQUE' && { libc_cv_cc_gnu_unique_object=yes
+  }
+fi
+rm -rf conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_gnu_unique_object" >&5
+$as_echo "$libc_cv_cc_gnu_unique_object" >&6; }
+config_vars="$config_vars
+config-gnu-unique-object = $libc_cv_cc_gnu_unique_object"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 3024e72cb9..119fa4c300 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1751,6 +1751,23 @@ LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
 LIBC_CONFIG_VAR([config-cflags-charset-ascii],
 		[$libc_cv_cc_charset_ascii])
 
+dnl Check if compiler supports %gnu_unique_object
+AC_CACHE_CHECK([if $CC supports gnu_unique_object], libc_cv_cc_gnu_unique_object, [dnl
+cat > conftest.S <<EOF
+.type foo, %gnu_unique_object;
+.globl foo;
+foo:
+EOF
+libc_cv_cc_gnu_unique_object=no
+if ${CC-cc} $CFLAGS $CPPFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
+then
+  LC_ALL=C $READELF -s conftest.o | grep -q 'UNIQUE' && { libc_cv_cc_gnu_unique_object=yes
+  }
+fi
+rm -rf conftest*])
+LIBC_CONFIG_VAR([config-gnu-unique-object],
+		[$libc_cv_cc_gnu_unique_object])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/elf/Makefile b/elf/Makefile
index 320d4c778a..724e35f0c4 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -457,8 +457,6 @@ tests += \
   tst-tls-ie \
   tst-tls-ie-dlmopen \
   tst-tls-manydynamic \
-  tst-unique1 \
-  tst-unique2 \
   tst-unwind-ctor \
   tst-unwind-main \
   unload3 \
@@ -469,6 +467,12 @@ tests += \
   unload8 \
   valgrind-test \
   # tests
+ifeq (yes,$(config-gnu-unique-object))
+tests += \
+  tst-unique1 \
+  tst-unique2 \
+  # tests
+endif
 tests-cxx = \
   tst-dlopen-nodelete-reloc \
   tst-nodelete \
@@ -822,10 +826,6 @@ modules-names = \
   tst-tlsmod7 \
   tst-tlsmod8 \
   tst-tlsmod9 \
-  tst-unique1mod1 \
-  tst-unique1mod2 \
-  tst-unique2mod1 \
-  tst-unique2mod2 \
   tst-unwind-ctor-lib \
   unload2dep \
   unload2mod \
@@ -851,6 +851,14 @@ modules-names = \
   vismod2 \
   vismod3 \
 # modules-names
+ifeq (yes,$(config-gnu-unique-object))
+modules-names += \
+  tst-unique1mod1 \
+  tst-unique1mod2 \
+  tst-unique2mod1 \
+  tst-unique2mod2 \
+# modules-names
+endif
 
 modules-names-cxx = \
   tst-dlopen-nodelete-reloc-mod1 \


             reply	other threads:[~2022-04-04 12:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 12:58 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-06-09 21:24 Adhemerval Zanella
2022-06-09 13:21 Adhemerval Zanella
2022-06-03 14:10 Adhemerval Zanella
2022-05-13 14:24 Adhemerval Zanella
2022-05-12 19:38 Adhemerval Zanella
2022-05-10 18:28 Adhemerval Zanella
2022-04-29 14:08 Adhemerval Zanella
2022-03-31 19:11 Adhemerval Zanella
2022-03-29 20:35 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220404125841.EEB083858009@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).