Return-Path: Date: Thu, 08 Oct 2020 22:18:10 +0900 Message-ID: From: Hajime Tazaki Subject: Re: [RFC v7 02/21] um: add os init and exit calls In-Reply-To: <0817bfdee3ee28ae8b94251ed559cf4e844a5ea4.camel@sipsolutions.net> References: <184f5b2c6a0c399edf519d27989519a35ab90700.1601960644.git.thehajime@gmail.com> <0817bfdee3ee28ae8b94251ed559cf4e844a5ea4.camel@sipsolutions.net> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII To: johannes@sipsolutions.net Cc: linux-um@lists.infradead.org, jdike@addtoit.com, richard@nod.at, anton.ivanov@cambridgegreys.com, tavi.purdila@gmail.com, linux-kernel-library@freelists.org, linux-arch@vger.kernel.org, tavi@cs.pub.ro, retrage01@gmail.com List-ID: On Thu, 08 Oct 2020 00:13:02 +0900, Johannes Berg wrote: > > On Tue, 2020-10-06 at 18:44 +0900, Hajime Tazaki wrote: > > > > -#define __define_initcall(level,fn) \ > > - static initcall_t __initcall_##fn __used \ > > - __attribute__((__section__(".initcall" level ".init"))) = fn > > - > > -/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll > > - * make them run first. > > - */ > > -#define __initcall(fn) __define_initcall("1", fn) > > +#undef __uml_exit_call > > +#define __uml_exit_call __used __section(os_exitcalls) > > Doesn't that break calling of sigio_cleanup and remove_umid_dir? Without the patch 04/21 um: host: implement os_initcalls and os_exitcalls, yes you're right. > After all, > > > +void __weak os_exitcalls(void) > > +{ > > +} > > This does nothing so far. > > Also, why the __weak? The intention is to define os_exitcalls() under tools/um so that the actual exitcalls is located in different ELF sections (we defined multiple __uml_exit_call for __UM_HOST__ and ! __UM_HOST__). Thus uml_cleanup() must see the symbol but give the place where actual function is defined at tools/um. Thus, this is __weak symbol-ed. -- Hajime