Really support rpath only linking. Add a special option -nolibc which
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Wed, 3 Aug 2005 03:12:00 +0000 (03:12 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Wed, 3 Aug 2005 03:12:00 +0000 (03:12 +0000)
doesn't link a shared object against libc.

gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h
gnu/usr.bin/cc34/cc_prep/patches/gcc.c.patch
lib/libc/Makefile

index 6661113..0324388 100644 (file)
@@ -1,4 +1,4 @@
-/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.9 2005/07/30 17:10:24 joerg Exp $ */
+/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.10 2005/08/03 03:12:00 joerg Exp $ */
 
 /* Base configuration file for all DragonFly targets.
    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -119,27 +119,44 @@ Boston, MA 02111-1307, USA.  */
    (simular to the default, except no -lg, and no -p).  */
 
 #ifdef DFBSD_NO_THREADS
-#define DFBSD_LIB_SPEC "                                                       \
+#define DFBSD_LIB_SPEC "                                               \
   %{pthread: %eThe -pthread option is only supported on DragonFly when gcc \
 is built with the --enable-threads configure-time option.}             \
-  %{pg: -L/usr/lib/profiling}                                          \
-  %{g: -L/usr/lib/debug}                                               \
-  %{!shared: -lc}                                                      \
+  %{!nostdlib{!nostartfiles{!nolibc: -lc}}}                            \
   }"
 #else
 #define DFBSD_LIB_SPEC "                                               \
-  %{pg: -L/usr/lib/profiling}                                          \
-  %{g: -L/usr/lib/debug}                                               \
-  %{!shared: %{pthread:-lc_r} -lc}                                     \
+  %{!shared: %{pthread:-lc_r}}                                                 \
+  %{!nostdlib: %{!nostartfiles: %{!nolibc: -lc}}}                      \
   "
 #endif
 
+#define LINK_LIBGCC_SPEC ""
+
+#define PRE_LIB_SPEC "                                                 \
+  %{pg: -L"PREFIX2"/lib/gcc34/profiling                                \
+    %{!static: -rpath /usr/lib/gcc34/profiling                                 \
+      -rpath-link "PREFIX2"/lib/gcc34/profiling}}                      \
+  %{g: -L"PREFIX2"/lib/gcc34/debug                                     \
+    %{!static: -rpath /usr/lib/gcc34/debug                             \
+      -rpath-link "PREFIX2"/lib/gcc34/debug}}                          \
+  -L"PREFIX2"/lib/gcc34                                                        \
+  %{!static: -rpath /usr/lib/gcc34  -rpath-link "PREFIX2"/lib/gcc34}   \
+  %{pg: -L"PREFIX2"/lib/profiling                                      \
+    %{!static: -rpath /usr/lib/profiling                               \
+      -rpath-link "PREFIX2"/lib/profiling}}                            \
+  %{g: -L"PREFIX2"/lib/debug                                           \
+    %{!static: -rpath /usr/lib/debug -rpath-link "PREFIX2"/lib/debug}}         \
+  %{!static: -rpath /usr/lib -rpath-link "PREFIX2"/lib}                \
+  "
+
 #define DFBSD_LINK_COMMAND_SPEC "\
 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
     %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
     %{static:} %{L*} %(link_libgcc) %o \
     %{fprofile-arcs|fprofile-generate: -lgcov}\
+    %{!nostdlib:%{!nodefaultlibs:%(pre_lib)}}\
     %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
     %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
 
index 615cd1f..6b34db0 100644 (file)
@@ -1,4 +1,4 @@
-$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/gcc.c.patch,v 1.3 2005/08/02 21:15:12 joerg Exp $
+$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/gcc.c.patch,v 1.4 2005/08/03 03:12:00 joerg Exp $
 
 Index: gcc.c
 ===================================================================
@@ -6,8 +6,16 @@ RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/gcc.c,v
 retrieving revision 1.3
 diff -u -r1.3 gcc.c
 --- gcc.c      24 May 2005 06:29:31 -0000      1.3
-+++ gcc.c      2 Aug 2005 19:22:59 -0000
-@@ -1409,8 +1409,7 @@
++++ gcc.c      2 Aug 2005 22:25:59 -0000
+@@ -712,6 +712,7 @@
+ static const char *asm_spec = ASM_SPEC;
+ static const char *asm_final_spec = ASM_FINAL_SPEC;
+ static const char *link_spec = LINK_SPEC;
++static const char *pre_lib_spec = PRE_LIB_SPEC;
+ static const char *lib_spec = LIB_SPEC;
+ static const char *libgcc_spec = LIBGCC_SPEC;
+ static const char *endfile_spec = ENDFILE_SPEC;
+@@ -1409,8 +1410,7 @@
  static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
  static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
  static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
