This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC as crosscompiler for LynxOS


Hi, 

I'm trying to build GCC 4 for the LynxOS. The native compiler didn't
work so I'm trying for the crosscompiling route.

I build the binutils 2.15 as:

../binutils-2.15/configure --prefix=/usr/local
--target=i386-lynx-lynxos --disable-nls

and I have built GCC 4.0.1 with this patch reverted to enable coff
target as default for lynxos:

http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00501.html

with this flags:

$ ../gcc-4.0.1/configure --prefix=/usr/local --target=i386-lynx-lynxos
--disable-nls --with-gnu-as --with-gnu-ld --with-headers

the headers and libs of the system are under /usr/local/i386-lynx-lynxos

The binutils were build fine, and the gcc stops on building
libstdc++-v3 (so, I tought that the c compiler was build fine and ran
make install to see what happens).

Then, If I run:

gcc -V 4.0.1 -b i386-lynx-lynxos hello.c -o hello

The system says about unresolved symbols:
/cygdrive/c/DOCUME~1/rcabral/LOCALS~1/Temp/ccrW7xqg.o(.text+0x7):hello.c:
multiple definition of `_main'
/usr/local/lib/gcc/i386-lynx-lynxos/4.0.1/../../../../i386-lynx-lynxos/lib/init1.o(.text+0x0):.file:
first defined here
/cygdrive/c/DOCUME~1/rcabral/LOCALS~1/Temp/ccrW7xqg.o(.text+0x31):hello.c:
undefined reference to `_puts'
/usr/local/lib/gcc/i386-lynx-lynxos/4.0.1/../../../../i386-lynx-lynxos/lib/libc.
a(runmainthread.s)(.text+0x29):runmainthread.s: undefined reference to `main'
collect2: ld returned 1 exit status

So, I checked with nm about the symbols on the libc of the LynxOS and
they exists in there but without the "_" appended. So, I generate an
object file (".o"). And then I changed the symbols of the object file
with objcopy to the same name but without the "_" like this:

i386-lynx-lynxos-objcopy --redefine-sym _main=main --redefine-sym
_puts=puts hello.o hello2.o

After that, I ran:

gcc -V 4.0.1 -b i386-lynx-lynxos hello2.o -o hello

And it links without errors. Then I copy the executable file to the
LynxOS machine and it did work fine (It printed "hello").

So, after all this, my question is: What should I do to tell to GCC to
not append "_" on the symbols? Did I build GCC or binutils the wrong
way?

I'm using cygwin as the host.

Any help is appreciated,

Thanks in advance, (and sorry for my bad English)
-- 
-----------------------------------------------
Roberto Cabral
Correo: roberto.cabral( at )gmail.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]