[LLVMdev] how to build eglibc using llvm-gcc without unsupported -fno-toplevel-reorder

Sergey Yakoushkin sergey.yakoushkin at gmail.com
Sun Feb 21 13:21:48 PST 2010


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>


More information about the llvm-dev mailing list