GCC 帮助系统文档

vmlinz posted @ Sun, 15 May 2011 18:49:42 +0800 in Linux with tags linux gcc , 7636 readers

使用GCC 帮助系统

前面在使用gcc 帮助的时候老是找不到自己想要的信息,而且手册巨长(有超过10^4页)。于是就RTFM找到一些使用gcc 帮助系统找到自己需要信息的方法,其实就是gcc 手册的帮助部分的内容。大家还有什么技巧都来讲讲,交流中学习。

gcc --help

下面是从gcc mannual中摘录出来的

Print (on the standard output) a description of the command line
options understood by gcc.  If the -v option is also specified then
--help will also be passed on to the various processes invoked by gcc,
so that they can display the command line options they accept.  If the
-Wextra option has also been specified (prior to the --help option),
then command line options which have no documentation associated with
them will also be displayed.

打印gcc 能识别的命令行选项(到标准输出)。如果同时指定了 -v 选项,那么 --help 选项会被传递给gcc 调用的所有工具,这样就能同时显示所有工具能识别的命令行选项了。如果指定 -Wextra 选项,那么没有相关文档的命令行选项也会显示出来。

gcc --help 会显示gcc 常用的选项和帮助,比如编译器的各个阶段

  • -E 编译进行到预编译就停止,不继续汇编,编译或者链接
  • -S 编译进行到生成汇编就停止,不编译和链接
  • -c 编译成二进制对象就停止,不链接

gcc --target-help

Print (on the standard output) a description of target-specific command
line options for each tool.  For some targets extra target-specific
information may also be printed.

打印和目标平台相关的每个工具的命令行选项(到标准输出)。某些平台上会有额外的平台相关信息被打印出来。

gcc --help={class|[^]qualifier}[,...]

Print (on the standard output) a description of the command line
options understood by the compiler that fit into all specified classes
and qualifiers.  These are the supported classes:

打印编译器识别的属于某些分类或者修饰符的命令行选项到标准输出。

支持的分类

  • optimizers 优化器

    This will display all of the optimization options supported by the compiler.显示编译器支持的所有优化选项

  • warnings 警告

    This will display all of the options controlling warning messages produced by the compiler.显示用于控制编译器产生警告信息的所有选项

  • target 目标平台

    This will display target-specific options. Unlike the --target-help option however, target-specific options of the linker and assembler will not be displayed. This is because those tools do not currently support the extended --help= syntax.显示和目标平台相关 的选项

  • params 参数设置

    This will display the values recognized by the --param option.显示 --param 选项接受的值

  • language 语言

    This will display the options supported for language, where language is the name of one of the languages supported in this version of GCC.显示gcc 支持的程序语言选项

  • common 公共选项

    This will display the options that are common to all languages. 显示所有语言都支持的公共选项

支持的修饰符

  • undocumented 没有文档的

    Display only those options which are undocumented. 显示没有文档的选项

  • joined 联合选项

    Display options which take an argument that appears after an equal sign in the same continuous piece of text, such as: --help=target. 显示联合选项,像 --help=target 这种

  • separate 单独选项

    Display options which take an argument that appears as a separate word following the original option, such as: -o output-file. 显示单独选项,想 -o output-file 这种

示例:

--help=target,undocumented 获取目标平台没有文档的帮助文档
--help=warnings,^joined,^undocumented 获取控制编译器警告的所有有文档的单
独选项(^ 表示反选)

查询选项设置

在帮助选项前面加上 -Q 选项后就可以查看当前的选项配置情况而不是得到选项的描述。

示例:

gcc -Q -m64 --help=target
查询x86_64目标平台的所有目标选项设置

gcc -Q --help=c
查询目标平台c语言的默认选项设置

gcc -Q --help=warnings,joined
查询警告控制的联合选项设置

资源

man gcc

Avatar_small
Mike Ma said:
Sat, 23 Jul 2011 09:08:54 +0800

info libc

info里面还有c库函数的索引

Avatar_small
vmlinz said:
Mon, 10 Oct 2011 23:50:48 +0800

@Mike Ma: 是啊,man libc也可以查到不少信息,这个文章主要是说怎么用gcc help,因为gcc的帮助太多了

Avatar_small
essayroo.com reviews said:
Sat, 22 Jun 2019 17:54:41 +0800

When I used gcc help, I couldn't find the information I wanted, and the manual was huge. I needed essayroo.com reviews from him. So RTFM found some ways to use the gcc help system to find the information you need, which is actually the help part of the gcc manual. Everyone has any skills to talk about, learning in communication?

Avatar_small
myessay said:
Sat, 06 Jul 2019 18:52:45 +0800

vmlinz's Blog is made for the special for the student of a programmer who wants to make a website and games etc. We can learn all the thing from there because it explains all the concept in easy language. But this website myessay doesn't show the data on the English language so those students who cannot understand any other language cannot get information from this website. But this type of changed the language of this website then learn this data.

Avatar_small
videorockstarunivers said:
Tue, 09 Jul 2019 14:11:36 +0800

I am working on the Linux then I faced many problems for completing the task then I recommend this site for the learning and increased knowledge of Linux. Some people feel that is a very difficult task for the working of these windows but It is very good experiences of this working on Linux. I am very impressed videorockstaruniversity with this article for learning. It has many links for more thing according to the programming.

Avatar_small
starjack io said:
Tue, 20 Aug 2019 12:46:51 +0800

Very good, I think I found the knowledge I needed. I will see and refer some information in your post. thank you

Avatar_small
AAA said:
Wed, 18 May 2022 20:34:06 +0800

Can I just say what a reduction to find someone who truly is aware of what theyre talking about on the internet. You definitely know tips on how to convey a problem to light and make it important. More individuals have to read this and perceive this side of the story. I cant consider youre not more common because you positively have the gift. Credit Card Processing Sales

 

============================

 

Good Post, I am a big believer in writing comments on weblogs to let the blog writers know that they added some thing of great benefit to the world wide web! Merchant Sales Consultant

 

==========================

 

Nice post. I discover something more challenging on diverse blogs everyday. It will always be stimulating to read content from other writers and employ a little from their site. I'd choose to use some together with the content in this little blog regardless of whether you do not mind. Naturally I'll provide a link on the internet weblog. Appreciate your sharing. How to Be a Merchant Processor

Avatar_small
AAA said:
Sat, 21 May 2022 03:29:33 +0800

Good day! This is kind of off topic but I need some advice from an established blog. Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to begin. Do you have any ideas or suggestions? Cheers 麥克風

 

==========================

 

I would really love to guest post on your blog. 角落生物


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter