Message ID | yddfvy2l9xa.fsf@CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
I still have no idea from your answer how a user is meant to know whether to use the option when compiling, linking or both, which is what needs to be clear from invoke.texi. What does it mean for the option to be supported for compiling but not linking? What in that case will the linker do with compressed debug sections on input? Combine them in some way, good or bad? Uncompress them? Likewise, for it to be supported for linking but not compiling? Will the linker then compress the uncompressed sections it receives on input? I think it would be better if the option semantics are more like "if you pass the same option when both compiling and linking, the linked output will have the sections appropriately compressed as specified by the option, whether or not the individual .o files do" - and if this can't be supported with the tools being used, don't allow the option.
Hi Joseph, > I still have no idea from your answer how a user is meant to know whether > to use the option when compiling, linking or both, which is what needs to > be clear from invoke.texi. > > What does it mean for the option to be supported for compiling but not > linking? What in that case will the linker do with compressed debug > sections on input? Combine them in some way, good or bad? Uncompress > them? a linker that doesn't understand compressed debug sections will probably combine them in a useless way. If, like gld, it can read but not write them, they will be written in uncompressed form. > Likewise, for it to be supported for linking but not compiling? Will the > linker then compress the uncompressed sections it receives on input? Yes, that will work in all cases. > I think it would be better if the option semantics are more like "if you > pass the same option when both compiling and linking, the linked output > will have the sections appropriately compressed as specified by the > option, whether or not the individual .o files do" - and if this can't be > supported with the tools being used, don't allow the option. That's certainly an option, as in the following table (taking the zlib-gnu format as an example, but omitting hypothetical linkers that can write but not read compressed debug sections): assembler linker action example w r w - - - reject as/ld - x - reject, useless as/gld - x x ok, warn about no-op as -gz? as/gold x - - reject, harmful gas/ld x x - reject, useless gas/gld x x x ok gas/gold The only problem I see is that for an assembler not supporting compression -gz would be a silent no-op. I'd rather warn about this instead, but still accept it so you can both compile and link with -gz. Rainer
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -171,7 +171,8 @@ extern GTY(()) int darwin_ms_struct; LINK_PLUGIN_SPEC \ "%{flto*:%<fcompare-debug*} \ %{flto*} \ - %l %X %{s} %{t} %{Z} %{u*} \ + %l " LINK_COMPRESS_DEBUG_SPEC \ + "%X %{s} %{t} %{Z} %{u*} \ %{e*} %{r} \ %{o*}%{!o:-o a.out} \ %{!nostdlib:%{!nostartfiles:%S}} \ diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -80,7 +80,8 @@ along with GCC; see the file COPYING3. #undef LINK_COMMAND_SPEC #define LINK_COMMAND_SPEC \ "%{!fsyntax-only: \ -%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{e*} %{N} %{n} \ +%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l " LINK_COMPRESS_DEBUG_SPEC \ +"%X %{o*} %{e*} %{N} %{n} \ \t%{r} %{s} %{t} %{u*} %{z} %{Z}\ \t%{!nostdlib:%{!nostartfiles:%S}}\ \t%{static:} %{L*} %D %o\