[fpc-devel] A Compiled file size solution from the GBD mailing-list

Peter Vreman peter at freepascal.org
Thu Jan 17 10:54:13 CET 2008

>> Support for a separate .dbg file is now available for windows in
>> current svn trunk with the -Xg option. No need anymore for "objcopy
>> --only-keep-debug && objcopy --add-debug-link && strip" under
>> windows. The external linker (e.g. linux) still be updated to support
>> objcopy and strip when -Xg is passed.
> I have just try on Windows with objcopy (I have ownloaded it from the
> mingw binutils binaries) and works like a charm.
> The -Xg flag do not works. GDB tell me: "not found symbols".
> PS: why do not add objcopy to the FPC bin folder?

Did you include the -g flag to generate debuginfo? The -Xg is a linker only option that does not
influence generation of code or debuginfo. On an other system than the development system it is
also working fine.

For windows we don't want to call external tools by default. The binutils are very slow under
windows resulting in complains about slow compilation times which are infact linking times. That
is also the reason why windows has already an internal linker.

PVreman at NL-L3DA451 /fpc/compiler
$ ppc386 p -Xg -g
Free Pascal Compiler version 2.3.1-r9226 [2008/01/17] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling p.pp
Linking p.exe
3 lines compiled, 0.1 sec, 23408 bytes code, 1040 bytes data

PVreman at NL-L3DA451 /fpc/compiler
$ ls -l p.dbg p.exe
-rwx------+ 1 PVreman ???????? 20960 Jan 17 10:48 p.dbg
-rwx------+ 1 PVreman ???????? 28191 Jan 17 10:48 p.exe

PVreman at NL-L3DA451 /fpc/compiler
$ gdb p.exe
GNU gdb (cygwin-special)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) l
1       begin
2         writeln('hello');
3       end.
(gdb) q

More information about the fpc-devel mailing list