@@ -17,7 +25,15 @@ diff -u -r1.3 gcc.c
  
  static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
  static const char *tooldir_prefix;
-@@ -3219,8 +3218,6 @@
+@@ -1470,6 +1470,7 @@
+   INIT_STATIC_SPEC ("link_gcc_c_sequence",    &link_gcc_c_sequence_spec),
+   INIT_STATIC_SPEC ("endfile",                        &endfile_spec),
+   INIT_STATIC_SPEC ("link",                   &link_spec),
++  INIT_STATIC_SPEC ("pre_lib",                        &pre_lib_spec),
+   INIT_STATIC_SPEC ("lib",                    &lib_spec),
+   INIT_STATIC_SPEC ("libgcc",                 &libgcc_spec),
+   INIT_STATIC_SPEC ("startfile",              &startfile_spec),
+@@ -3219,8 +3220,6 @@
        set_std_prefix (gcc_exec_prefix, len);
        add_prefix (&exec_prefixes, gcc_libexec_prefix, "GCC",
                  PREFIX_PRIORITY_LAST, 0, NULL, 0);
@@ -26,7 +42,7 @@ diff -u -r1.3 gcc.c
      }
  
    /* COMPILER_PATH and LIBRARY_PATH have values
-@@ -3768,11 +3765,6 @@
+@@ -3768,11 +3767,6 @@
              PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0);
  #endif
  
@@ -38,7 +54,7 @@ diff -u -r1.3 gcc.c
    tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
                           dir_separator_str, NULL);
  
-@@ -3795,10 +3787,6 @@
+@@ -3795,10 +3789,6 @@
                      concat (gcc_exec_tooldir_prefix, "bin",
                              dir_separator_str, NULL),
                      NULL, PREFIX_PRIORITY_LAST, 0, NULL, 0);
@@ -49,7 +65,7 @@ diff -u -r1.3 gcc.c
        }
  
        tooldir_prefix = concat (standard_exec_prefix, spec_machine,
-@@ -3806,13 +3794,6 @@
+@@ -3806,13 +3796,6 @@
                               dir_separator_str, tooldir_prefix, NULL);
      }
  
@@ -63,7 +79,7 @@ diff -u -r1.3 gcc.c
  #if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS)
    /* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix,
       then consider it to relocate with the rest of the GCC installation
-@@ -6037,11 +6018,6 @@
+@@ -6037,11 +6020,6 @@
    n_compilers = n_default_compilers;
  
    /* Read specs from a file if there is one.  */
@@ -75,7 +91,7 @@ diff -u -r1.3 gcc.c
    specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, 0);
    /* Read the specs file unless it is a default one.  */
    if (specs_file != 0 && strcmp (specs_file, "specs"))
-@@ -6051,11 +6027,9 @@
+@@ -6051,11 +6029,9 @@
  
    /* We need to check standard_exec_prefix/just_machine_suffix/specs
       for any override of as, ld and libraries.  */
@@ -88,7 +104,7 @@ diff -u -r1.3 gcc.c
    strcat (specs_file, "specs");
    if (access (specs_file, R_OK) == 0)
      read_specs (specs_file, TRUE);
-@@ -6129,35 +6103,10 @@
+@@ -6129,35 +6105,10 @@
        add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix_1,
                              "GCC", PREFIX_PRIORITY_LAST, 0, NULL, 1);
  
@@ -128,7 +144,7 @@ diff -u -r1.3 gcc.c
  #if 0 /* Can cause surprises, and one can use -B./ instead.  */
        add_prefix (&startfile_prefixes, "./", NULL,
                  PREFIX_PRIORITY_LAST, 1, NULL, 0);
-@@ -6197,7 +6146,7 @@
+@@ -6197,7 +6148,7 @@
  
    if (print_search_dirs)
      {
index 1cfa1cf..099ac15 100644 (file)
@@ -1,6 +1,6 @@
 #      @(#)Makefile    8.2 (Berkeley) 2/3/94
 # $FreeBSD: src/lib/libc/Makefile,v 1.24 1999/09/29 15:18:29 marcel Exp $
-# $DragonFly: src/lib/libc/Makefile,v 1.12 2005/08/02 13:03:54 joerg Exp $
+# $DragonFly: src/lib/libc/Makefile,v 1.13 2005/08/03 03:12:00 joerg Exp $
 #
 # All library objects contain rcsid strings by default; they may be
 # excluded as a space-saving measure.  To produce a library that does
@@ -13,6 +13,7 @@ CFLAGS+=-DLIBC_RCS -DSYSLIBC_RCS -I${.CURDIR}/include
 AINC=  -I${.CURDIR}/${MACHINE_ARCH}
 CLEANFILES+=tags
 PRECIOUSLIB=   yes
+LDADD= -nolibc
 
 #
 # Include make rules that are shared with libc_r.