Cant cross compile gdb 7.2 _or_ 7.0.1 for a mipsel target board from a X86 PC.
harish badrinath
harishbadrinath@gmail.com
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.
<buildHostInfo>
harish@super-micro:~/airspot-build/gdb-7.2.new$ 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/gdb-7.2.new$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.10
Release: 9.10
Codename: karmic
</buildHostInfo>
<commandsRun>
harish@super-micro:export
INCLUDE_PATH=/backed/harish/airspot-build/toolchain/include
harish@super-micro:export
LIBRARY_PATH=/backed/harish/airspot-build/toolchain/lib
harish@super-micro:export
CC=/backed/harish/airspot-build/toolchain/bin/mipsel-linux-cc
harish@super-micro:export
AR=/backed/harish/airspot-build/toolchain/bin/mipsel-linux-ar
harish@super-micro:export
AS=/backed/harish/airspot-build/toolchain/bin/mipsel-linux-as
harish@super-micro:export
LD=/backed/harish/airspot-build/toolchain/bin/mipsel-linux-ld
harish@super-micro:./configure
--includedir=/backed/harish/airspot-build/toolchain/include/
--libdir=/backed/harish/airspot-build/toolchain/lib/
--bindir=/backed/harish/airspot-build/toolchain/bin/
--target=mipsel-linux-uclibc --host=mipsel-linux
--target=mipsel-linux-uclibc
harish@super-micro:make
</commandsRun>
make fails with the following output
<makeOutput>
--SNIP--
make[2]: Entering directory `/backed/harish/airspot-build/gdb-7.2.new/sim'
make[3]: Entering directory `/backed/harish/airspot-build/gdb-7.2.new/sim/mips'
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
<makeOutput>
After descending into /backed/harish/airspot-build/gdb-7.2.new/sim/mips
And making the following changes
<diff1>
harish@super-micro:~/airspot-build/gdb-7.2.new/sim/mips$ 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 = gcc
+CC_FOR_BUILD = /backed/harish/airspot-build/toolchain/bin/mipsel-linux-cc
CFLAGS = -g -O2
SIM_BSWAP =
SIM_CFLAGS =
@@ -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
</diff1>
<diff2>
harish@super-micro:~/airspot-build/gdb-7.2.new/sim/mips$ 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
#endif
+/*Copied from http://sourceware.org/cgi-bin/cvsweb.cgi/src/sim/cris/traps.c.diff?cvsroot=src&r1=1.5&r2=1.6
*/
+/* 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. */
</diff2>
I am stuck with the following output, saying compilation failed with
the following output
with make done in dir "sim/mips"
</output>
backed/harish/airspot-build/toolchain/bin/mipsel-linux-cc -c
./../common/callback.c -DHAVE_CONFIG_H -DPROFILE=1
-DWITH_PROFILE=-1 -DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT
-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
-DWITH_DEFAULT_TARGET_BYTE_ORDER=BIG_ENDIAN
-DWITH_FLOATING_POINT=HARD_FLOATING_POINT
-DWITH_TARGET_FLOATING_POINT_BITSIZE=32 -DWITH_HW=0
-DWITH_HOST_BYTE_ORDER=0 -DDEFAULT_INLINE=0 -DWITH_RESERVED_BITS=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/gdb-7.2.new/sim/mips$ 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
</output>
Any pointers on moving forward ??, any help would be greatly appreciated.
Regards,
Harish Badrinath
More information about the Gdb
mailing list