public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to generate the LIBGCC.A for mc68000
@ 2004-12-15 17:58 Pascal Chaperon
  2004-12-15 18:31 ` Peter Barada
  2004-12-15 18:43 ` Ian Lance Taylor
  0 siblings, 2 replies; 10+ messages in thread
From: Pascal Chaperon @ 2004-12-15 17:58 UTC (permalink / raw)
  To: gcc

Hello,

I am using gcc-3.1 and I try to generate a cross-compiler version for
mc68000 on a Pentium II under Linux.

I had installed the binutils-2.15 and I had successfully configured and
compiled gcc-3.1 sources with the following arguments :

gcc-3.1/configure \
--prefix=/home/cross-compiler/m68k \
--target=m68k-linux \
--enable-languages=c \
--nofp


After some manuel patches ( compilation of crti.s and crtn.s and remove
of -lc line in the Makefile ),
The result is a full gcc compiler tools in /home/cross-compiler/m68k
including the libgcc.a library.

The trouble is, when I try to use this compiler with option -m68000 to
compile my Linux kernel ( witch has been modified to support the m68k
architecture without MMU), the compiler generate some implicit calls to
simulate
arithmetics operations ( witch are not supported by the mc68000 ).
And those functions are not included in the libgcc.a as they are supposed to
be ( I found this information on a forum).

What did I do that was not correct or did I miss in installing my GCC
compiler ?

Here is the list of unreferenced functions :
__udivsi3
__umodsi3
__divsi3
__modsi3
__mulsi3


Thank you for your answer.

Pascal Chaperon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-15 17:58 How to generate the LIBGCC.A for mc68000 Pascal Chaperon
@ 2004-12-15 18:31 ` Peter Barada
  2004-12-15 18:43 ` Ian Lance Taylor
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Barada @ 2004-12-15 18:31 UTC (permalink / raw)
  To: pascal.chaperon; +Cc: gcc


>After some manuel patches ( compilation of crti.s and crtn.s and remove
>of -lc line in the Makefile ),
>The result is a full gcc compiler tools in /home/cross-compiler/m68k
>including the libgcc.a library.
>
>The trouble is, when I try to use this compiler with option -m68000 to
>compile my Linux kernel ( witch has been modified to support the m68k
>architecture without MMU), the compiler generate some implicit calls to
>simulate
>arithmetics operations ( witch are not supported by the mc68000 ).
>And those functions are not included in the libgcc.a as they are supposed to
>be ( I found this information on a forum).

Hmm.  Unless your patches were more intrusive than just crti/crtn
stuff, then gcc when asked to link your code should include -lgcc to
the linker.  Check in the kernel build if it uses ld to linke and does
it specify -lgcc to link in libgcc.a.

Your probably want to take these type of cross-gcc creation/use
questions over to the crossgcc mailing list where people build and use
gcc as a cross-compiler all the time.... See
http://sources.redhat.com/lists.html for mre info on how to
subscribe. 

-- 
Peter Barada
peter@the-baradas.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-15 17:58 How to generate the LIBGCC.A for mc68000 Pascal Chaperon
  2004-12-15 18:31 ` Peter Barada
@ 2004-12-15 18:43 ` Ian Lance Taylor
  2004-12-15 19:12   ` Peter Barada
       [not found]   ` <00e001c4e37b$857b9d50$1700a8c0@PASCAL>
  1 sibling, 2 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2004-12-15 18:43 UTC (permalink / raw)
  To: Pascal Chaperon; +Cc: gcc

"Pascal Chaperon" <pascal.chaperon@prescom.fr> writes:

> The trouble is, when I try to use this compiler with option -m68000 to
> compile my Linux kernel ( witch has been modified to support the m68k
> architecture without MMU), the compiler generate some implicit calls to
> simulate
> arithmetics operations ( witch are not supported by the mc68000 ).
> And those functions are not included in the libgcc.a as they are supposed to
> be ( I found this information on a forum).
> 
> What did I do that was not correct or did I miss in installing my GCC
> compiler ?
> 
> Here is the list of unreferenced functions :
> __udivsi3
> __umodsi3
> __divsi3
> __modsi3
> __mulsi3

