update from main archive
authordrepper <drepper>
Fri, 27 Sep 1996 03:19:49 +0000 (03:19 +0000)
committerdrepper <drepper>
Fri, 27 Sep 1996 03:19:49 +0000 (03:19 +0000)
FAQ
Makefile

diff --git a/FAQ b/FAQ
index b5789a4..5cf093e 100644 (file)
--- a/FAQ
+++ b/FAQ
@@ -55,6 +55,14 @@ please let me know.
          libc anymore?''
 
 [Q15]  ``What are these `add-ons'?''
+
+[Q16]  ``When I use GNU libc on my Linux system by linking against
+         to libc.so which comes with glibc all I get is a core dump.''
+
+[Q17]  ``Looking through the shared libc file I haven't found the
+         functions `stat', `lstat', `fstat', and `mknod' and while
+         linking on my Linux system I get error messages.  How is
+         this supposed to work?''
 \f
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 [Q1]   ``What systems does the GNU C Library run on?''
@@ -425,12 +433,119 @@ to use this feature.
 
 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+[Q16]  ``When I use GNU libc on my Linux system by linking against
+         to libc.so which comes with glibc all I get is a core dump.''
+
+[A16] {UD} It is not enough to simply link against the GNU libc
+library itself.  The GNU C library comes with its own dynamic linker
+which really conforms to the ELF API standard.  This dynamic linker
+must be used.
+
+Normally this is done by the compiler.  The gcc will use
+
+       -dynamic-linker /lib/ld-linux.so.1
+
+unless the user specifies her/himself a -dynamic-linker argument.  But
+this is not the correct name for the GNU dynamic linker.  The correct
+name is /lib/ld.so.1 which is the name specified in the SVr4 ABi.
+
+To change your environment to use GNU libc for compiling you need to
+change the `specs' file of your gcc.  This file is normally found at
+
+       /usr/lib/gcc-lib/<arch>/<version>/specs
+
+In this file you have to change a few things:
+
+- change `ld-linux.so.1' to `ld.so.1'
+
+- remove all expression `%{...:-lgmon}';  there is no libgmon in glibc
+
+
+Things are getting a bit more complicated if you have GNU libc
+installed in some other place than /usr, i.e., if you do not want to
+use it instead of the old libc.  In this case the needed startup files
+and libraries are not found in the regular places.  So the specs file
+must tell the compiler and linker exactly what to use.  Here is for
+example the gcc-2.7.2 specs file when GNU libc is installed at
+/home/gnu:
+
+-----------------------------------------------------------------------
+*asm:
+%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}
+
+*asm_final:
+%{pipe:-}
+
+*cpp:
+%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} -I/home/gnu/include
+
+*cc1:
+
+
+*cc1plus:
+
+
+*endfile:
+%{!shared:crtend.o%s} %{shared:crtendS.o%s} /home/gnu/lib/crtn.o%s
+
+*link:
+-m elf_i386 -rpath=/home/gnu/lib -L/home/gnu/lib %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static:  %{rdynamic:-export-dynamic}     %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld.so.1}}       %{static:-static}}}
+
+*lib:
+%{!shared: %{mieee-fp:-lieee} %{p:-lc_p} %{!p:%{pg:-lc_p} %{!pg:-lc}}}
+
+*libgcc:
+%{!shared:-lgcc}
+
+*startfile:
+%{!shared: %{pg:/home/gnu/lib/gcrt1.o%s} %{!pg:%{p:/home/gnu/lib/gcrt1.o} %{!p:/home/gnu/lib/crt1.o%s}}} /home/gnu/lib/crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
+
+*switches_need_spaces:
+
+
+*signed_char:
+%{funsigned-char:-D__CHAR_UNSIGNED__}
+
+*predefines:
+-D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
+
+*cross_compile:
+0
+
+*multilib:
+. ;
+
+-----------------------------------------------------------------------
+
+Future versions of GCC will automatically provide the correct specs.
+
+
+~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+[Q17]  ``Looking through the shared libc file I haven't found the
+         functions `stat', `lstat', `fstat', and `mknod' and while
+         linking on my Linux system I get error messages.  How is
+         this supposed to work?''
+
+[A17] {RM} Believe it or not, stat and lstat (and fstat, and mknod)
+are supposed to be undefined references in libc.so.6!  Your problem is
+probably a missing or incorrect /usr/lib/libc.so file; note that this
+is a small text file now, not a symlink to libc.so.6.  It should look
+something like this:
+
+GROUP ( libc.so.6 ld.so.1 libc.a )
+
+
+{UD} The Linux ldconfig file probably generates a link libc.so ->
+libc.so.6 in /lib.  This is not correct.  There must not be such a
+link.  The linker script with the above contents is placed in
+/usr/lib which is enough for the linker.
+
+
+~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 \f
 Answers were given by:
 {UD} Ulrich Drepper, <drepper@cygnus.com>
 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
-
-Amended by:
 {RM} Roland McGrath, <roland@gnu.ai.mit.edu>
 \f
 Local Variables:
index 791d788..87a66ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -115,34 +115,22 @@ ifeq (yes,$(build-shared))
 lib: $(common-objpfx)libc.so
 endif
 
-$(objpfx)sysd-dirs: $(+sysdir_pfx)config.make
-       (echo define sysdep-subdirs;                                          \
-        for sysdir in $(config-sysdirs); do                                  \
-          case $$sysdir in                                                   \
-            /*) dir=$$sysdir ;;                                              \
-            *)  dir=$(..)$$sysdir ;;                                         \
-          esac;                                                              \
-          if [ -r $$dir/Subdirs ]; then                                      \
-            sed 's/#.*$$//' $$dir/Subdirs;                                   \
-          else true;                                                         \
-          fi;                                                                \
-        done;                                                                \
+all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
+$(objpfx)sysd-dirs: $(+sysdir_pfx)config.make $(all-Subdirs-files)
+       (echo define sysdep-subdirs;                            \
+        sed 's/#.*$$//' $(all-Subdirs-files) /dev/null;        \
         echo endef) > $@-tmp
-        mv -f $@-tmp $@
+       mv -f $@-tmp $@
 \f
-$(objpfx)version-info.h: $(..)Makefile $(+sysdir_pfx)config.make
-       (first=yes;                                                           \
-        for dir in $(subdirs); do                                            \
-          if [ -r $$dir/Banner ]; then                                       \
-            if [ $$first = yes ]; then                                       \
-              echo "\"Available extensions:";                                \
-              first=no;                                                      \
-            fi;                                                              \
-            sed -e '/^#/d' -e 's/^[[:space:]]*/        /' $$dir/Banner;    \
-          fi;                                                                \
-        done;                                                                \
-        [ $$first = yes ] || echo "\"") > $@-tmp
-        mv -f $@-tmp $@
+all-Banner-files = $(wildcard $(addsuffix /Banner, $(subdirs)))
+$(objpfx)version-info.h: $(+sysdir_pfx)config.make $(all-Banner-files)
+       (files="$(all-Banner-files)";                           \
+        if [ test -n "$$files" ]; then                         \
+          echo "\"Available extensions:";                      \
+          sed -e '/^#/d' -e 's/^[[:space:]]*/  /' $$files;     \
+          echo "\"";                                           \
+        fi) > $@-tmp
+       mv -f $@-tmp $@
 
 version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))
 $(version.c-objects): $(objpfx)version-info.h