Sergey Yakoushkin
2010-Feb-21 21:21 UTC
[LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
Hi, Are there any existing patches (or instructions) for eglibc(may be glibc/uclibc) to build it correctly with llvm-gcc? Could you please point to them? I'm cross-compiling eglibc for new processor using llvm-gcc. Build passes, but creates mis-optimized crt* files due to lack of -fno-toplevel-reorder support. Seems there are reasons to skip support of this option in llvm. http://www.llvm.org/bugs/show_bug.cgi?id=6364 Particular issue is with libc/sysdeps/generic/initfini.c file which contains inlined asm with special markup. C is compiled into asm and then gawk is used to strip different parts for different crt* files. However, llvm outputs all top level inlined asm first, and only after it outputs code for functions. As result gawk strips wrong parts into crt*.s. Exmple initfini.c fragment: asm (".section " ".init" ); extern void __attribute__ ((section (".init"))) _init (void); void _init (void) { call_gmon_start (); asm ("ALIGN"); asm("END_INIT"); asm ("\n/*@_init_PROLOG_ENDS*/"); asm ("\n/*@_init_EPILOG_BEGINS*/"); asm (".section " ".init" ); } asm ("END_INIT"); asm ("\n/*@_init_EPILOG_ENDS*/"); asm ("\n/*@_fini_PROLOG_BEGINS*/"); Regards, Sergey Yakoushkin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100222/552a9021/attachment.html>
Rafael Espindola
2010-Feb-21 21:29 UTC
[LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
I haven't looked at the code, but why can't you split the .c files into multiple files instead of splitting the generated asm? Not running gawk on produced assembly should be a nice cleanup anyway. Cheers, -- Rafael Ávila de Espíndola
Sergey Yakoushkin
2010-Feb-21 21:36 UTC
[LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
Hi, Rafael Inlined asm markup inside functions and on the top level is used to split asm prologue/epilogue parts in very fine-grained manner. So, splitting source c won't give the same result. Regards, Sergey Y. 2010/2/22 Rafael Espindola <espindola at google.com> I haven't looked at the code, but why can't you split the .c files> into multiple files instead of splitting the generated asm? Not > running gawk on produced assembly should be a nice cleanup anyway. > > Cheers, > -- > Rafael Ávila de Espíndola >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100222/6a994a74/attachment.html>
Török Edwin
2010-Feb-21 21:50 UTC
[LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
On 2010-02-21 23:36, Sergey Yakoushkin wrote:> Hi, Rafael > > Inlined asm markup inside functions and on the top level is used to > split asm prologue/epilogue parts in very fine-grained manner. > So, splitting source c won't give the same result.You could have 2 files: - 1 which contains the function, and a marker where prolog ends (beginning of file is implicit marker of where it begins) - 1 which contains the function, and a marker where epilog begins (end of file is implicit marker of where it ends) Or just look at ./sysdeps/x86_64/elf/initfini.c, its a single asm() block containing all relevant markers, and no C code. I think thats better than all these hacks to get the asm you want out of C code. Best regards, --Edwin
Reasonably Related Threads
- [LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
- [LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
- [LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
- [LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder
- [LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder