------- Comment #7 from wilson at gcc dot gnu dot org 2005-11-09 01:45 ------- I see the problem now. It is present in the FSF gcc-3.4.x sources.
The problem is that init_gcc_specs in gcc.c rewrites the LIBGCC_SPEC rule. It looks for the first -lgcc, and replaces it with target independent rules for shared and static libgcc. The config/ia64/hpux.h file redefines LIBGCC_SPEC as #define LIBGCC_SPEC \ "%{shared-libgcc:%{!mlp64:-lgcc_s}%{mlp64:-lgcc_s_hpux64} -lgcc} \ %{!shared-libgcc:-lgcc}" So after the substitution, we now have %{shared-libgcc ... %{static-libgcc ...}} which is obviously wrong. If the config/ia64/hpux.h file is changed to look something like #define LIBGCC_SPEC \ "%{shared-libgcc:%{!mlp64:-lgcc_s}%{mlp64:-lgcc_s_hpux64}} -lgcc" then it will work much better. I think this can be simplified further without loss of functionality to #define LIBGCC_SPEC \ "%{shared-libgcc:%{mlp64:-lgcc_s_hpux64}} -lgcc" The important part here is that -lgcc must not appear inside any braces, because it will be substituted by init_gcc_specs. Alternatively, we could try disabling the init_gcc_specs rewriting for the ia64-hpux target, and then putting the entire rule we want in the config/ia64/hpux.h file, but I don't think that big of a patch is needed. A better alternative would be deleting the LIBGCC_SPEC rule in config/ia64/hpux.h, but I don't know if that will work. That might result in the libgcc_s_hpux64 file not being used anymore. I also don't know whether that matters. I would guess that the multilibbing support should find and use it automatically, so in theory it shouldn't be needed, but I am unable to check. gcc-4.0 and later do not have a problem, because they don't define LIBGCC_SPEC in the config/ia64/hpux.h file. I can't test the suggested patches, as I don't have an ia64-hpux machine. -- wilson at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2005-11-09 01:45:26 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24718