1 |
2016-06-10 17:15 GMT+08:00 Anthony G. Basile <blueness@g.o>: |
2 |
> so i recommend you play with different gcc compiler profiles using |
3 |
> gcc-config on the musl based system you built with GRS, and look at the |
4 |
> collect2 line to see which end files are deployed with each setting. |
5 |
> then i recommend trying to read the gcc spec file for each of the |
6 |
> compiler profiles. then if you know some assembly, look at the code for |
7 |
> those end files which you can find in the musl source tree. that'll |
8 |
> give you some idea what's going on there. |
9 |
|
10 |
Below are my findings after some experimentation: |
11 |
|
12 |
crt files linked by default, on my glibc based host: |
13 |
crt1.o crti.o crtn.o |
14 |
crtbegin.o crtend.o |
15 |
|
16 |
with "-static": |
17 |
crt1.o crti.o crtn.o |
18 |
crtbeginT.o crtend.o |
19 |
|
20 |
with "-shared": |
21 |
crti.o crtn.o |
22 |
crtbeginS.o crtendS.o |
23 |
|
24 |
This complies with what is written on this page: |
25 |
https://dev.gentoo.org/~vapier/crt.txt |
26 |
|
27 |
Things are a bit different on the musl based system. By default: |
28 |
Scrt1.o crti.o crtn.o |
29 |
crtbeginS.o crtendS.o |
30 |
|
31 |
with "-static": |
32 |
Scrt1.o crti.o crtn.o |
33 |
crtbeginP.o crtendS.o |
34 |
|
35 |
with "-shared": |
36 |
crti.o crtn.o |
37 |
crtbeginS.o crtendS.o |
38 |
|
39 |
This looks like a bit of mess to me... |
40 |
|
41 |
To make it even more confusing, I also found that on the glibc based |
42 |
system, crtend.o and crtendS.o are the same; on the musl one, |
43 |
crtbegin.o is the same as crtbeginT.o, and crtbeginP.o is the same as |
44 |
crtbeginS.o. |
45 |
|
46 |
|
47 |
Lei |