📄 compiler.sgml
字号:
<Chapter Id="compiler"><DocInfo><AuthorGroup><Author><FirstName>Brian</FirstName><Surname>Gallew</Surname></Author></AuthorGroup><Date>Transcribed 1998-02-12</Date></DocInfo><Title><application>gcc</application> Default Optimizations</Title><Para><Note><Para>Contributed by <ULink url="mailto:geek+@cmu.edu">Brian Gallew</ULink></Para></Note></para><Para>Configuring gcc to use certain flags by default is a simple matter ofediting the <FileName>/usr/local/lib/gcc-lib/<Replaceable>platform</Replaceable>/<Replaceable>version</Replaceable>/specs</FileName>file.The format of this file pretty simple. The file is broken intosections, each of which is three lines long. The first line is"*<Replaceable>section_name</Replaceable>:" (e.g. "*asm:").The second line is a list of flags,and the third line is blank.</para><Para>The easiest change to make is to appendthe desired default flags to the list in the appropriate section. Asan example, let's suppose that I have linux running on a '486 with gcc2.7.2 installed in the default location. In the file/usr/local/lib/gcc-lib/i486-linux/2.7.2/specs, 13 lines down I findthe following section:<ProgramListing>- ----------SECTION----------*cc1:- ----------SECTION----------</ProgramListing>As you can see, there aren't any default flags. If I always wantedcompiles of C code to use "-m486 -fomit-frame-pointer", I wouldchange it to look like:<ProgramListing>- ----------SECTION----------*cc1:- -m486 -fomit-frame-pointer- ----------SECTION----------</ProgramListing>If I wanted to be able to generate 386 code for another, older linuxbox lying around, I'd have to make it look like this:<ProgramListing>- ----------SECTION----------*cc1:%{!m386:-m486} -fomit-frame-pointer- ----------SECTION----------</ProgramListing>This will always omit frame pointers, any will build 486-optimizedcode unless -m386 is specified on the command line.</para><Para>You can actually do quite a lot of customization with the specs file.Always remember, however, that these changes are global, and affectall users of the system.</para></Chapter>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -