Commit c9aa0b93 by Sandra Loosemore Committed by Sandra Loosemore

extend.texi (Common Function Attributes): Move to correct alphabetization of table.

2016-01-01  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	* doc/extend.texi (Common Function Attributes) <noplt>: Move
	to correct alphabetization of table.  Copy-edit and correct
	markup.
	<stack_protect>: Likewise.
	<target_clones>: Likewise.
	<simd>: Likewise.
	* doc/invoke.texi (Optimize Options) <-fstack-protector-explicit>:
	Correct punctuation.
	(Code Gen Options) <-fno-plt>: Copy-edit.

From-SVN: r232030
parent 6eeaad6e
2016-01-01 Sandra Loosemore <sandra@codesourcery.com>
* doc/extend.texi (Common Function Attributes) <noplt>: Move
to correct alphabetization of table. Copy-edit and correct
markup.
<stack_protect>: Likewise.
<target_clones>: Likewise.
<simd>: Likewise.
* doc/invoke.texi (Optimize Options) <-fstack-protector-explicit>:
Correct punctuation.
(Code Gen Options) <-fno-plt>: Copy-edit.
2016-01-01 Bernd Edlinger <bernd.edlinger@hotmail.de> 2016-01-01 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR target/68917 PR target/68917
......
...@@ -2932,6 +2932,36 @@ my_memcpy (void *dest, const void *src, size_t len) ...@@ -2932,6 +2932,36 @@ my_memcpy (void *dest, const void *src, size_t len)
__attribute__((nonnull)); __attribute__((nonnull));
@end smallexample @end smallexample
@item noplt
@cindex @code{noplt} function attribute
The @code{noplt} attribute is the counterpart to option @option{-fno-plt}.
Calls to functions marked with this attribute in position-independent code
do not use the PLT.
@smallexample
@group
/* Externally defined function foo. */
int foo () __attribute__ ((noplt));
int
main (/* @r{@dots{}} */)
@{
/* @r{@dots{}} */
foo ();
/* @r{@dots{}} */
@}
@end group
@end smallexample
The @code{noplt} attribute on function @code{foo}
tells the compiler to assume that
the function @code{foo} is externally defined and that the call to
@code{foo} must avoid the PLT
in position-independent code.
In position-dependent code, a few targets also convert calls to
functions that are marked to not use the PLT to use the GOT instead.
@item noreturn @item noreturn
@cindex @code{noreturn} function attribute @cindex @code{noreturn} function attribute
@cindex functions that never return @cindex functions that never return
...@@ -2977,35 +3007,6 @@ the standard C library can be guaranteed not to throw an exception ...@@ -2977,35 +3007,6 @@ the standard C library can be guaranteed not to throw an exception
with the notable exceptions of @code{qsort} and @code{bsearch} that with the notable exceptions of @code{qsort} and @code{bsearch} that
take function pointer arguments. take function pointer arguments.
@item noplt
@cindex @code{noplt} function attribute
The @code{noplt} attribute is the counterpart to option @option{-fno-plt} and
does not use PLT for calls to functions marked with this attribute in position
independent code.
@smallexample
@group
/* Externally defined function foo. */
int foo () __attribute__ ((noplt));
int
main (/* @r{@dots{}} */)
@{
/* @r{@dots{}} */
foo ();
/* @r{@dots{}} */
@}
@end group
@end smallexample
The @code{noplt} attribute on function foo tells the compiler to assume that
the function foo is externally defined and the call to foo must avoid the PLT
in position independent code.
Additionally, a few targets also convert calls to those functions that are
marked to not use the PLT to use the GOT instead for non-position independent
code.
@item optimize @item optimize
@cindex @code{optimize} function attribute @cindex @code{optimize} function attribute
The @code{optimize} attribute is used to specify that a function is to The @code{optimize} attribute is used to specify that a function is to
...@@ -3120,44 +3121,35 @@ with a copy that redefines NULL appropriately. ...@@ -3120,44 +3121,35 @@ with a copy that redefines NULL appropriately.
The warnings for missing or incorrect sentinels are enabled with The warnings for missing or incorrect sentinels are enabled with
@option{-Wformat}. @option{-Wformat}.
@item stack_protect
@cindex @code{stack_protect} function attribute
This function attribute make a stack protection of the function if
flags @option{fstack-protector} or @option{fstack-protector-strong}
or @option{fstack-protector-explicit} are set.
@item target_clones (@var{options})
@cindex @code{target_clones} function attribute
The @code{target_clones} attribute is used to specify that a function is to
be cloned into multiple versions compiled with different target options
than specified on the command line. The supported options and restrictions
are the same as for @code{target} attribute.
For instance on an x86, you could compile a function with
@code{target_clones("sse4.1,avx")}. It will create 2 function clones,
one compiled with @option{-msse4.1} and another with @option{-mavx}.
At the function call it will create resolver @code{ifunc}, that will
dynamically call a clone suitable for current architecture.
@item simd @item simd
@itemx simd("@var{mask}") @itemx simd("@var{mask}")
@cindex @code{simd} function attribute. @cindex @code{simd} function attribute
This attribute enables creation of one or more function versions that This attribute enables creation of one or more function versions that
can process multiple arguments using SIMD instructions from a can process multiple arguments using SIMD instructions from a
single invocation. Specifying this attribute allows compiler to single invocation. Specifying this attribute allows compiler to
assume that such versions are available at link time (provided assume that such versions are available at link time (provided
in the same or another translation unit). Generated versions are in the same or another translation unit). Generated versions are
target dependent and described in corresponding Vector ABI document. For target-dependent and described in the corresponding Vector ABI document. For
x86_64 target this document can be found x86_64 target this document can be found
@w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}. @w{@uref{https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt,here}}.
The optional argument @var{mask} may have the value
@code{notinbranch} or @code{inbranch},
and instructs the compiler to generate non-masked or masked
clones correspondingly. By default, all clones are generated.
The attribute should not be used together with Cilk Plus @code{vector} The attribute should not be used together with Cilk Plus @code{vector}
attribute on the same function. attribute on the same function.
If the attribute is specified and @code{#pragma omp declare simd}
present on a declaration and @code{-fopenmp} or @code{-fopenmp-simd} If the attribute is specified and @code{#pragma omp declare simd} is
present on a declaration and the @option{-fopenmp} or @option{-fopenmp-simd}
switch is specified, then the attribute is ignored. switch is specified, then the attribute is ignored.
The optional argument @var{mask} may have "notinbranch" or "inbranch"
value and instructs the compiler to generate non-masked or masked @item stack_protect
clones correspondingly. By default, all clones are generated. @cindex @code{stack_protect} function attribute
This attribute adds stack protection code to the function if
flags @option{-fstack-protector}, @option{-fstack-protector-strong}
or @option{-fstack-protector-explicit} are set.
@item target (@var{options}) @item target (@var{options})
@cindex @code{target} function attribute @cindex @code{target} function attribute
...@@ -3196,6 +3188,19 @@ Function Attributes}, @ref{PowerPC Function Attributes}, ...@@ -3196,6 +3188,19 @@ Function Attributes}, @ref{PowerPC Function Attributes},
@ref{ARM Function Attributes},and @ref{Nios II Function Attributes}, @ref{ARM Function Attributes},and @ref{Nios II Function Attributes},
for details. for details.
@item target_clones (@var{options})
@cindex @code{target_clones} function attribute
The @code{target_clones} attribute is used to specify that a function
be cloned into multiple versions compiled with different target options
than specified on the command line. The supported options and restrictions
are the same as for @code{target} attribute.
For instance, on an x86, you could compile a function with
@code{target_clones("sse4.1,avx")}. GCC creates two function clones,
one compiled with @option{-msse4.1} and another with @option{-mavx}.
It also creates a resolver function (see the @code{ifunc} attribute
above) that dynamically selects a clone suitable for current architecture.
@item unused @item unused
@cindex @code{unused} function attribute @cindex @code{unused} function attribute
This attribute, attached to a function, means that the function is meant This attribute, attached to a function, means that the function is meant
......
...@@ -10284,7 +10284,7 @@ references to local frame addresses. ...@@ -10284,7 +10284,7 @@ references to local frame addresses.
@item -fstack-protector-explicit @item -fstack-protector-explicit
@opindex fstack-protector-explicit @opindex fstack-protector-explicit
Like @option{-fstack-protector} but only protects those functions which Like @option{-fstack-protector} but only protects those functions which
have the @code{stack_protect} attribute have the @code{stack_protect} attribute.
@item -fstdarg-opt @item -fstdarg-opt
@opindex fstdarg-opt @opindex fstdarg-opt
...@@ -24418,21 +24418,20 @@ for @option{-fpie} and 2 for @option{-fPIE}. ...@@ -24418,21 +24418,20 @@ for @option{-fpie} and 2 for @option{-fPIE}.
@item -fno-plt @item -fno-plt
@opindex fno-plt @opindex fno-plt
Do not use PLT for external function calls in position-independent code. Do not use the PLT for external function calls in position-independent code.
Instead, load callee address at call site from GOT and branch to it. Instead, load the callee address at call sites from the GOT and branch to it.
This leads to more efficient code by eliminating PLT stubs and exposing This leads to more efficient code by eliminating PLT stubs and exposing
GOT load to optimizations. On architectures such as 32-bit x86 where GOT loads to optimizations. On architectures such as 32-bit x86 where
PLT stubs expect GOT pointer in a specific register, this gives more PLT stubs expect the GOT pointer in a specific register, this gives more
register allocation freedom to the compiler. Lazy binding requires PLT: register allocation freedom to the compiler.
Lazy binding requires use of the PLT;
with @option{-fno-plt} all external symbols are resolved at load time. with @option{-fno-plt} all external symbols are resolved at load time.
Alternatively, function attribute @code{noplt} can be used to avoid PLT Alternatively, the function attribute @code{noplt} can be used to avoid calls
for calls to specific external functions by marking those functions with through the PLT for specific external functions.
this attribute.
Additionally, a few targets also convert calls to those functions that are In position-dependent code, a few targets also convert calls to
marked to not use the PLT to use the GOT instead for non-position independent functions that are marked to not use the PLT to use the GOT instead.
code.
@item -fno-jump-tables @item -fno-jump-tables
@opindex fno-jump-tables @opindex fno-jump-tables
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment