This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: unit-at-a-time fixes


Here's an updated patch following Jakub's suggestion.

The configure patch also contains a patch for -fpie.  Since main was
missing there, the check never succeeded but errored out with "no main
function defined".

I've tested the patch below with the GCC 3.3 hammer-branch on AMD64.

Ok to commit?

Andreas

2003-11-30  Andreas Jaeger  <aj@suse.de>

	* config.make.in (fno-unit-at-a-time): Define.

	* configure.in: Add test for -fno-unit-at-a-time.
	Fix text for -fpie.

	* csu/Makefile (CFLAGS-initfini.s): Add $(fno_unit_at_a_time).
	* locale/Makefile (CFLAGS-loadlocale.c): Likewise.

For linuxthreads:
	* Makefile (CFLAGS-pt-initfini.s): Add $(fno_unit_at_a_time).
	* sysdeps/unix/sysv/linux/x86_64/Makefile (CFLAGS-pt-initfini.s):
	Likewise.

For nptl:
	* Makefile (CFLAGS-pt-initfini.s): Add $(fno_unit_at_a_time).
	* sysdeps/unix/sysv/linux/x86_64/Makefile (CFLAGS-pt-initfini.s):
	Likewise.

============================================================
Index: csu/Makefile
--- csu/Makefile	25 Sep 2003 20:29:39 -0000	1.71
+++ csu/Makefile	30 Nov 2003 21:37:07 -0000
@@ -104,7 +104,7 @@ omit-deps += $(crtstuff)
 $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
 
-CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions
+CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
 
 vpath initfini.c $(full_config_sysdirs)
 
============================================================
Index: configure.in
--- configure.in	12 Nov 2003 00:37:03 -0000	1.404
+++ configure.in	30 Nov 2003 21:37:08 -0000
@@ -1359,6 +1359,7 @@ EOF
   AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
   cat > conftest.c <<EOF
 int foo;
+main () { return 0;}
 EOF
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
 			      -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
@@ -1371,6 +1372,36 @@ EOF
 
   AC_SUBST(libc_cv_fpie)
 fi
+
+if test $elf != yes; then
+  AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
+		 [AC_TRY_COMPILE(, [asm (".section .init");
+				    asm (".section .fini");
+				    asm ("${libc_cv_dot_text}");],
+				 libc_cv_have_initfini=yes,
+				 libc_cv_have_initfini=no)])
+  AC_SUBST(libc_cv_have_initfini)dnl
+  if test $libc_cv_have_initfini = yes; then
+    AC_DEFINE(HAVE_INITFINI)
+  fi
+fi
+
+AC_CACHE_CHECK(for -fno-unit-at-a-time, libc_cv_fno_unit_at_a_time, [dnl
+cat > conftest.c <<EOF
+int foo;
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-unit-at-a-time
+			    conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_fno_unit_at_a_time=yes
+else
+  libc_cv_fno_unit_at_a_time=no
+fi
+rm -f conftest*])
+if test $libc_cv_fno_unit_at_a_time = yes; then
+  fno_unit_at_a_time=-fno-unit-at-a-time
+fi
+AC_SUBST(fno_unit_at_a_time)
 
 if test $elf != yes; then
   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
============================================================
Index: config.make.in
--- config.make.in	12 Nov 2003 00:37:03 -0000	1.98
+++ config.make.in	30 Nov 2003 21:37:08 -0000
@@ -55,6 +55,7 @@ have-cpp-asm-debuginfo = @libc_cv_cpp_as
 enable-check-abi = @enable_check_abi@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
+fno-unit-at-a-time = @fno_unit_at_a_time@
 
 static-libgcc = @libc_cv_gcc_static_libgcc@
 
============================================================
Index: linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile
--- linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile	11 Apr 2003 23:34:02 -0000	1.5
+++ linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile	30 Nov 2003 21:37:08 -0000
@@ -1,3 +1,4 @@
 ifeq ($(subdir),linuxthreads)
-CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables
+CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions \
+		       -fno-asynchronous-unwind-tables $(fno-unit-at-a-time)
 endif
============================================================
Index: linuxthreads/Makefile
--- linuxthreads/Makefile	2 Oct 2003 18:48:48 -0000	1.83
+++ linuxthreads/Makefile	30 Nov 2003 21:37:08 -0000
@@ -101,7 +101,7 @@ endif
 extra-objs += $(crti-objs) $(crtn-objs)
 omit-deps += crti crtn
 
-CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions
+CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
 endif
 
 librt-tests = ex10 ex11
============================================================
Index: locale/Makefile
--- locale/Makefile	13 Jun 2003 20:42:48 -0000	1.71
+++ locale/Makefile	30 Nov 2003 21:37:08 -0000
@@ -100,6 +100,7 @@ locale-CPPFLAGS := -DLOCALE_PATH='$(loca
 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
 CFLAGS-charmap-dir.c = -Wno-write-strings
+CFLAGS-loadlocale.c = $(fno-unit-at-a-time)
 
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
============================================================
Index: nptl/Makefile
--- nptl/Makefile	21 Nov 2003 18:53:01 -0000	1.127
+++ nptl/Makefile	30 Nov 2003 21:37:08 -0000
@@ -312,7 +312,7 @@ endif
 extra-objs += $(crti-objs) $(crtn-objs)
 omit-deps += crti crtn
 
-CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions
+CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
 endif
 
 CFLAGS-flockfile.c = -D_IO_MTSAFE_IO
============================================================
Index: nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
--- nptl/sysdeps/unix/sysv/linux/x86_64/Makefile	9 May 2003 07:29:09 -0000	1.3
+++ nptl/sysdeps/unix/sysv/linux/x86_64/Makefile	30 Nov 2003 21:37:08 -0000
@@ -1,3 +1,4 @@
 ifeq ($(subdir),nptl)
-CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables
+CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions \
+		       -fno-asynchronous-unwind-tables $(fno-unit-at-a-time)
 endif

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


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