From owner-freebsd-current@freebsd.org Mon Jun 29 10:14:09 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1A7098FD71; Mon, 29 Jun 2015 10:14:09 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D8B01A90; Mon, 29 Jun 2015 10:14:09 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-252-104.lns20.per4.internode.on.net [121.45.252.104]) (authenticated bits=0) by vps1.elischer.org (8.14.9/8.14.9) with ESMTP id t5TADxgv088656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 29 Jun 2015 03:14:02 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <55911A65.9090600@freebsd.org> Date: Mon, 29 Jun 2015 18:13:57 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Konstantin Belousov CC: "hackers@freebsd.org" , freebsd-current Subject: Re: libc compile failure with new syscall. References: <559102DB.4050902@freebsd.org> <20150629084316.GS2080@kib.kiev.ua> In-Reply-To: <20150629084316.GS2080@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2015 10:14:09 -0000 On 6/29/15 4:43 PM, Konstantin Belousov wrote: > On Mon, Jun 29, 2015 at 04:33:31PM +0800, Julian Elischer wrote: >> 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. > No, this suggests that the symbol SYS_rlk_check_offline was undefined > when assembling your rlk_check_offline.S. > > Check the way you generated the stuff from syscalls.master. Most likely, > sys/sys/syscall.h update was lost. /sys/sys/syscall.h: #define SYS_pz_openat_ex 587 #define SYS_rlk_check_offline 588 <---- #define SYS_MAXSYSCALL 589 as shown below.. > >> >> 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 > ^^^^^ This must be seen by asm. > > Note that in the stock sources, lib/libc/amd64/SYS.h includes syscall.h. and it does here too.. otherwise all the other syscalls would fail.... hmmm wonder if I need to install the new one into /usr/include/sys/first. ah that's it I'm doing "make libraries" and it requires the new syscall.h to be in /usr/include. thanks for that.. now for the next problem... > >> ------- >> 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. >> >> >> >> >> >> >> >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >