gdb/249: cross-compilation fails at linking gcc's libs statically

peessdan@fh-albsig.de peessdan@fh-albsig.de
Thu Oct 18 18:34:00 GMT 2001


>Number:         249
>Category:       gdb
>Synopsis:       cross-compilation fails at linking gcc's libs statically
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 28 05:38:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     peessdan@fh-albsig.de
>Release:        5.1
>Organization:
>Environment:
GNU/Linux/x86 (Redhat 7.1);
a cross-environment of powerpc-405 platform placed in /opt/powerpc-linux
>Description:
cross-compilation fails at linking gcc's libs statically due to multiple definition of 're_max_failures'

no problems occur if linking libs dynamically,strange !?
>How-To-Repeat:
CC="powerpc-linux-gcc -I/opt/powerpc-linux/include -L/opt/powerpc-linux/lib" CFLAGS="-g -static" AR=powerpc-linux-ar RANLIB=powerpc-linux-ranlib ./configure --host=powerpc-linux --target=powerpc-linux --disable-sim && make

...
rm -f gdb
powerpc-linux-gcc -I/opt/powerpc-linux/include -L/opt/powerpc-linux/lib -g -static         -o gdb \
main.o libgdb.a cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o mi-out.o mi-console.o mi-cmds.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd-disas.o mi-main.o mi-parse.o mi-getopt.o    ../bfd/libbfd.a ../readline/libreadline.a ../opcodes/libopcodes.a  ../libiberty/libiberty.a -ltermcap     -lm  ../libiberty/libiberty.a \
-ldl -rdynamic
/opt/powerpc-linux/lib/libc.a(regex.o): In function `init_syntax_once':
/opt/powerpc-linux/usr/src/RPM/BUILD/glibc-2.1.3/posix/regex.c:253: multiple definition of `re_max_failures'
libgdb.a(gnu-regex.o):/opt/powerpc-linux/usr/src/RPM/BUILD/gdb-5.1-ppc/gdb/gnu-regex.c:164: first defined here
collect2: ld returned 1 exit status
make[1]: *** [gdb] Error 1
make[1]: Leaving directory `/opt/powerpc-linux/usr/src/RPM/BUILD/gdb-5.1-ppc'
make: *** [all-gdb] Error 2
>Fix:
i guess it's rather a workaround than a bugfix:

[enc@splash gdb-5.1-ppc]$ diff -Naur gdb/gnu-regex-orig.c gdb/gnu-regex.c 
--- gdb/gnu-regex-orig.c        Wed Nov 28 14:20:30 2001
+++ gdb/gnu-regex.c     Wed Nov 28 14:20:54 2001
@@ -1073,9 +1073,9 @@
 # if defined MATCH_MAY_ALLOCATE
 /* 4400 was enough to cause a crash on Alpha OSF/1,
    whose default stack limit is 2mb.  */
-long int re_max_failures = 4000;
+static long int re_max_failures = 4000;
 # else
-long int re_max_failures = 2000;
+static long int re_max_failures = 2000;
 # endif
 
 union fail_stack_elt
@@ -1098,9 +1098,9 @@
 # if defined MATCH_MAY_ALLOCATE
 /* 4400 was enough to cause a crash on Alpha OSF/1,
    whose default stack limit is 2mb.  */
-int re_max_failures = 20000;
+static int re_max_failures = 20000;
 # else
-int re_max_failures = 2000;
+static int re_max_failures = 2000;
 # endif
 
 union fail_stack_elt
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list