Created attachment 4261 [details] source used to create crt code in eglibc -fno-toplevel-reorder option is used with by eglibc library (libc/csu) to generate init/fini code for ctr*. > llvm-gcc initfini.c -c -std=gnu99 -fgnu89-inline -O0 -Wall -Winline -Wwrite-strings -fmerge-all-constants -Wstrict-prototypes -mpreferred-stack-boundary=4 -DHAVE_INITFINI -S -g0 -fPIC -fno-inline-functions -fno-toplevel-reorder -fno-section-anchors -finhibit-size-directive -fno-exceptions -o initfini.s C source file comes with inlined asm having 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 separately in AsmPrinter::doInitialization, and after it outputs all functions. Which results in eglibc fail to build with llvm. 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*/");
We do not support this flag, and I really doubt this will happen one day.
Right, this flag is deprecated by GCC and we have no intention of implementing it. The code should be fixed to not depend on it.
Are there existing patches for glibc/eglibc for llvm? BTW. Are there any technical issues to support option? (In reply to comment #2) > Right, this flag is deprecated by GCC and we have no intention of implementing > it. The code should be fixed to not depend on it.
I don't know if there are patches, there are many technical reasons to not support this. We don't track the order of inline asm vs functions. Adding it would be significant implementation effort for an option that is deprecated (and never really made sense).
Thanks for your answer, Chris. Ok, option support seems to be unlikely. But I don't think I'm the first one facing issues with C libraries build. Haven't found info on the web yet. Is there any support person for that? Or appropriate topic to discuss?
I don't really know, but you can definitely email llvmdev and ask if others have any idea
Wouldn't simple saving of initial lexical order in parser be enough to reorder inlined top level asm to output correctly? I've contacted eglibc maintainers and got the following answer. Seems they expect this option to be supported by compilers: 2010/2/22 Joseph S. Myers <joseph@codesourcery.com>: > On Mon, 22 Feb 2010, Sergey Yakoushkin wrote: > >> This option might become deprecated in gcc (~v 4.6), > > That seems an *extremely* unlikely speculation. What actual evidence from > GCC development discussions do you have for it? I think someone has got > confused by some old discussions of -fno-toplevel-reorder as the > replacement for deprecated -fno-unit-at-a-time into thinking it's > -fno-toplevel-reorder that's deprecated; it's not and is hardly likely to > be. > > -- > Joseph S. Myers > joseph@codesourcery.com >
*** Bug 27688 has been marked as a duplicate of this bug. ***