public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 4/7] Add --early-cflags configure option
Date: Fri, 14 Jan 2022 13:40:35 +0100	[thread overview]
Message-ID: <ba54ada5b853d96208f1ca434e25ca5caf93eb56.1642162312.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1642162312.git.fweimer@redhat.com>

---
 config.make.in      |  1 +
 configure           | 13 +++++++++++++
 configure.ac        |  6 ++++++
 elf/Makefile        |  8 ++++++++
 manual/install.texi |  7 +++++++
 5 files changed, 35 insertions(+)

diff --git a/config.make.in b/config.make.in
index e8630a8d0c..e06f1ff49f 100644
--- a/config.make.in
+++ b/config.make.in
@@ -110,6 +110,7 @@ CFLAGS = @CFLAGS@
 CPPFLAGS-config = @CPPFLAGS@
 CPPUNDEFS = @CPPUNDEFS@
 extra-nonshared-cflags = @extra_nonshared_cflags@
+early-cflags = @early_cflags@
 ASFLAGS-config = @ASFLAGS_config@
 AR = @AR@
 NM = @NM@
diff --git a/configure b/configure
index 3f956cf777..6eedd8c3a7 100755
--- a/configure
+++ b/configure
@@ -681,6 +681,7 @@ force_install
 bindnow
 hardcoded_path_in_tests
 enable_timezone_tools
+early_cflags
 extra_nonshared_cflags
 use_default_link
 sysheaders
@@ -761,6 +762,7 @@ with_selinux
 with_headers
 with_default_link
 with_nonshared_cflags
+with_early_cflags
 with_timeoutfactor
 enable_sanity_checks
 enable_shared
@@ -1480,6 +1482,8 @@ Optional Packages:
   --with-default-link     do not use explicit linker scripts
   --with-nonshared-cflags=CFLAGS
                           build nonshared libraries with additional CFLAGS
+  --with-early-cflags=CFLAGS
+                          build early initialization with additional CFLAGS
   --with-timeoutfactor=NUM
                           specify an integer to scale the timeout
   --with-cpu=CPU          select code for CPU variant
@@ -3386,6 +3390,15 @@ fi
 
 
 
+# Check whether --with-early-cflags was given.
+if test "${with_early_cflags+set}" = set; then :
+  withval=$with_early_cflags; early_cflags=$withval
+else
+  early_cflags=
+fi
+
+
+
 
 # Check whether --with-timeoutfactor was given.
 if test "${with_timeoutfactor+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index 277d3527d2..445b0b7f15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,12 @@ AC_ARG_WITH([nonshared-cflags],
 	    [extra_nonshared_cflags=$withval],
 	    [extra_nonshared_cflags=])
 AC_SUBST(extra_nonshared_cflags)
+AC_ARG_WITH([early-cflags],
+	    AS_HELP_STRING([--with-early-cflags=CFLAGS],
+			   [build early initialization with additional CFLAGS]),
+	    [early_cflags=$withval],
+	    [early_cflags=])
+AC_SUBST(early_cflags)
 
 AC_ARG_WITH([timeoutfactor],
 	    AS_HELP_STRING([--with-timeoutfactor=NUM],
diff --git a/elf/Makefile b/elf/Makefile
index 0c4be43deb..9fcb4ebd13 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -99,6 +99,14 @@ CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
 CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
 
+# Add the requested compiler flags to the early startup code.
+CFLAGS-dl-printf.os += $(early-cflags)
+CFLAGS-dl-sysdep.os += $(early-cflags)
+CFLAGS-dl-tunables.os += $(early-cflags)
+CFLAGS-dl-write.os += $(early-cflags)
+CFLAGS-dl-writev.os += $(early-cflags)
+CFLAGS-rtld.os += $(early-cflags)
+
 ifeq ($(unwind-find-fde),yes)
 routines += unwind-dw2-fde-glibc
 shared-only-routines += unwind-dw2-fde-glibc
diff --git a/manual/install.texi b/manual/install.texi
index b1afc56f5a..27d5893c5e 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -131,6 +131,13 @@ that the objects in @file{libc_nonshared.a} are compiled with this flag
 (although this will not affect the generated code in this particular
 case and potentially change debugging information and metadata only).
 
+@item --with-early-cflags=@var{cflags}
+Use additional compiler flags @var{cflags} to build the early startup
+code of the dynamic linker.  These flags can be used to enable early
+dynamic linker diagnostics to run on CPUs which are not compatible with
+the rest of @theglibc{}, for example, due to compiler flags which target
+a later instruction set architecture (ISA).
+
 @item --with-timeoutfactor=@var{NUM}
 Specify an integer @var{NUM} to scale the timeout of test programs.
 This factor can be changed at run time using @env{TIMEOUTFACTOR}
-- 
2.34.1



  parent reply	other threads:[~2022-01-14 12:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 12:40 [PATCH 0/7] Reliable CPU compatibility diagnostics in ld.so Florian Weimer
2022-01-14 12:40 ` [PATCH 1/7] x86: HAVE_X86_LAHF_SAHF, HAVE_X86_MOVBE and -march=x86-64-vN (bug 28782) Florian Weimer
2022-01-14 14:21   ` H.J. Lu
2022-01-14 12:40 ` [PATCH 2/7] Generate gcc-macros.h Florian Weimer
2022-01-14 14:24   ` H.J. Lu
2022-01-14 12:40 ` [PATCH 3/7] elf: Split dl-printf.c from dl-misc.c Florian Weimer
2022-01-14 14:25   ` H.J. Lu
2022-01-14 14:27     ` Florian Weimer
2022-01-14 14:32       ` H.J. Lu
2022-01-14 12:40 ` Florian Weimer [this message]
2022-01-14 14:27   ` [PATCH 4/7] Add --early-cflags configure option H.J. Lu
2022-01-14 14:29     ` Florian Weimer
2022-01-14 14:33       ` H.J. Lu
2022-01-14 14:34         ` Florian Weimer
2022-01-14 12:40 ` [PATCH 5/7] powerpc64le: Use <gcc-macros.h> in early HWCAP check Florian Weimer
2022-01-14 12:41 ` [PATCH 6/7] x86: Add x86-64-vN check to early startup Florian Weimer
2022-01-14 12:41 ` [PATCH 7/7] s390x: Use <gcc-macros.h> in early HWCAP check Florian Weimer
2022-01-18 12:42   ` Stefan Liebler
2022-01-18 12:54     ` Florian Weimer
2022-01-18 13:31       ` Stefan Liebler
2022-01-18 13:33         ` Florian Weimer
2022-01-18 13:38           ` Stefan Liebler
2022-01-18 21:03             ` Joseph Myers
2022-01-18 21:21               ` Florian Weimer

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=ba54ada5b853d96208f1ca434e25ca5caf93eb56.1642162312.git.fweimer@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@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).