LTO & top-level ASM
Martin Liška
mliska@suse.cz
Mon Mar 24 13:26:00 GMT 2014
Hello,
I've been solving undefined symbols related to:
http://gcc.gnu.org/PR57703. In chromium there's a following inline asm:
asm(".type Syscall, @function\n" ...);
intptr_t SandboxSyscall(...)
{
asm volatile("call SyscallAsm");
}
Where call of SandboxSyscall is inlined in couple of functions. Our
problem is that top-level asm is streamed to the first ltrans and so
that undefined symbol is reached:
/tmp/cc9oZmpM.ltrans26.ltrans.o:cc9oZmpM.ltrans26.o:function
sandbox::Die::ExitGroup(): error: undefined reference to 'SyscallAsm'
There's couple of fixes which can be done:
1) add to build system -fno-lto option for the TU; not easy due to
chrome's usage of ninja/gyp build system
2) if a compiler sees top-level asm, -flto can be disabled. I was given
a segfault after I set lto flag to false. Probably there's something
that relies on the flag
3) put all functions with inline asm to the same partition as top-level
asm. There are many functions in chrome having inline asm (proto bufs),
so that the first partition is very big
4) I tried to promote a new flag (top_level_asm) that is used to
decorate SandboxSyscall. Method works, but I'm not sure if pleasant for
chromium developers? Patch for this solution is attached.
Thank you for any ideas,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: top-level-hack.patch
Type: text/x-patch
Size: 6488 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20140324/041cc46b/attachment.bin>
More information about the Gcc
mailing list