public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Building my own C library
@ 2009-09-01 19:24 bd satish
  2009-09-01 21:37 ` Ian Lance Taylor
  2009-09-01 23:54 ` John Carter
  0 siblings, 2 replies; 6+ messages in thread
From: bd satish @ 2009-09-01 19:24 UTC (permalink / raw)
  To: gcc-help

Hello all,

I was trying to compile my own Standard C Library  (for ex, I want to
use my version of malloc instead of the one included in libc ). What
command line options should I use to compile & link this code with my
test case ?  The code is compiling fine (with option -nostdinc) but I
think linking is my problem. For one, I noticed  -nostdlib and
-nodefaultlibs  but these are giving errors.

I have my version of  the C headers in /home/bds/include. It seems
like, my version of malloc is  clashing with the one coming with gcc.
Now I'm not sure which one did the test case trying to pick up.

Any help appreciated.

-- Satish BD

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

* Re: Building my own C library
  2009-09-01 19:24 Building my own C library bd satish
@ 2009-09-01 21:37 ` Ian Lance Taylor
  2009-09-01 23:54 ` John Carter
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2009-09-01 21:37 UTC (permalink / raw)
  To: bd satish; +Cc: gcc-help

bd satish <bdsatish@gmail.com> writes:

> I was trying to compile my own Standard C Library  (for ex, I want to
> use my version of malloc instead of the one included in libc ). What
> command line options should I use to compile & link this code with my
> test case ?  The code is compiling fine (with option -nostdinc) but I
> think linking is my problem. For one, I noticed  -nostdlib and
> -nodefaultlibs  but these are giving errors.
>
> I have my version of  the C headers in /home/bds/include. It seems
> like, my version of malloc is  clashing with the one coming with gcc.
> Now I'm not sure which one did the test case trying to pick up.
>
> Any help appreciated.

You need to tell us what is actually going wrong.

-nostdinc and -nostdlib should do the job.  You will then have to
explicitly list your library and startup files when linking.

Ian

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

* Re: Building my own C library
  2009-09-01 19:24 Building my own C library bd satish
  2009-09-01 21:37 ` Ian Lance Taylor
@ 2009-09-01 23:54 ` John Carter
  1 sibling, 0 replies; 6+ messages in thread
From: John Carter @ 2009-09-01 23:54 UTC (permalink / raw)
  To: bd satish; +Cc: gcc-help

On Wed, 2 Sep 2009, bd satish wrote:

> I was trying to compile my own Standard C Library  (for ex, I want to
> use my version of malloc instead of the one included in libc ). What
> command line options should I use to compile & link this code with my
> test case ?  The code is compiling fine (with option -nostdinc) but I
> think linking is my problem. For one, I noticed  -nostdlib and
> -nodefaultlibs  but these are giving errors.

You'll have to show the errors.

Some that I'd expect would relate to C language infrastructure
routines that are provided by libgcc which you have probably forgotten
to provide (or never heard of til now).

I hope you are aware their are many other ways to achieve similar
things...

I suspect this is a classic case of we can help do what you are trying
to do... but if you told us what you are trying to do... we could
advise a _much_ better and simpler solution.

ie. Writing your own Standard C library is almost _never_ what you
want to do.


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand

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

* Re: Building my own C library
  2009-09-02  0:32 Bill McEnaney
@ 2009-09-02  1:20 ` John Carter
  0 siblings, 0 replies; 6+ messages in thread
From: John Carter @ 2009-09-02  1:20 UTC (permalink / raw)
  To: gcc-help

On Tue, 1 Sep 2009, Bill McEnaney wrote:

>
> Oops!  I meant glibc's strstr function.
>> I wouldn't want to write my on Standard C Library, but I wish someone
>> would rewrite glibc's qsort function.  I may be lightning fast, but it's
>> almost unintelligible.

Try this.

http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/src/newlib/libc/string/strstr.c?rev=1.2&content-type=text/plain&cvsroot=src

http://tinyurl.com/lcjhg6

John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand

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

* Re: Building my own C library
@ 2009-09-02  0:32 Bill McEnaney
  2009-09-02  1:20 ` John Carter
  0 siblings, 1 reply; 6+ messages in thread
