> On Sep 13, 2018, at 2:06 AM, Richard Biener <rguent...@suse.de> wrote: > > On Wed, 12 Sep 2018, Alexander Monakov wrote: > >> On Wed, 12 Sep 2018, Richard Biener wrote: >>> With LTO "static" is too blurry - would -finline-only-hidden be OK >>> with you? >> >> This doesn't sound right - in non-pic, everything is hidden, effectively. >> And the intended use is with Linux kernel, which does not use -fpic. >> >> I agree with LTO this option makes less sense, but I wouldn't expect LTO >> to be used for livepatching-capable kernels. > > The issue is that with LTO this option probably cannot be reliably > implemented (well, I guess we could stick 'noinline' attributes > onto all non-static declared functions…).
currently, I am using callee->externally_visible i.e.: /* Set when function is visible by other units. */ unsigned externally_visible : 1; to distinguish whether the function is static (visible ONLY inside the file) or global (visible by other files) if externally_visible is TRUE and the option -finline-only-static is specified, disable the inlining. > > Btw, what about > > inline T foo() {} > > in C99? for this case, foo is not visible outside of the file? right? the current implementation based on externally_visible can correctly treat this routine as “static” (visible ONLY inside the file), and inline the call to foo. this seems the correct behavior. > Those are not declared static (in fact there may be > extern T foo () declarations somewhere). I also think we > have to continue to inline always-inline functions. for always-inline functions, if they are NOT static, I think that the option -finline-no-static should NOT inline them for help hot-patching purpose. > > That is, is it really "-fimplicit-inline-only-static"? Would > it make more sense to have a -fno-implicit-inline switch which > will not inline any function that is not declared inline? not quite understand this, why adding “implicit”? the new option -finline-no-static will control inlining of functions with or without “declared inline”. thanks. Qing > That might be already available via -fno-inline-small-functions > [-fno-inline-functions]. > > Richard.