Cant cross compile gdb 7.2 _or_ 7.0.1 for a mipsel target board from a X86 PC.

harish badrinath
Thu Apr 28 14:41:00 GMT 2011

Hello, when i try to cross compile gdb for a mipsel architecture,
using the commands given below. I run into errors.

harish@super-micro:~/airspot-build/$ uname -a
Linux super-micro 2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16
15:22:42 UTC 2009 i686 GNU/Linux
harish@super-micro:~/airspot-build/$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:        9.10
Codename:       karmic

--target=mipsel-linux-uclibc --host=mipsel-linux

make fails with the following output

make[2]: Entering directory `/backed/harish/airspot-build/'
make[3]: Entering directory `/backed/harish/airspot-build/'
gcc ./../common/gentmap.c -o gentmap -g -O -I. -I. -I../common
-I./../common -I../../include -I./../..//include -I../../bfd
-I./../..//bfd -I../../opcodes -I./../..//opcodes -I../../intl
/usr/bin/ld: /backed/harish/airspot-build/toolchain/lib/../lib/crt1.o:
Relocations in generic ELF (EM: 8)
/backed/harish/airspot-build/toolchain/lib/../lib/crt1.o: could not
read symbols: File in wrong format
collect2: ld returned 1 exit status

After descending into /backed/harish/airspot-build/
And making the following changes
harish@super-micro:~/airspot-build/$ diff -u
Makefile.orig Makefile
--- Makefile.orig       2011-04-28 07:01:47.000000000 -0700
+++ Makefile    2011-04-28 07:04:46.000000000 -0700
@@ -40,7 +40,7 @@
 INSTALL_DATA = /usr/bin/install -c -m 644

 CC = /backed/harish/airspot-build/toolchain/bin/mipsel-linux-cc
+CC_FOR_BUILD = /backed/harish/airspot-build/toolchain/bin/mipsel-linux-cc
 CFLAGS = -g -O2
@@ -332,9 +332,9 @@
 targ-vals.h targ-map.c: stamp-tvals
 stamp-tvals: gentmap
        rm -f tmp-tvals.h tmp-tmap.c
-       ./gentmap -h >tmp-tvals.h
+       /backed/harish/airspot-build/toolchain/bin/mipsel-linux-readelf
./gentmap -h >tmp-tvals.h
        $(SHELL) $(srcroot)/move-if-change tmp-tvals.h targ-vals.h
-       ./gentmap -c >tmp-tmap.c
+       /backed/harish/airspot-build/toolchain/bin/mipsel-linux-readelf
./gentmap -c >tmp-tmap.c
        $(SHELL) $(srcroot)/move-if-change tmp-tmap.c targ-map.c
        touch stamp-tvals
harish@super-micro:~/airspot-build/$ diff -u
../common/callback.c.orig ../common/callback.c
--- ../common/callback.c.orig   2011-04-28 07:07:55.000000000 -0700
+++ ../common/callback.c        2011-04-28 07:08:24.000000000 -0700
@@ -59,6 +59,17 @@
 #define PIPE_BUF 512

+/*Copied from
+/* This one we treat specially, as it's used in the fcntl syscall.  */
+/* These we treat specially, as they're used in the fcntl F_GETFL
+   syscall.  For consistency, open_map is also manually edited to use
+   these macros.  */
+#define TARGET_O_RDONLY 0x0
+#define TARGET_O_WRONLY 0x1
+#define TARGET_O_RDWR 0x2
+#define TARGET_O_ACCMODE 0x3
 /* ??? sim_cb_printf should be cb_printf, but until the callback support is
    broken out of the simulator directory, these are here to not require
    sim-utils.h.  */

I am stuck with the following output, saying compilation failed with
the following output
with make done in dir "sim/mips"

backed/harish/airspot-build/toolchain/bin/mipsel-linux-cc -c
./../common/callback.c -DHAVE_CONFIG_H     -DPROFILE=1
-DWITH_SMP=0  -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat
-Wparentheses -Wpointer-arith -Wuninitialized
-DMIPS_MACH_DEFAULT=bfd_mach_mips8000   -I. -I. -I../common
-I./../common -I../../include -I./../..//include -I../../bfd
-I./../..//bfd -I../../opcodes -I./../..//opcodes -I../../intl -g -O2
In file included from ./../common/callback.c:50:
./targ-vals.h:1: error: parse error before "Header"
In file included from ./../common/callback.c:50:
./targ-vals.h:2:12: invalid suffix "f" on integer constant
./targ-vals.h:2:18: invalid suffix "c" on integer constant
./targ-vals.h:4: error: missing terminating ' character
make: *** [callback.o] Error 1
harish@super-micro:~/airspot-build/$ cat targ-vals.h
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x4005a0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          9692 (bytes into file)
  Flags:                             0x10001007, noreorder, pic, cpic,
o32, mips2
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         32
  Section header string table index: 29

Any pointers on moving forward ??, any help would be greatly appreciated.

Harish Badrinath

More information about the Gdb mailing list