From: Bill McEnaney @ 2009-09-02  0:32 UTC (permalink / raw)
  To: Bill McEnaney, John Carter, bd satish, gcc-help


Oops!  I meant glibc's strstr function.
> I wouldn't want to write my on Standard C Library, but I wish someone
> would rewrite glibc's qsort function.  I may be lightning fast, but it's
> almost unintelligible.
> 
> > On Wed, 2 Sep 2009, bd satish wrote:
> > 
> > > I was trying to compile my own Standard C Library  (for ex, I want to
> > > use my version of malloc instead of the one included in libc ). What
> > > command line options should I use to compile & link this code with my
> > > test case ?  The code is compiling fine (with option -nostdinc) but I
> > > think linking is my problem. For one, I noticed  -nostdlib and
> > > -nodefaultlibs  but these are giving errors.
> > 
> > You'll have to show the errors.
> > 
> > Some that I'd expect would relate to C language infrastructure
> > routines that are provided by libgcc which you have probably forgotten
> > to provide (or never heard of til now).
> > 
> > I hope you are aware their are many other ways to achieve similar
> > things...
> > 
> > I suspect this is a classic case of we can help do what you are trying
> > to do... but if you told us what you are trying to do... we could
> > advise a _much_ better and simpler solution.
> > 
> > ie. Writing your own Standard C library is almost _never_ what you
> > want to do.
> > 
> > 
> > John Carter                             Phone : (64)(3) 358 6639
> > Tait Electronics                        Fax   : (64)(3) 359 4632
> > PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
> > New Zealand
> > 
> > 
> 
> ________________________________________________________________
> Please visit a saintly hero:
> http://www.jakemoore.org
> 
> 

________________________________________________________________
Please visit a saintly hero:
http://www.jakemoore.org

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

* Re: Building my own C library
@ 2009-09-02  0:31 Bill McEnaney
  0 siblings, 0 replies; 6+ messages in thread
From: Bill McEnaney @ 2009-09-02  0:31 UTC (permalink / raw)
  To: John Carter, bd satish, gcc-help

I wouldn't want to write my on Standard C Library, but I wish someone
would rewrite glibc's qsort function.  I may be lightning fast, but it's
almost unintelligible.

> On Wed, 2 Sep 2009, bd satish wrote:
> 
> > I was trying to compile my own Standard C Library  (for ex, I want to
> > use my version of malloc instead of the one included in libc ). What
> > command line options should I use to compile & link this code with my
> > test case ?  The code is compiling fine (with option -nostdinc) but I
> > think linking is my problem. For one, I noticed  -nostdlib and
> > -nodefaultlibs  but these are giving errors.
> 
> You'll have to show the errors.
> 
> Some that I'd expect would relate to C language infrastructure
> routines that are provided by libgcc which you have probably forgotten
> to provide (or never heard of til now).
> 
> I hope you are aware their are many other ways to achieve similar
> things...
> 
> I suspect this is a classic case of we can help do what you are trying
> to do... but if you told us what you are trying to do... we could
> advise a _much_ better and simpler solution.
> 
> ie. Writing your own Standard C library is almost _never_ what you
> want to do.
> 
> 
> John Carter                             Phone : (64)(3) 358 6639
> Tait Electronics                        Fax   : (64)(3) 359 4632
> PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
> New Zealand
> 
> 

________________________________________________________________
Please visit a saintly hero:
http://www.jakemoore.org

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

end of thread, other threads:[~2009-09-02  1:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01 19:24 Building my own C library bd satish
2009-09-01 21:37 ` Ian Lance Taylor
2009-09-01 23:54 ` John Carter
2009-09-02  0:31 Bill McEnaney
2009-09-02  0:32 Bill McEnaney
2009-09-02  1:20 ` John Carter

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).