doc: more unexpected changed function examples

This commit is contained in:
Joe Lawrence 2017-04-20 11:12:47 -04:00
parent e124028b65
commit 29d11709c3

View File

@ -377,6 +377,11 @@ Some examples:
function will also change. In this case there's nothing you can do to function will also change. In this case there's nothing you can do to
prevent the extra changes. prevent the extra changes.
* If a changed function was originally inlined, but turned into a callable
function after patching, consider adding `__always_inline` to the function
definition. Likewise, if a function is only inlined after patching,
consider using `noinline` to prevent the compiler from doing so.
* If your patch adds a call to a function where the original version of the * If your patch adds a call to a function where the original version of the
function's ELF symbol has a .constprop or .isra suffix, and the corresponding function's ELF symbol has a .constprop or .isra suffix, and the corresponding
patched function doesn't, that means the patch caused gcc to no longer patched function doesn't, that means the patch caused gcc to no longer
@ -384,6 +389,13 @@ Some examples:
its callers. If you want to prevent this from happening, copy/paste the its callers. If you want to prevent this from happening, copy/paste the
function with a new name and call the new function from your patch. function with a new name and call the new function from your patch.
* Moving around source code lines can introduce unique instructions if any
`__LINE__` preprocessor macros are in use. This can be mitigated by adding
any new functions to the bottom of source files, using newline whitespace to
maintain original line counts, etc. A more exact fix can be employed by
modifying the source code that invokes `__LINE__` and hard-coding the
original line number in place.
Removing references to static local variables Removing references to static local variables
--------------------------------------------- ---------------------------------------------