I don't know why it didn't work for you, but I can tell you what you
need.

Versions of these functions may be found in the file lb1sf68.asm in
the directory gcc/config/m68k.  To get the compiler to compile them
for you, you need to use a t-XXX file along the lines of t-m68kelf.
The relevant variables here are LIB1ASMSRC and LIB1ASMFUNCS.  For
floating point support you will want the LIB2FUNCS_EXTRA variable and
the fpgnulib.c and xfgnulib.c targets.

Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-15 18:43 ` Ian Lance Taylor
@ 2004-12-15 19:12   ` Peter Barada
       [not found]   ` <00e001c4e37b$857b9d50$1700a8c0@PASCAL>
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Barada @ 2004-12-15 19:12 UTC (permalink / raw)
  To: ian; +Cc: pascal.chaperon, gcc


>> Here is the list of unreferenced functions :
>> __udivsi3
>> __umodsi3
>> __divsi3
>> __modsi3
>> __mulsi3
>
>I don't know why it didn't work for you, but I can tell you what you
>need.

He build a --target=m68k-linux configured compiler which is configured
for a 68k that has an MMU (m68020+), so it doesn't supply a libgcc.a
that has those functions since the chip has direct support for those
instruction patterns.

What he really wants is a --target=m68k-uclinux compiler.

I've pointed him at the uClinux website where he might find everything
he needs tput together a working system....

-- 
Peter Barada
peter@the-baradas.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
       [not found]     ` <m38y7y6yxb.fsf@gossamer.airs.com>
