lkml.org 
[lkml]   [2018]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: linux-next: Tree for Oct 31 (vboxguest)
On Sat, Nov 3, 2018 at 12:55 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On 11/2/18, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> > On Thu, Nov 1, 2018 at 11:32 PM Changbin Du <changbin.du@gmail.com> wrote:
> >> On Thu, Nov 01, 2018 at 12:32:48PM +0900, Masahiro Yamada wrote:
> >
> > How about clang?
> >
> > For clang, -Og might be equivalent to -O1 at this moment, but I am not
> > sure.
> >
> > In my understanding, Clang does not inline functions marked with 'static
> > inline'
> > for -Og (or -O1) optimization level.
> >
> > Theoretically, 'inline' keyword is a just hint for the compiler, after all.
>
> I think this means that we cannot build the kernel in that configuration,
> at least with CONFIG_OPTIMIZE_INLINING=y. Without that option,
> every 'inline' becomes 'always_inline'.
>

Sorry, I missed that fact.


At this moment of time, it is OK given the following:

- CONFIG_OPTIMIZE_INLINING is defined only for x86
- Clang cannot build x86 due to missing asm-goto


However, Clang with -Og
does not inline even such simple code like this:


-----test code------
static inline int foo(int x)
{
return x;
}

int bar(int x)
{
return foo(x);
}
-------------------



$ clang -Og -c -o bar.o bar.c
$ objdump -d bar.o
bar.o: file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <bar>:
0: eb 0e jmp 10 <foo>
2: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1)
9: 00 00 00
c: 0f 1f 40 00 nopl 0x0(%rax)

0000000000000010 <foo>:
10: 89 f8 mov %edi,%eax
12: c3 retq



--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2018-11-04 03:45    [W:0.091 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site