Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2015 16:33:31 +0800
From:      Julian Elischer <julian@freebsd.org>
To:        "hackers@freebsd.org" <hackers@freebsd.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   libc compile failure with new syscall.
Message-ID:  <559102DB.4050902@freebsd.org>

next in thread | raw e-mail | index | archive | help
Hi all,

At $JOB we have a few extra syscalls that we have added to our kernel.

After generating the new sysent files in /sys/kern, libc fails to 
compile with:

===> lib/libc (obj,depend,all,install)
building shared library libc.so.7
[...]
/usr/bin/ld: rlk_check_offline.So: relocation R_X86_64_32 against 
`SYS_rlk_check_offline' can not be used when making a shared object; 
recompile with -fPIC
rlk_check_offline.So: could not read symbols: Bad value
*** [libc.so.7] Error code 1

this suggests that the code that generates the libc syscall stubs is 
generating something the linker doesn't like.


the definition of the syscall is:

588     AUE_NULL        NOSTD   { int rlk_check_offline(char *localfs, 
char *path, \
                                     int *is_offline, int rlk_flags, \
                                     int *cache_status); }
------
which generates (in various files):
         { AS(rlk_check_offline_args), (sy_call_t *)lkmressys, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 588 = rlk_check_offline */
------
         "rlk_check_offline",                    /* 588 = 
rlk_check_offline */
------
         /* rlk_check_offline */
         case 588: {
                 struct rlk_check_offline_args *p = params;
                 uarg[0] = (intptr_t) p->localfs; /* char * */
                 uarg[1] = (intptr_t) p->path; /* char * */
                 uarg[2] = (intptr_t) p->is_offline; /* int * */
                 iarg[3] = p->rlk_flags; /* int */
                 uarg[4] = (intptr_t) p->cache_status; /* int * */
                 *n_args = 5;
                 break;
         }
-------
#define SYS_rlk_check_offline   588
-------
struct rlk_check_offline_args {
         char localfs_l_[PADL_(char *)]; char * localfs; char 
localfs_r_[PADR_(char *)];
         char path_l_[PADL_(char *)]; char * path; char 
path_r_[PADR_(char *)];
         char is_offline_l_[PADL_(int *)]; int * is_offline; char 
is_offline_r_[PADR_(int *)];
         char rlk_flags_l_[PADL_(int)]; int rlk_flags; char 
rlk_flags_r_[PADR_(int)];
         char cache_status_l_[PADL_(int *)]; int * cache_status; char 
cache_status_r_[PADR_(int *)];
};
int     sys_rlk_check_offline(struct thread *, struct 
rlk_check_offline_args *);
#define SYS_AUE_rlk_check_offline       AUE_NULL

-------



the generated stub looks like:
$ cat /usr/obj/usr/src/lib/libc/rlk_check_offline.S

#include "compat.h"
#include "SYS.h"
RSYSCALL(rlk_check_offline)
         .section .note.GNU-stack,"",%progbits

--------


nothing in this definition looks special, So I'm surprised that the 
libc build doesn't like it.
This is a (just) post 10.1 10-stable. But we plan to move to 11 soon too.

Any suggestions as to what I should change would be greatly 
appreciated.. I'm running out of ideas.










Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?559102DB.4050902>