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]

Re: Support installing headers for bootstrapping libgcc


On Fri, 9 Mar 2012, Roland McGrath wrote:

> It's not clear to me exactly what all is wrong with install-headers today.

It doesn't install a sufficiently functional set of headers for 
bootstrapping.

> Can you clarify, i.e. enumerate the different problems?

* gnu/stubs.h is not installed (but all headers need it).

* bits/stdio_lim.h is not installed (but stdio.h needs it).

* bits/syscall.h is not installed (whether this is needed for 
bootstrapping - whether libgcc needs this header - may be 
target-dependent).

> Just making install-headers install a few more things like bits/syscall.h
> and bits/stdio_lim.h is fine.  Off hand I don't really recall why those
> can't just be in headers (sysdep_headers) and have their own special rules.
> 
> For bits/stdio_lim.h it looks like maybe its just that Makerules doesn't
> have a pattern rule for a header in $(common-objpfx).  Maybe just add that?
> 
> For bits/syscall.h we have this move-if-change logic.  I don't see why we
> need that at all, though surely I've forgotten something.  What bad would
> happen if we just put it in sysdep_headers and made $(objpfx)bits/syscall.h
> rather than $(objpfx)syscall-list.h be the target of the generation rule?

Yes, installing them from install-headers does seem better if there's no 
definite reason why install-headers should not install them 
unconditionally.  I've tested (on x86_64) the following patch to do this.

> For gnu/stubs.h I don't like this approach at all.  Maybe it just can be
> dealt with on the libgcc side?  i.e., libgcc can have a private dummy
> gnu/stubs.h used just for its own building, and use -I/-isystem to ensure
> it's found.

As noted I think glibc is the right place to fix this - the point is to 
provide a well-defined interface to install a working set of headers, 
sufficient for bootstrapping (but hopefully as complete as possible), 
without building the library itself.

> For sunrpc, the issue is just that the headers are generated by compiling
> rpcgen and thus everything else so as to run it, right?  What would happen
> if you just instead declared the bootstrap case to be an instance of
> cross-compiling, so the existing logic (or fixes to it) for the general
> case of "can't run generator programs" applies?

I've confirmed that it is possible to build these headers, without 
building the whole library, using fairly small changes to build rpcgen for 
the build system separately from the rpcgen built with the newly build 
library - so they don't need disabling after all.  I'll send cross-rpcgen 
patches separately.

2012-03-09  Joseph Myers  <joseph@codesourcery.com>

	* Makerules ($(inst_includedir)/%.h): New rule.
	* stdio-common/Makefile (headers): Add bits/stdio_lim.h.
	(install-others): Remove variable setting.
	($(inst_includedir)/bits/stdio_lim.h): Remove rule.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
	bits/syscall.h.
	($(objpfx)syscall-%.h): Rename rule to $(objpfx)bits/syscall.h.
	($(objpfx)syscall-%.d): Rename rule to $(objpfx)bits/syscall.d.
	($(inst_includedir)/bits/syscall.h): Remove rule.
	($(objpfx)bits/syscall.d): Include instead of
	$(objpfx)syscall-list.d.
	(generated): Change syscall-list.h and syscall-list.d to
	bits/syscall.h and bits/syscall.d.

diff --git a/Makerules b/Makerules
index 7d18f89..f1807c2 100644
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -1068,6 +1068,8 @@ ifdef headers
 # headers in the sysdeps tree.
 $(inst_includedir)/%.h: $(objpfx)%.h $(+force)
 	$(do-install)
+$(inst_includedir)/%.h: $(common-objpfx)%.h $(+force)
+	$(do-install)
 $(inst_includedir)/%.h: %.h $(+force)
 	$(do-install)
 $(inst_includedir)/%.h: $(..)include/%.h $(+force)
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 266147e..8cf6335 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -20,7 +20,7 @@
 #
 subdir	:= stdio-common
 
-headers	:= stdio_ext.h printf.h bits/printf-ldbl.h
+headers	:= stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
 
 routines	:=							      \
 	ctermid cuserid							      \
@@ -39,8 +39,6 @@ routines	:=							      \
 	isoc99_vsscanf							      \
 	psiginfo
 
-install-others = $(inst_includedir)/bits/stdio_lim.h
-
 include ../Makeconfig
 
 aux	:= errlist siglist printf-parsemb printf-parsewc fxprintf
@@ -64,9 +62,6 @@ test-srcs = tst-unbputc tst-printf
 
 include ../Rules
 
-$(inst_includedir)/bits/stdio_lim.h: $(common-objpfx)bits/stdio_lim.h $(+force)
-	$(do-install)
-
 ifeq ($(cross-compiling),no)
 .PHONY: do-tst-unbputc do-tst-printf
 tests: do-tst-unbputc do-tst-printf
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 458658d..03d0523 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -33,9 +33,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
 		  sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
 		  bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
 		  sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
-		  bits/signalfd.h bits/timerfd.h bits/epoll.h
-
-install-others += $(inst_includedir)/bits/syscall.h
+		  bits/signalfd.h bits/timerfd.h bits/epoll.h bits/syscall.h
 
 tests += tst-clone
 
@@ -61,7 +59,7 @@ ifndef syscall-list-includes
 syscall-list-includes := bits/wordsize.h
 endif
 
-$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
+$(objpfx)bits/syscall.h $(objpfx)bits/syscall.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
 	$(make-target-directory)
 	{ \
 	 echo '/* Generated at libc build time from kernel syscall list.  */';\
@@ -96,17 +94,11 @@ endif
 	rm -f $(foreach v,$(syscall-list-variants),$(@:.h=.d)-t$(v))
 	mv -f $(@:.h=.d)-t3 $(@:.h=.d)
 
-$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
-	$(make-target-directory)
-	if test -r $@ && cmp -s $< $@; \
-	then echo 'bits/syscall.h unchanged'; \
-	else $(INSTALL_DATA) $< $@; fi
-
 ifndef no_deps
 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
--include $(objpfx)syscall-list.d
+-include $(objpfx)bits/syscall.d
 endif
-generated += syscall-list.h syscall-list.d
+generated += bits/syscall.h bits/syscall.d
 endif
 
 ifeq ($(subdir),time)

-- 
Joseph S. Myers
joseph@codesourcery.com


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