tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Trivial program size inflation



On Wed, 5 Jul 2023, Emmanuel Dreyfus wrote:

It is documented somewhere? Last time I tried to use it, I
had to make a static build.


If you mean the .spec file syntax, then yes:

https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html

As for the patch itself, I'm travelling at present, so I don't have my NetBSD
laptop with the compiler-patch and notes I made last year. So, what I've done
is attach a hacked-up .spec file which allows `-pg' with shared libs. It
should be fairly easy to see to what changes to make back to the compiler
sources to make this permanent.

Since, I've only NetBSD on QEMU right now (and a full toolchain compile is
ruddy slow), I haven't done this, but, `gcc -specs=gcc-pg.spec ...' works as
it does on Linux (a gmon.out is produced with _only_ the functions from the
executable--none from the shared libs--which is how I want it anyway). Only
lightly tested. Tell me if there are any problems (apart from `-pie -fPIE'
which doesn't work with `-static -pg' in any case).

-RVP
--- gcc-std.spec	2023-07-05 21:45:17.067947887 +0000
+++ gcc-pg.spec	2023-07-05 21:49:25.062647745 +0000
@@ -53,7 +53,7 @@
 %{!static|static-pie:--eh-frame-hdr} %{m32:-m elf_i386}    %{m64:-m elf_x86_64}    %(netbsd_link_spec)
 
 *lib:
-%{pthread:			     %{!p:			       %{!pg:-lpthread}}	     %{p:-lpthread_p}		     %{pg:-lpthread_p}}		   %{posix:			     %{!p:			       %{!pg:-lposix}}		     %{p:-lposix_p}		     %{pg:-lposix_p}}		   %{shared:			     %{!p:			       %{!pg:-lc}}		     %{p:-lc_p}			       %{pg:-lc_p}}		   %{!shared:			     %{!symbolic:		       %{!p:				 %{!pg:-lc}}		       %{p:-lc_p}		       %{pg:-lc_p}}}
+%{pthread:			     %{!p:			       %{!pg:-lpthread}}	     %{p:-lpthread_p}		     %{pg:-lpthread}}		   %{posix:			     %{!p:			       %{!pg:-lposix}}		     %{p:-lposix_p}		     %{pg:-lposix}}		   %{shared:			     %{!p:			       %{!pg:-lc}}		     %{p:-lc_p}			       %{pg:-lc}}		   %{!shared:			     %{!symbolic:		       %{!p:				 %{!pg:-lc}}		       %{p:-lc_p}		       %{pg:-lc}}}
 
 *link_gomp:
 


Home | Main Index | Thread Index | Old Index