473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Just for fun

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.
Nov 13 '05 #1
3 2304
In article <3e**************************@posting.google.com >,
Domingo Fiesta Segura <li************@yahoo.es> 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 dj******@csclub.uwaterloo.ca
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
Nov 13 '05 #2
dj******@csclub.uwaterloo.ca (Dave Vandervies) wrote in message news:<bm**********@tabloid.uwaterloo.ca>...
...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 ;-)
Nov 13 '05 #3
"Domingo Fiesta Segura" <li************@yahoo.es> wrote in message
news:3e**************************@posting.google.c om...
dj******@csclub.uwaterloo.ca (Dave Vandervies) wrote in message

news:<bm**********@tabloid.uwaterloo.ca>...
...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
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Kevin Smith | last post by:
For what it's worth, I wrote the original PEP 318. I probably wasn't qualified, but I just wanted a nice simple way to declare class methods without having to repeat the function name. After...
72
by: Herbert | last post by:
I'm still relativey new to stylesheets, so I'm hoping that the way I'm going about things can be seriously improved upon, i.e . I just haven't undersood something obvious about the 'cascading'...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
16
by: John Rivers | last post by:
http://www.15seconds.com/Issue/030812.htm?voteresult=1 poor guy worked his heart out, just to make a page control and then they published it ha ha ha ha ha to "help" others
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
18
by: bsruth | last post by:
I tried for an hour to find some reference to concrete information on why this particular inheritance implementation is a bad idea, but couldn't. So I'm sorry if this has been answered before....
20
by: kwikius | last post by:
As I understand it posts to comp.std.c++ shouldnt contain personal attacks. Since several of my posts on this to comp.std.c++ on this subject have now been simply ignored with out any reply by...
30
by: HangEveryRepubliKKKan | last post by:
Ahahahaha.. Lets see if I get this Demented Lintard reasoning right. Vista is a failure becuase after 300 days after it's release, it only has 7.5% of the OS market while the Lintard OS, is a...
5
by: John Salerno | last post by:
I just installed Pylons onto my hosting server so I could try out templating with Mako, but it seems a little more complicated than that. From the look of it all, the site seems to want a full...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.