@ 2004-12-16 16:29       ` Pascal Chaperon
  2004-12-16 16:45         ` Ian Lance Taylor
  2004-12-16 17:16         ` Peter Barada
  0 siblings, 2 replies; 10+ messages in thread
From: Pascal Chaperon @ 2004-12-16 16:29 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

Well,

I had understood that my compiler has been generated for 68020 family.
So I re-compiled all the sources (including the binutils) with the following
option :
--target=m68k-coff
I also create a t-coff file by copying and renaming the t-m68kelf.
( I think it was not good, according to you e-mail the name should has been
t-m68kcoff ).
In any case the result is a compiler installed in a new directory created
for it
../cross-compiler/m68k-coff
All the binaries are well installed and now the libgcc.a contains all the
arithmetics functions
I need for a mc68000 compilation ( including mulsi3 and friends ).

So it seems to be better isn't ?  :-)

I made a test for my compiler :

vi test.c
-->

int main( int argc, char **argv)
{
    return 0;
}

and I tried to compile this file :

m68k-coff-gcc test.c

I have got an error in the linker :
it is deplayed in french but in english it should be somethink like that :

../m68k-coff/bin/ld: unable to find -lc
collect2: ld has returned 1 error code

Note that I had exactly the same error while compiling GCC and I found a
workaround by manualy edit the
Makefile in gcc directory :
SHLIB_LC = -lc

replaced by
SHLIB_LC =

How about this issue ?

I think it is the last one !

Best regards
Pascal Chaperon


----- Original Message -----
From: "Ian Lance Taylor" <ian@airs.com>
To: "Pascal Chaperon" <pascal.chaperon@sectrad.fr>
Sent: Thursday, December 16, 2004 4:33 PM
Subject: Re: How to generate the LIBGCC.A for mc68000


> "Pascal Chaperon" <pascal.chaperon@sectrad.fr> writes:
>
> > Thank you very much for your contribution.
>
> You're welcome.  Please reply to the list and not just to me.
> Thanks.
>
> > I have well understand that the trouble is around the configuration of
GCC
> > and the
> > config stricts in the gcc / config / m68k directory.
> > This one has a lot different scripts and I do not known how to specify
that
> > I want this
> > script and not the other one.
> > And first what is the default one ?
> > I saw that the t-m68kelf seems to have the lines you specified but how
can I
> > do to use it ?
>
> These files are chosen in gcc/config.gcc.  For example, t-m68kelf will
> be used if you configure for the m68020-elf or the m68k-elf target.
> t-m68kelf is a Makefile fragment; it will be included by the gcc
> Makefile.
>
> The default Makefile fragment would be t-m68k, although since that
> file does not exist there is no default.
>
> Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-16 16:29       ` Pascal Chaperon
@ 2004-12-16 16:45         ` Ian Lance Taylor
  2004-12-16 17:09           ` Pascal Chaperon
  2004-12-16 17:16         ` Peter Barada
  1 sibling, 1 reply; 10+ messages in thread
From: Ian Lance Taylor @ 2004-12-16 16:45 UTC (permalink / raw)
  To: Pascal Chaperon; +Cc: gcc

"Pascal Chaperon" <pascal.chaperon@sectrad.fr> writes:

> I have got an error in the linker :
> it is deplayed in french but in english it should be somethink like that :
> 
> ../m68k-coff/bin/ld: unable to find -lc
> collect2: ld has returned 1 error code

Use -nostdlib when you link.  See the docs.

Of course this will only work if you really do not need libc.  It
provides functions like printf, malloc, etc.  libc is not provided by
gcc.

Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-16 16:45         ` Ian Lance Taylor
@ 2004-12-16 17:09           ` Pascal Chaperon
  0 siblings, 0 replies; 10+ messages in thread
From: Pascal Chaperon @ 2004-12-16 17:09 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

Right,

It is now ok for me.

There is still pending issues but they are related to ucLinux and GCC is not
in cause ....

Thank you very much for your good support.

Pascal Chaperon

----- Original Message -----
From: "Ian Lance Taylor" <ian@airs.com>
To: "Pascal Chaperon" <pascal.chaperon@sectrad.fr>
Cc: <gcc@gnu.org>
Sent: Thursday, December 16, 2004 5:44 PM
Subject: Re: How to generate the LIBGCC.A for mc68000


> "Pascal Chaperon" <pascal.chaperon@sectrad.fr> writes:
>
> > I have got an error in the linker :
> > it is deplayed in french but in english it should be somethink like that
:
> >
> > ../m68k-coff/bin/ld: unable to find -lc
> > collect2: ld has returned 1 error code
>
> Use -nostdlib when you link.  See the docs.
>
> Of course this will only work if you really do not need libc.  It
> provides functions like printf, malloc, etc.  libc is not provided by
> gcc.
>
> Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-16 16:29       ` Pascal Chaperon
  2004-12-16 16:45         ` Ian Lance Taylor
@ 2004-12-16 17:16         ` Peter Barada
  2004-12-16 17:45           ` Pascal Chaperon
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Barada @ 2004-12-16 17:16 UTC (permalink / raw)
  To: pascal.chaperon; +Cc: ian, gcc


>I had understood that my compiler has been generated for 68020 family.
>So I re-compiled all the sources (including the binutils) with the following
>option :
>--target=m68k-coff
>I also create a t-coff file by copying and renaming the t-m68kelf.
>( I think it was not good, according to you e-mail the name should has been
>t-m68kcoff ).
>In any case the result is a compiler installed in a new directory created
>for it
>../cross-compiler/m68k-coff
>All the binaries are well installed and now the libgcc.a contains all the
>arithmetics functions
>I need for a mc68000 compilation ( including mulsi3 and friends ).
>
>So it seems to be better isn't ?  :-)
>
>I made a test for my compiler :
>
>vi test.c
>-->
>
>int main( int argc, char **argv)
>{
>    return 0;
>}
>
>and I tried to compile this file :
>
>m68k-coff-gcc test.c
>
>I have got an error in the linker :
>it is deplayed in french but in english it should be somethink like that :
>
>../m68k-coff/bin/ld: unable to find -lc
>collect2: ld has returned 1 error code

This is expected since you built a cross-compiler for m68k, but not a
libc for m68k that you can link with.

>Note that I had exactly the same error while compiling GCC and I found a
>workaround by manualy edit the
>Makefile in gcc directory :
>SHLIB_LC = -lc
>
>replaced by
>SHLIB_LC =

Blindly removing the -lc option is *not* what you wanted to do.

>How about this issue ?
>
>I think it is the last one !

Ah, no.  This is just another issue in a long list of issues that
you're going to run into since you really don't have a clear
understanding of the linux environment, or how to build cross-target
toolchains. 

Again, go look at:

http://www.uclinux.org/

where you'll find kernels that have been modified to support m68000,
as well as toolcahins that can build that kernel as well as the
userland applications you want to run.

Until you have a much clearer understanding of what you are trying to
do, blindly throwing together a cross-compiler is not going to get you
there. 

-- 
Peter Barada
peter@the-baradas.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-16 17:16         ` Peter Barada
@ 2004-12-16 17:45           ` Pascal Chaperon
  2004-12-16 18:19             ` Peter Barada
  0 siblings, 1 reply; 10+ messages in thread
