[COMMITTED] Doc: always_inline attribute vs multiple TUs and LTO [PR113203]

Message ID 20250415035920.1107462-1-sloosemore@baylibre.com
State New
Headers
Series [COMMITTED] Doc: always_inline attribute vs multiple TUs and LTO [PR113203] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Sandra Loosemore April 15, 2025, 3:59 a.m. UTC
  gcc/ChangeLog
	PR ipa/113203
	* doc/extend.texi (Common Function Attributes): Explain how to
	use always_inline in programs that have multiple translation
	units, and that LTO inlining additionally needs optimization
	enabled.
---
 gcc/doc/extend.texi | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ae3357f83bf..d5fb2316cfd 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1933,6 +1933,13 @@  Note that if such a function is called indirectly the compiler may
 or may not inline it depending on optimization level and a failure
 to inline an indirect call may or may not be diagnosed.
 
+If you need to use the inlined function in multiple translation units,
+you should put the @code{always_inline} attribute on a function
+definition in a header file that is included in all translation units
+where the function is used.  Link-time optimization can inline
+functions across translation units, but only if an optimization level
+that normally enables inlining is additionally specified.
+
 @cindex @code{artificial} function attribute
 @item artificial
 This attribute is useful for small inline wrappers that if possible