Cross gcc Mailing List Archive

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

A few questions about building a canadian cross



Hello

I'm trying to build a i386-go32 x m68k-coff cross-compiler using the
instructions laid down in the cross-gcc FAQ for carrying out a Canadian
cross on UNIX. That is:
--build=sparc-sun-solaris2.5
--host=i386-go32
--target=m68k-coff

I need the executables to run on an mvme101 68000 single board computer
running mvmebug 2.0. I'm using binutils 2.7, gcc 2.7.2 and newlib 1.7.0
as sources configured using the one-tree shell script and with the
cygnus crossgcc patch applied.

I built the cross-compiler as per the instructions in crossgcc FAQ, then
used dosrel-1.0 to convert the cross-compiler from a UNIX directory tree
to a DOS directory tree.  I modified the support routines for the
mvme135 in libgloss to provide a working crt0.o, mvme101.o and
mvme101.ld which map the compiler to the machine i'm running on.  

1) Problem #1 : Incorrect initialization of __CTOR_LIST__ 

I wrote and compiled a small "Hello, World" program (using printf) with:
gcc -o hello -T mvme101.ld -m68000 hello.c
objcopy --target=srec hello hello.x

This downloads OK and executes OK. 

I then tried a C++ program using very simple class definitions - no
calls to iostream or anything, and the program bombs out. I managed to
trace the problem to the constructor table __CTOR_LIST__ and found that
neither the constructor nor destructor tables had valid pointers in
them. The tables are supposed to be of the form:

[#num words]<-__CTOR_LIST__
[  ptr 1   ] 
[  ptr 2   ]
[   ...    ]
[0000000000]<-__CTOR_END__

where each pointer is the address of a constructor. According to
gcc.info, because the coff format supports the section names .ctors and
.dtors, the compiler inserts its own addresses into the object file
.ctors and .dtors sections, and these are then gathered together by ld
into one large table. There are directives in mvme101.ld to do this -
the same directives as used in mvme135.ld, which I copied.   

This is where I run out of gas. Has anyone had a similar problem with
constructor and destructor tables not being initialized correctly?
Somehow I can't believe that the problem is that compilcated - there
must be something wrong at the level of configuration files being pulled
in...

2) Problem #2 : Changing the default target 

Another problem with the configuration I am having is setting the
default target correctly. The default build for the m68k is -m68020
-m68881. I just want to be able to code:
 
gcc -o hello -T mvme101.ld hello.c    

to run the compiler. I went into the configuration files which are
getting pulled in 

m68k/m68k-coff.h
m68k/m68k-none.h
m68k/m68kemb.h
m68k/coff.h
and 
m68k/m68k.h

and found the blurb on setting the macro DEFAULT_TARGET. In m68k-none.h,
I changed the value to 
#define DEFAULT_TARGET -01405 
which appeared to be the correct value for -m68000 only, but still got a
default of -msoft-float when the cross compiler finally built.

Does anyone know how to set this correctly? It seems to be tied in with
the CPP_SPEC macro, which relates to my next question.

3) Reading specs strings

Finally, could anyone point me to some documentation on how to read (and
eventually set) the specs strings?     
 

Any assistance appreciated...

Richard
-- 
Richard Achmatowicz			Internet: Richard.Achmatowicz@ncl.ac.uk
Dept. of Computing Science		Telephone: +44 191-222 7856
University Of Newcastle			Fax: +44 191-222 8232

Claremont Tower
Newcastle-Upon-Tyne NE1 7RU
United Kingdom


Home | Subject Index | Thread Index