From: Pascal Chaperon @ 2004-12-16 17:45 UTC (permalink / raw)
  To: Peter Barada; +Cc: ian, gcc

Well,

Thank you for your precious counsels.

I do not know what is to have a "clear understanding of the linux
environment" .
What I know is that I am used to configure and recompile the Linux kernel on
i386 systems for several years.

That is true that build a cross-compiler for an embedded system is something
a little bit
more complex but I am also used to compile and run several embbeded RTOS
in our harware platform (such as VxWorks or AMX ).

To speak franckly we have several project and one them is to port Linux on
a MPC system (Power Quick) with different options for a new harware.
As now we use Linux in most of our host systems but not embedded in the
hardware that does not require a lot of functionnalities.
The new project will require more features (such as TCP/IP) and that is why
we want to use the Linux kernel in it.

Since our current hardware is based on mc68LC302 I want to be more familiar
with embedded Linux by building a kernel for this base. This is only a step.
This processor has no MMU ( it is derived from mc68000) so I am using for
this step the ucLinux distribution that I found on the related site.
This distribution included several ports and on one them is for a mc68EN302
witch is very near our processor.
There are also all the tools needed to compile the kernel and build an image
for this
target but it is not what I want : I want to control all the steps required
to build
an embedded system and not to blindy use a "make" file that produce the
result without
understanding what happen during all the steps.

I do not known if it is clear: I appologise I would not want to disturb you
or be some
one rude. My questions were only related on my comprehension on the steps
required
for that.
Now, with the gnu good support, I think that the compiler is compliant this
the goal
I have fixed: to be abble to compile the ucLinux kernel with a self-produced
cross
compiler chain.
After that we will check all the points related on the bootstrap process but
we have
already do a lot of thing for the other RTOS and we are confident on it.

Of course I accept with pleasure all counsels that will help us to go ahead
: I have already
found a lot of tricks in the Internet and I have planned to continue the
investigation
as far as everything will not be clear.

Best regards
Pascal Chaperon

----- Original Message -----
From: "Peter Barada" <peter@the-baradas.com>
To: <pascal.chaperon@sectrad.fr>
Cc: <ian@airs.com>; <gcc@gnu.org>
Sent: Thursday, December 16, 2004 6:15 PM
Subject: Re: How to generate the LIBGCC.A for mc68000


>
> >I had understood that my compiler has been generated for 68020 family.
> >So I re-compiled all the sources (including the binutils) with the
following
> >option :
> >--target=m68k-coff
> >I also create a t-coff file by copying and renaming the t-m68kelf.
> >( I think it was not good, according to you e-mail the name should has
been
> >t-m68kcoff ).
> >In any case the result is a compiler installed in a new directory created
> >for it
> >../cross-compiler/m68k-coff
> >All the binaries are well installed and now the libgcc.a contains all the
> >arithmetics functions
> >I need for a mc68000 compilation ( including mulsi3 and friends ).
> >
> >So it seems to be better isn't ?  :-)
> >
> >I made a test for my compiler :
> >
> >vi test.c
> >-->
> >
> >int main( int argc, char **argv)
> >{
> >    return 0;
> >}
> >
> >and I tried to compile this file :
> >
> >m68k-coff-gcc test.c
> >
> >I have got an error in the linker :
> >it is deplayed in french but in english it should be somethink like that
:
> >
> >../m68k-coff/bin/ld: unable to find -lc
> >collect2: ld has returned 1 error code
>
> This is expected since you built a cross-compiler for m68k, but not a
> libc for m68k that you can link with.
>
> >Note that I had exactly the same error while compiling GCC and I found a
> >workaround by manualy edit the
> >Makefile in gcc directory :
> >SHLIB_LC = -lc
> >
> >replaced by
> >SHLIB_LC =
>
> Blindly removing the -lc option is *not* what you wanted to do.
>
> >How about this issue ?
> >
> >I think it is the last one !
>
> Ah, no.  This is just another issue in a long list of issues that
> you're going to run into since you really don't have a clear
> understanding of the linux environment, or how to build cross-target
> toolchains.
>
> Again, go look at:
>
> http://www.uclinux.org/
>
> where you'll find kernels that have been modified to support m68000,
> as well as toolcahins that can build that kernel as well as the
> userland applications you want to run.
>
> Until you have a much clearer understanding of what you are trying to
> do, blindly throwing together a cross-compiler is not going to get you
> there.
>
> --
> Peter Barada
> peter@the-baradas.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to generate the LIBGCC.A for mc68000
  2004-12-16 17:45           ` Pascal Chaperon
@ 2004-12-16 18:19             ` Peter Barada
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Barada @ 2004-12-16 18:19 UTC (permalink / raw)
  To: pascal.chaperon; +Cc: ian, gcc


