Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Free Pascal questions (Developers)

posted by marcov, 25.08.2008, 10:28

> Regarding UPXINFO I have a few questions about Free Pascal. Maybe Laaca or
> Marco could help me. :-)
>
> 1) How to generate a map file? "-Xm" produces no map file for me. Although
> no error is shown.

I'll look into it. That feature is newer than the renewed interest in the go32v2, so maybe it was never implemented.

However FPC allows for a lot of tweaking of the linker, e.g. passing GNU ld linker params using -k will get you there:

fpc -k"-Map mymapfile.map" helloworld

(works for me WITH the doscompiler, but under XP)

If you want to have an idea what happens under the hood, compile with -s and view the generated files (script.res ppas.bat link.res)

Note that I have never used a map file with FPC ever. I usually use -gl that will print full tracebacks with file-lineinfo on crashes. (which, if you recompile the RTL with -gl can go through the entire RTL)

It's different if you want to trace back bugreports with small bins though.

> 2) How to achieve minimum size of executables? I'm using "-O3 -Os -XX"
> now. Unfortunately FPC's help screen doesn't show default settings as TPC
> does.

-CX to compile units, -XX to compile/link the final file. The optimization stuff is really peanuts. (IIRC it works a bit better in the development versions because Florian wants to target embedded CPUs, AVR Atmel in the near future, but in the 2.2 series it is peanuts)

If you want to strip the result use -XXs, but some non Unix versions of ld do this badly, so there I usually strip with the provided separate strip.exe binary.

> 3) Is it possible to put all these options into my source code? For
> example documentation says "-XX" equals to "{$SMARTLINK}", but that seems
> to be wrong. Maybe "-CX" is meant?!

The original idea was -XX is "link smartlink" and -CX is "compile smartlink". This because you might not want to smartlink for speed in development builds, but don't want to recompile everything. (in the beginning both -CX and -XX were very slow. This was later sped up by eliminating AS).

Note that, like TP, most $'s are not global, but for the compiled unit (or mainprogram) only. So then you'd have to put them in an inc and include that anywhere.

> Also text-mode IDE (FP.EXE) doesn't
> insert all options, when I press Ctrl-O twice. :-|

Some of the newer functions were never finished. (e.g. there is no way to make code folds persistent), and a lot of infrastructure was never updated for them.

Please file a bug in mantis, preferably with a small note what you try and what you expect. While the IDE development is not die-hard, occasionally people single out a bug and fix it.

(you might want to try yourself even, since the IDE is just a (slightly big) FPC application.

I myself am thinking to try to add CHM support to the IDE. Or at least limited enough CHM to read the autogenerated FPC chm with the unit data. That would solve the 20000 files on disc issue.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 294 users online (0 registered, 294 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum