This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld: creating a dynamically linked executable ...
- From: kedar mhaswade <kedar dot mhaswade at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 11 Jul 2013 10:12:18 -0700
- Subject: Re: ld: creating a dynamically linked executable ...
> use-of-lib.s has:
> .global _start
> _start:
> When using gcc to perform static linking then the crt*.o routines define _start,
> so your _start conflicts. Use 'main' instead.
That worked. Thanks!
> Also do "gcc -S hello.c"
> (where hello.c is the obvious program which prints "Hello, world!\n")
> then look at hello.s.
That hello.s looks quite different. Perhaps gcc optimizes a few things
(e.g. printf is replaced by puts, pushl is replaced by something else)
and whereas it might be completely justified from a certain point of
view, it confuses me and a lot of "Yak Shaving" results (to an extent
that makes me nervous ...)
I am just trying to follow what I believe is a good book
(http://savannah.nongnu.org/projects/pgubook/) and it suggests to try
out little experiments in assembly code, to prove to oneself that
things work. I was trying to understand what that book says about the
Linux dynamic loader (/lib/ld-linux.so.2) and the confusing ld option
-dynamic-loader (or is it --dynamic-loader?) and that's when the
reality bit me.
> [In general: when trying a new thing, then search
> for previous examples which are related, and see what you can learn
> from the similarities and from the differences.]
Sometimes this approach confuses me more than it helps. But at least I
have tried to follow (a somewhat tougher) path of daring to go on
appropriate mailing lists.