gcc-plugin: GCC 10 - update local/non local insn names

Kernel livepatching modules build on GCC 10, with patched functions
referring to local function would fail to load with the error:
 module_64: livepatch_ext4_cond_resched: Expected nop after call, got 7fe5fb78 at ext4_setup_system_zone+0x460/0xc90 [livepatch_ext4_cond_resched]

for more details on the error, refer to discussion at:
 https://lkml.kernel.org/r/1508217523-18885-1-git-send-email-kamalesh@linux.vnet.ibm.com

the reason was that the gcc-plugin would skip the pass on error, failing
to convert the local calls into global, i.e on ppc64le every global call
is followed by a nop instruction, that gets replaced by the kernel to
restore
the TOC/r2 value of the callee, while parsing the relocations and would
skip the TOC restoration for local functions, where the TOC remains the
same across sibling functions.

GCC 10 commit 07c48b61a082("[RS6000] Put call cookie back in AIX/ELFv2
call patterns") merged a couple of call codes definition, breaking the
plugin.  Change the plugin codes to match the GCC 10 codes.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
This commit is contained in:
Kamalesh Babulal 2020-06-12 01:48:47 -04:00
parent 92c42039bf
commit 67aa131137

View File

@ -3,6 +3,18 @@
#define PLUGIN_NAME "ppc64le-plugin"
#if BUILDING_GCC_VERSION < 10000
#define CALL_LOCAL "*call_local_aixdi"
#define CALL_NONLOCAL "*call_nonlocal_aixdi"
#define CALL_VALUE_LOCAL "*call_value_local_aixdi"
#define CALL_VALUE_NONLOCAL "*call_value_nonlocal_aixdi"
#else
#define CALL_LOCAL "*call_localdi"
#define CALL_NONLOCAL "*call_nonlocal_aixdi"
#define CALL_VALUE_LOCAL "*call_value_localdi"
#define CALL_VALUE_NONLOCAL "*call_value_nonlocal_aixdi"
#endif
int plugin_is_GPL_compatible;
struct plugin_info plugin_info = {
@ -29,13 +41,13 @@ static unsigned int ppc64le_plugin_execute(void)
if (!name)
continue;
if (!strcmp(name , "*call_local_aixdi"))
if (!strcmp(name , CALL_LOCAL))
local_code = code;
else if (!strcmp(name , "*call_nonlocal_aixdi"))
else if (!strcmp(name , CALL_NONLOCAL))
nonlocal_code = code;
else if (!strcmp(name, "*call_value_local_aixdi"))
else if (!strcmp(name, CALL_VALUE_LOCAL))
value_local_code = code;
else if (!strcmp(name, "*call_value_nonlocal_aixdi"))
else if (!strcmp(name, CALL_VALUE_NONLOCAL))
value_nonlocal_code = code;
if (nonlocal_code != -1 && local_code != -1 &&