After some trail and error as well as reading up how static binaries work and the difference between gcrt0 and gcrt1, I was able to fix the profiling bug with a GCC spec file:

%rename startfile old_startfile

*startfile: %{!shared: %{!static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} 
%{!p:crt1.o%s}}} %{static: %{pg:gcrt0.o%s} %{!pg:{%p:gcrt0}} %{!p:crt0.o%s}}} 
crti.o%s %{static:crtbeginT.o%s} %{!static:%{!shared:crtbegin.o%s} 
%{shared:crtbeginS.o%s}}

For those of you who know how Hurd handles statically linked binaries, you'll probably find it weird that we only link against gcrt0. The reason behind that is that the profiling code in GCC only works against static binaries; it doesn't support shared binaries. This is my first time ever messing around with GCC (or writing a spec file) so I'd be intersted in hearing some feedback. I already figured out howto change GCCs internal specs file to include this change, but I wanted to hear from the experts before I submit a patch.
Michael


_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd

Reply via email to