[RFC PATCH] modutils: fix build with uClibc

Waldemar Brodkorb wbx at openadk.org
Wed Dec 21 09:07:10 UTC 2016


Hi Rahul,
Rahul Bedarkar wrote,

> Hi,
> 
> On Wednesday 21 December 2016 12:30 PM, Waldemar Brodkorb wrote:
> >Hi,
> >Rahul Bedarkar wrote,
> >
> >>Commit 3a45b87ac36f (modutils: support finit_module syscall) introduced
> >>macro finit_module. But it is not defined for uClibc.
> >>
> >>With uClibc, we get following build errors:
> >>
> >>  modutils/lib.a(modutils.o): In function `bb_init_module':
> >>  modutils.c:(.text.bb_init_module+0x94): undefined reference to `finit_module'
> >>  modutils.c:(.text.bb_init_module+0xa0): undefined reference to `finit_module'
> >>
> >>This commit guards usage of finit_module when not using uClibc.
> >
> >Do you have an idea why this error is not happening with glibc or
> >musl?
> >
> 
> As mentioned in commit message, commit 3a45b87ac36f (modutils: support
> finit_module syscall) has introduced macro finit_module which is defined in
> else part of #ifdef __UCLIBC__ and in actual usage it is only guarded for
> __NR_finit_module which leads to this error for uClibc only. Following is
> code snippet from modutils.c where finit_module macro is defined.
> 
> #ifdef __UCLIBC__
> extern int init_module(void *module, unsigned long len, const char
> *options);
> extern int delete_module(const char *module, unsigned int flags);
> #else
> # include <sys/syscall.h>
> # define init_module(mod, len, opts) syscall(__NR_init_module, mod, len,
> opts)
> # if defined(__NR_finit_module)
> #  define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd,
> uargs, flags)
> # endif
> # define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
> #endif

init_module / delete_module is just a wrapper for the syscalls.
Wouldn't it be just better to remove the wrappers in uClibc-ng and
just use syscall(..) like for all others?

Can you try something like this?

best regards
 Waldemar


More information about the busybox mailing list