Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-07

New switch -Oa for 1.1 compiler

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Vreman

The 1.1 compiler has a new switch -Oa. It is used for setting the alignment used by the compiler for code and data.

Example:

-Oaproc=32 Alignment of procedures on 32 bytes boundary -Oavarmin=4,varmax=16 Alignment of global/static variables is at least on 4 bytes, but at maximum of 16 bytes. This will result in an int64 be aligned at 8 bytes and a longint at 4 bytes and sets (32bytes) are aligned at the maximum of 16 bytes.

Thomas Schatzl
to Peter Vreman

Hi,

Show quoted text 9 lines
The 1.1 compiler has a new switch -Oa. It is used for setting the alignment used by the compiler for code and data. Example: -Oaproc=32 Alignment of procedures on 32 bytes boundary -Oavarmin=4,varmax=16 Alignment of global/static variables is at least on 4 bytes, but at maximum of 16 bytes. This will result in an int64 be aligned at 8 bytes and a longint at 4 bytes and sets (32bytes) are aligned at the maximum of 16 bytes.

Does the linking process take care of these settings ? E.g. are the different object files which are linked together aligned to this max alignment as well ? Else the object files get glued together by ld at 4 bytes boundaries whatever your variable alignment within these object files was...
What about strings, ansistrings arrays and record types ? Maybe these settings could be set to some default values in accordance to the processor type specified (-OpX) to simplify usage a little ?

Greetings,
Thomas

Peter Vreman
to Thomas Schatzl
you wrote 17 lines
Hi, > The 1.1 compiler has a new switch -Oa. It is used for setting the > alignment used by the compiler for code and data. > Example: > > -Oaproc=32 Alignment of procedures on 32 bytes boundary > -Oavarmin=4,varmax=16 Alignment of global/static variables is at least > on 4 bytes, but at maximum of 16 bytes. This will result in an int64 be > aligned at 8 bytes and a longint at 4 bytes and sets (32bytes) are aligned > at the maximum of 16 bytes. Does the linking process take care of these settings ? E.g. are the different object files which are linked together aligned to this max alignment as well ? Else the object files get glued together by ld at 4 bytes boundaries whatever your variable alignment within these object files was...

For go32v2 we use our own linkerscript that has the correct alignments.

What about strings, ansistrings arrays and record types ? Maybe these settings could be set to some default values in accordance to the processor type specified (-OpX) to simplify usage a little ?

That's is correct, it is a possible extension that can be made. I made the code with keeping that in mind. But i don't know the best values so i didn't code it yet. But it should be easy to add to the compiler for somebody else.

Peter