Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Just for fun

Reply
Thread Tools

Just for fun

 
 
Domingo Fiesta Segura
Guest
Posts: n/a
 
      10-08-2003
Hi,

Recently I've been playing on C programming avoiding libc and also
assembly. Well, I guess some of us like to mess up with things like:

#include <linux/types.h>
#include <linux/unistd.h>

int errno;

_syscall1(int, exit, int, status)
_syscall3(ssize_t, write, int, fd, const void *, buf, size_t, count)

void _start()
{
write(1, "Hello there\n", 12);
exit(0);
}

And then compiling with "-nostdlib".

In case argc, argv and/or envp are needed we have to get it from the
stack (AFAIK). Thats the work for /usr/lib/crt1.o in glibc. Of course,
we all knew that.

Searching through the glibc sources I found a curious code in
glibc-2.3.1/sysdeps/unix/start.c, something like this:

static void start1();

void _start ()
{
start1();
}

/* There are some dummy declarations for i386 */
static void start1(int argc, char *argp)
{
char **argv = &argp;
/* Get environment here ... */
/* Call __libc_init */
exit(main(argc, argv, __environ));
}

But doesn't work, why?

P.S: For now I have my own crt1-toy.S version for x86, I'm trying to
work out another crti1-toy.S PPC32 version. Suggestions welcomed.

Thanks for your attention.
 
Reply With Quote
 
 
 
 
Dave Vandervies
Guest
Posts: n/a
 
      10-08-2003
In article <(E-Mail Removed) >,
Domingo Fiesta Segura <(E-Mail Removed)> wrote:
>Hi,
>
>Recently I've been playing on C programming avoiding libc and also
>assembly.


....which puts you well outside the scope of comp.lang.c .

Perhaps an appropriate newsgroup for your OS (Linux, if I'm guessing
correctly from a quick look at the rest of your post) would be both more
interested in this and more likely to give helpful comments.


dave

--
Dave Vandervies http://www.velocityreviews.com/forums/(E-Mail Removed)
Programmers have a problem. It's a secret we try to keep among ourselves.
We really like this stuff. We do it even when they don't pay us. Don't tell
anybody. --Joe Wright in comp.lang.c
 
Reply With Quote
 
 
 
 
Domingo Fiesta Segura
Guest
Posts: n/a
 
      10-08-2003
(E-Mail Removed) (Dave Vandervies) wrote in message news:<bm0ac7$549$(E-Mail Removed)>...
> ...which puts you well outside the scope of comp.lang.c .


Sorry, is the first time I post to newsgroups so I wasn't very
confident trying to classify my question.

> Perhaps an appropriate newsgroup for your OS (Linux, if I'm guessing
> correctly from a quick look at the rest of your post) would be both more
> interested in this and more likely to give helpful comments.


Done. Thanks
 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      10-08-2003
"Domingo Fiesta Segura" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> (E-Mail Removed) (Dave Vandervies) wrote in message

news:<bm0ac7$549$(E-Mail Removed)>...
> > ...which puts you well outside the scope of comp.lang.c .

>
> Sorry, is the first time I post to newsgroups so I wasn't very
> confident trying to classify my question.


This link should help with further
ventures into Usenet:

www.usenet.org

HTH,
-Mike


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT Thursday, uh, fun, yeah, fun! Consultant MCSE 17 02-10-2007 03:39 AM
3 PIX VPN questions - FUN FUN FUN frishack@gmail.com Cisco 3 03-16-2006 02:25 PM
OT: Wednesday follow-up-to-Tuesday-Fun Fun Ken Briscoe MCSE 0 07-14-2004 01:41 PM
Programming is not as much fun/more fun than it used to be. Andy Fish Java 65 05-18-2004 08:24 PM
Fun fun fun Luke Computer Support 3 10-07-2003 03:45 PM



Advertisments