>I do not know what is to have a "clear understanding of the linux
>environment" .
>What I know is that I am used to configure and recompile the Linux kernel on
>i386 systems for several years.

I should have been more clear.  What I meant is that you need a better
understanding of building embedded linux kerenels and environments.
If you had that, you would have built a m68k-elf compiler instead of
trying to build a m68k-coff compiler, and would have known that you
needed a libc for the 68000 that would link with your test application.

>Since our current hardware is based on mc68LC302 I want to be more familiar
>with embedded Linux by building a kernel for this base. This is only a step.
>This processor has no MMU ( it is derived from mc68000) so I am using for
>this step the ucLinux distribution that I found on the related site.
>This distribution included several ports and on one them is for a mc68EN302
>witch is very near our processor.
>There are also all the tools needed to compile the kernel and build an image
>for this
>target but it is not what I want : I want to control all the steps required
>to build
>an embedded system and not to blindy use a "make" file that produce the
>result without
>understanding what happen during all the steps.

I'm glad that you have found a kernel and toolchain that very closely
matches what you want.  I also understand that you want to 'control'
all the steps necessary to build the toolchain necessary to build the
toolchain.

If you look in
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/gcc-3/ You'll find
all the source(and patches) necessary to build a complete m68k
toolchain that can build uclinux kernels and userland applications for
m68000.  Also from that page, you can find "build-uclinux-tools.sh"
which is a fairly well documented shell script that goes through the
*many* steps necessary to build the toolchain.

>I do not known if it is clear: I appologise I would not want to
>disturb you or be some one rude. My questions were only related on my
>comprehension on the steps required for that.  Now, with the gnu good
>support, I think that the compiler is compliant this the goal I have
>fixed: to be abble to compile the ucLinux kernel with a self-produced
>cross compiler chain.  After that we will check all the points related
>on the bootstrap process but we have already do a lot of thing for the
>other RTOS and we are confident on it.

As I indicated before, these questions are better directed at the
cross-gcc mailing list where you'll find a group of people(myself
included) that use gcc as a cross-compiler for various embedded
targets, some of which have linux on them.

As for 'self-produced cross compiler chain', I suggest you read an
understand the tool building script pointed at above.  You'll be
duplicating those steps to get a toolchain that will do what you want.

Good Luck!

-- 
Peter Barada
peter@the-baradas.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-12-16 18:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15 17:58 How to generate the LIBGCC.A for mc68000 Pascal Chaperon
2004-12-15 18:31 ` Peter Barada
2004-12-15 18:43 ` Ian Lance Taylor
2004-12-15 19:12   ` Peter Barada
     [not found]   ` <00e001c4e37b$857b9d50$1700a8c0@PASCAL>
     [not found]     ` <m38y7y6yxb.fsf@gossamer.airs.com>
2004-12-16 16:29       ` Pascal Chaperon
2004-12-16 16:45         ` Ian Lance Taylor
2004-12-16 17:09           ` Pascal Chaperon
2004-12-16 17:16         ` Peter Barada
2004-12-16 17:45           ` Pascal Chaperon
2004-12-16 18:19             ` Peter Barada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).