author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sun, 24 Jun 2012 22:55:54 +0300 | |
changeset 1299 | ec63524d2b90 |
parent 813 | 34a39aae2618 |
permissions | -rw-r--r-- |
194 | 1 |
-*- mode: outline; coding: utf-8 -*- |
2 |
||
3 |
* Remove dead code. |
|
4 |
||
5 |
STRIP_DEAD_CODE = -Wl,-static -fvtable-gc -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s |
|
6 |
||
7 |
-Wl,-static |
|
8 |
Link against static libraries. Required for dead-code |
|
9 |
elimination. |
|
10 |
||
11 |
-fvtable-gc |
|
12 |
C++ virtual method table instrumented with garbage collection |
|
13 |
information for the linker. |
|
14 |
||
15 |
-fdata-sections |
|
16 |
Keeps data in separate data sections, so they can be discarded |
|
17 |
if unused. |
|
18 |
||
19 |
-ffunction-sections |
|
20 |
Keeps funcitons in separate data sections, so they can be |
|
21 |
discarded if unused. |
|
22 |
||
23 |
-Wl,--gc-sections |
|
24 |
Tell the linker to garbage collect and discard unused |
|
25 |
sections. |
|
26 |
||
27 |
-s |
|
28 |
Strip the debug information, so as to make the code as small |
|
29 |
as possible. (I presume that you'd want to do this in a |
|
30 |
dead-code removal build.) |
|
31 |
||
32 |
* Map file. |
|
33 |
||
34 |
$ ld -Map=file.map <opts> <files> |
|
35 |
||
36 |
or |
|
37 |
||
38 |
$ gcc -Wl,-Map=file.map <opts> <files> |
|
352 | 39 |
|
40 |
* Predefined macros. |
|
41 |
||
42 |
$ gcc -arch ppc -dM -E - < /dev/null | sort |
|
805
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
43 |
|
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
44 |
* Default search path. |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
45 |
|
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
46 |
$ echo | gcc -v -x c -E - |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
47 |
|
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
48 |
$ gcc -print-search-dirs |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
49 |
install: ... |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
50 |
programs: ... |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
51 |
libraries: ... |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
52 |
|
813 | 53 |
Use -### in actual invoking: |
54 |
||
55 |
$ gcc -### -o foo foo.c |
|
56 |
||
805
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
57 |
$ ld --verbose | grep SEARCH_DIR |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
58 |
|
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
59 |
'LIBRARY_PATH' and 'LD_LIBRARY_PATH' |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
60 |
|
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
61 |
$ cpp -Wp,-v |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
62 |
$ cpp -Wp,-lang-c++,-v |
eeb94c46c797
Default search path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
352
diff
changeset
|
63 |
$ cpp -x c++ -Wp,-v |