[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#202927: gcc-3.3: Link order on Sparc: system directories vs specified directories



Ben, I think, this is the same as #202924, introduced by the
sparc64-build patch. Is there a reason that  -Y P,/usr/lib is replaced
with -L/usr/lib ?

--- sparc64-build.gcc-3.3.tmp/src/gcc/config/sparc/linux64.h	2003-03-13 08:40:33.000000000 +0000
+++ sparc64-build.gcc-3.3/src/gcc/config/sparc/linux64.h	2003-03-13 08:46:18.000000000 +0000
@@ -37,8 +37,8 @@
    + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
 #endif
 
-#undef ASM_CPU_DEFAULT_SPEC
-#define ASM_CPU_DEFAULT_SPEC "-Av9a"
+#undef ASM_CPU64_DEFAULT_SPEC
+#define ASM_CPU64_DEFAULT_SPEC "-Av9a"
 
 #ifdef SPARC_BI_ARCH
 
@@ -153,7 +153,7 @@
   { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },	  \
   { "link_arch",	 LINK_ARCH_SPEC },
     
-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+#define LINK_ARCH32_SPEC "-m elf32_sparc -L/usr/lib %{shared:-shared} \
   %{!shared: \
     %{!ibcs: \
       %{!static: \
@@ -162,7 +162,7 @@
         %{static:-static}}} \
 "
 
-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_ARCH64_SPEC "-m elf64_sparc -L/usr/lib64 %{shared:-shared} \
   %{!shared: \
     %{!ibcs: \
       %{!static: \
@@ -222,7 +222,7 @@
 #else /* !SPARC_BI_ARCH */
 
 #undef LINK_SPEC
-#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_SPEC "-m elf64_sparc -L/usr/lib64 %{shared:-shared} \
   %{!shared: \
     %{!ibcs: \
       %{!static: \


Aurelien Jarno writes:
> Package: gcc-3.3
> Version: 1:3.3.1-0pre0
> Severity: normal
> 
> Hello,
> 
> I remarked a problem with gcc on Sparc which concerns the linking order
> of libraries. I have done a simple test to show that:
> 
> First foo.c:
> <--->
> void foo()
> {
> }
> 
> <--->
> 
> Second file, main.c:
> <--->
> int main()
> {
>   foo();
>   return 0;
> }
> 
> <--->
> 
> Then the commands:
>  gcc -c -o foo.o foo.c
>  ar -rcu libutil.a foo.o
>  ranlib libutil.a
>  gcc -c -o main.o main.c
> 
> Until there everything works on all architectures.
> 
> But when linking, I get the following on Sparc:
>  gcc -o main main.o -L. -lutil
> 
>  main.o(.text+0x4): In function `main':
>  : undefined reference to `foo'
>  collect2: ld returned 1 exit status
> 
> It seems that the library /usr/lib/libutil.a is used instead of the
> libutil.a in the current directory. AFAIK, the problem appears only on 
> Sparc (among Debian supported architectures), and moreover only with 
> gcc-3.2 and gcc-3.3 (it works well with gcc-2.95).
> 
> Aurelien
> 
> 
> -- System Information:
> Debian Release: testing/unstable
> Architecture: sparc
> Kernel: Linux vore 2.4.21-rc2 #1 Fri May 16 09:03:19 EDT 2003 sparc64
> Locale: LANG=C, LC_CTYPE=C
> 
> Versions of packages gcc-3.3 depends on:
> ii  binutils                 2.14.90.0.4-0.1 The GNU assembler, linker and bina
> ii  cpp-3.3                  1:3.3.1-0pre0   The GNU C preprocessor
> ii  gcc-3.3-base             1:3.3.1-0pre0   The GNU Compiler Collection (base 
> ii  libc6                    2.3.2-1         GNU C Library: Shared libraries an
> ii  libgcc1                  1:3.3.1-0pre0   GCC support library
> 
> -- no debconf information
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: