------- Comment #6 from acahalan at gmail dot com 2007-06-26 03:37 ------- (In reply to comment #5) > This is related to or really a dup of bug 4417.
It's only related, not a dup, though bug 4417 is sort of a subset. There appears to be no possible set of gcc options that will allow compiling non-trivial programs with -fwhole-program --combine. With or without the -ffreestanding option, gcc will leave undefined references to various string.h things. It does not matter if the program provides these functions in *.c files. With -ffreestanding, gcc ought to avoid using memcpy. Without, gcc ought to call the one I'm providing. (both should work; neither one does) Right now neither works, making -fwhole-program --combine 100% useless. Alternately, the documentation is not correct, and the user can indeed link with other things. (if I supply memcpy via some other binary file, then I am NOT supplying the "whole program" to the compiler and am thus violating the rules -- perhaps "whole program" needs a very detailed definition regarding *.S files, system headers, libgcc.a, libgcc.so, libc.so, and so on) According to the documentation, a command line with "--combine foo.c bar.c baz.S" would invoke the C front end on foo.c and bar.c only; they thus become the compilation unit. Adding -fwhole-program adds the requirement that the current compilation unit (foo.c and bar.c) be the whole program, thereby excluding baz.h from being part of the program. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29171