1 |
Harald van Dijk wrote: |
2 |
> On Sun, Nov 05, 2006 at 06:47:07PM +0300, Peter Volkov (pva) wrote: |
3 |
>> Hello. |
4 |
>> |
5 |
>> Short question: What shall we use to link libraries/programs: gcc or ld? |
6 |
>> Why? |
7 |
>> |
8 |
>> A bit longer story: I have a problem during linking of wepattack on |
9 |
>> amd64 systems. Linking stage issues warning: |
10 |
>> |
11 |
>> $ x86_64-pc-linux-gnu-ld -o wepattack wepattack.o rc4.o wepfilter.o |
12 |
>> log.o modes.o misc.o verify.o keygen.o -lpcap -lz -lcrypto |
13 |
>> ld: warning: cannot find entry symbol _start; defaulting to |
14 |
>> 0000000000400e10 |
15 |
>> |
16 |
>> And resulted file is not executable. In google I found the most of |
17 |
>> tutorials/howtos suggest to link with gcc but some programs still use |
18 |
>> LD. From ld man page it's clear that it should link the program but this |
19 |
>> is not working. So what is the right way to do that? Why? |
20 |
> |
21 |
> Link using gcc unless your program is a very special case. _start is defined |
22 |
> in /usr/lib/crt1.o (may be slightly different on amd64), and that as well as |
23 |
> other object files typically required by every program will be pulled in by |
24 |
> gcc. |
25 |
|
26 |
Doing some reading up on the list... thus the late answer. |
27 |
|
28 |
gnu make provides you with the variables/macros that is usable for |
29 |
linking. Look for 'LINK.c' etc in the output of 'make -p -f/dev/null'. |
30 |
It might be wise to use them instead of the actual linker since you |
31 |
might wanna port your project to some other compiler etc in the future. |
32 |
|
33 |
/Andreas |
34 |
-- |
35 |
gentoo-dev@g.o mailing list |