GN writing specifications [Nut Pie]

GN writing specifications

Rule 1.1

Forbidden : Calling external compilation tools to compile software modules in gn. Counter example : Use action to call automake and Make in gn to compile third-party components. Requirements : External components need to be transplanted into the gn compilation form to avoid unnecessary dependence on the environment during the compilation process, and to obtain the public capabilities provided by the compilation framework, including but not limited to: safe compilation options, ASAN, etc. Exception : The Linux Kernel compilation framework actually completes the compilation of user-mode programs. The kernel can complete independent compilation outside the compilation framework. In order to achieve one-click compilation, some platform implementations use gn to add kernel compilation to the compilation process, which is acceptable.

Rule 1.2

Disabled : It is forbidden to add the safe compilation options that have been added by the compilation system in the gn file of the module. Counterexample : Adding -fstack-protector-strong requirements during module compilation : Module developers should be aware of the default options that have been added globally and do not need to add them again to satisfy internal and external rules.

compile options Compile parameters default value
stack protection -fstack-protector-strong open
Fortify Source -D_FORTIFY_SOURCE=2 -O2 open

Rule 1.3

Guess you like

Origin blog.csdn.net/qq_39132095/article/details/132792297