Re: [PATCH 4/4] x86: fix function types in COND_SYSCALL

From: Sami Tolvanen
Date: Tue Sep 17 2019 - 18:44:21 EST


On Fri, Sep 13, 2019 at 5:28 PM Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> Ah, I get it. Doesnât this cause a little bit of code bloat, though?

A little bit yes, a few extra functions for syscalls that are not
otherwise implemented.

> What if you made __x86_ni_syscall, etc (possibly using the *DEFINE_SYSCALL0 macros) and then generate weak aliases to those?

That would be convenient, but COND_SYSCALL is used in kernel/sys_ni.c,
and we can't create an alias to a function defined elsewhere:

$ cat test.c
long b(void);
long a(void) __attribute__((alias("b")));
$ gcc -c test.c
test.c:2:6: error: âaâ aliased to undefined symbol âbâ
long a(void) __attribute__((alias("b")));
^

Curiously, when we use inline assembly to create the alias (similarly
to the current cond_syscall), gcc just quietly drops the alias if the
function is not defined.

Sami