Sign in Join

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

Mailing lists / fpc-devel / 2005-07

About Linker

17 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

listmember

I know very little about Linker --just vaguely what it does, and that's all. I googled for it, but could not find much either.

Could someone give me some pointers to read about the subject.

The reason why I was interested is, it seems a Linker is more difficult to write than a compiler --after all we do have FPC, but not a linker in Pascal.

Is it true that a linker is harder to write? If not, why hasn't anyone done one yet?

TVMIA

Reply by email

Florian Klaempfl
to listmember
listmember wrote 12 lines
I know very little about Linker --just vaguely what it does, and that's all. I googled for it, but could not find much either. Could someone give me some pointers to read about the subject. The reason why I was interested is, it seems a Linker is more difficult to write than a compiler --after all we do have FPC, but not a linker in Pascal. Is it true that a linker is harder to write?

No.

If not, why hasn't anyone done one yet?

Other things were important so far?

Reply by email

Peter Vreman
to Florian Klaempfl
Show quoted text 8 lines
listmember wrote: > I know very little about Linker --just vaguely what it > does, and that's all. I googled for it, but could not > find much either. > > Could someone give me some pointers to read about the > subject.

Ever heard Google? The second result with a search for 'linker' has a lot of information.

Show quoted text 7 lines
> The reason why I was interested is, it seems a Linker > is more difficult to write than a compiler --after all > we do have FPC, but not a linker in Pascal. > > Is it true that a linker is harder to write? No.

A linker is much easier than a compiler. The hardest part is the analysing of bugs, because you need to debug the generated result and debug that at assembly level.

> If not, > why hasn't anyone done one yet? Other things were important so far?

There is already a start of a linker, but there was no time to finish it. We first wanted release a stable compiler.

Reply by email

listmember
to Peter Vreman
Peter Vreman wrote 5 lines
>> Could someone give me some pointers to read about the >> subject. Ever heard Google? The second result with a search for 'linker' has a lot of information.

Peter,

That was harsh. I did of course google. But, from
the links, I did not get much digestable info.

The second link for 'linker' on Google is this.

http://enproject.codelib.co.kr/

How is it relevant?....

You see, if you know little about a subject, there's little chance you can locate useful information...

That is why I asked here.

Show quoted text 10 lines
>> The reason why I was interested is, it seems a Linker >> is more difficult to write than a compiler --after all >> we do have FPC, but not a linker in Pascal. >> >> Is it true that a linker is harder to write? > No. A linker is much easier than a compiler. The hardest part is the analysing of bugs, because you need to debug the generated result and debug that at assembly level.

Pardon my ignorance, but why does it have to be debugged at assembler level?

Show quoted text 5 lines
>> If not, why hasn't anyone done one yet? > Other things were important so far? There is already a start of a linker, but there was no time to finish it. We first wanted release a stable compiler.

Any links to it?

Thank you for your time.

Cheers,
Ray

Reply by email

Peter Vreman
to listmember
Show quoted text 20 lines
Peter Vreman wrote: >>> Could someone give me some pointers to read about the >>> subject. > > Ever heard Google? The second result with a search for 'linker' has > a lot of information. Peter, That was harsh. I did of course google. But, from the links, I did not get much digestable info. The second link for 'linker' on Google is this. http://enproject.codelib.co.kr/ How is it relevant?.... You see, if you know little about a subject, there's little chance you can locate useful information...

Below is my google output. So you can see that the linkers and loaders is the second one.

Het Internet Resultaten 1 - 10 van circa 4.470.000 voor linker (0,33 seconden)

Gesponsorde Koppelingen
Linker
Alles over Linker.
Registreer op eBay.nl nu!
eBay.nl

Linker.ch - Das Schweizer Portal - direkt zum guten Link Linker.ch - Das Schweizer Portal mit den besten Links im deutschsprachigen Raum ( Linksammlung )
www.linker.ch/ - 2k - In cache - Gelijkwaardige pagina's

Linkers and Loaders
You don't need to tell me I'ma lousy artist. I already know that. Please send comments and questions to Thanks! ...
www.iecc.com/linker/ - 8k - 18 juli 2005 - In cache - Gelijkwaardige pagina's

Reply by email

Florian Klaempfl
to Okulov: add some const and base2power func my change marks with //==Okulov==start ...my changes...
Okulov wrote
add some const

The constants are too unprecise (float is actually an extended).

and base2power func

Is this really useful? I mean when I see
code like
i:=base2power(j);
i:=1 shl j;
I understand quicker what is meant in the second case :)

Show quoted text 11 lines
my change marks with //==Okulov==start ...my changes... //==Okulov==stop ------------------------------------------------------------------------ _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Okulov
to Florian Klaempfl
Florian Klaempfl wrote 12 lines
Okulov wrote: >add some const > > The constants are too unprecise (float is actually an extended). >(float is actually an extended)

Ok. You can change it to single

PI consists more than 200 items, but we use only 9 of them isn't it, and if you are using a cycle for example in OpenGL render (like me) it's cool speed up!

Show quoted text 13 lines
>and base2power func > > Is this really useful? I mean when I see code like i:=base2power(j); i:=1 shl j; I understand quicker what is meant in the second case :)

Ofcource you understand... but some people can use it.

Anyway if you don't wish to insert it, it is not necessary. My business is to offer =)

Reply by email

L505
to Florian Klaempfl: The constants are too unprecise (float is actually an extended). Is this really useful? I…

| > and base2power func
|

If you know how to write it, you can put this function in an external unit of your own.. doesn't have to be in the original unit, if others don't want it there. I use an IP address converter function when using sockets that isn't in the sockets.pp, which is just a wrapper around shl. Handy in this situation, because Copy and Pasting ip addresses is not easy when you always have to convert to shl.

Reply by email

Marco van de Voort
to L505
Show quoted text 9 lines
| > and base2power func | If you know how to write it, you can put this function in an external unit of your own.. doesn't have to be in the original unit, if others don't want it there. I use an IP address converter function when using sockets that isn't in the sockets.pp, which is just a wrapper around shl. Handy in this situation, because Copy and Pasting ip addresses is not easy when you always have to convert to shl.

In 2.0 afaik there are routines to convert IPs in string form to a value, in an endian correct way. htons and strtoaddr or so.

Reply by email

Marco van de Voort
to Gerhard Scholz
Show quoted text 6 lines
I found out that for operators which are declared to be inline and have asm code inside the inlining option is ignored (I assume the same would be true for procs/funcs). Is that intentional? Does it have a reason? Would be great if that could be stopped.

Yes - needs complex parsing to determine if the asm is dangerous (e.g. EBP usage) - enhanced support not expect anytime soon due to complexity

Reply by email

Jonas Maebe
to Gerhard Scholz: I found out that for operators which are declared to be inline and have asm code inside…
Gerhard Scholz wrote 7 lines
I found out that for operators which are declared to be inline and have asm code inside the inlining option is ignored (I assume the same would be true for procs/funcs). Is that intentional? Does it have a reason?

Yes, inlining assembler is much harder than inlining Pascal code (and even harder to do it efficiently).

Jonas

Reply by email

Gerhard Scholz
to Marco van de Voort: Yes - needs complex parsing to determine if the asm is dangerous (e.g. EBP usage) -…

I would suggest an "experimental" solution {$inline unsafe ?} which does the inline without checks, and maybe gives a warning at compiletime: Warning: inlined func/proc might be unsafe.

Could save some code and some exection time.

I do not understand the argument with e.g. EBP usage. I would say this is dangerous in not inlined code also, isn't it?

Gerhard

Earlier message 17 lines
-----Ursprüngliche Nachricht----- Von: "Marco van de Voort" An: "FPC developers' list" Gesendet: Montag, 1. August 2005 22:18 Betreff: Re: [fpc-devel] inline and asm code > > I found out that for operators which are declared to be inline and have asm code > > inside the inlining option is ignored (I assume the same would be true for > > procs/funcs). > > > > Is that intentional? Does it have a reason? Would be great if that could be > > stopped. > > Yes - needs complex parsing to determine if the asm is dangerous (e.g. EBP > usage) - enhanced support not expect anytime soon due to complexity

Reply by email

Marco van de Voort
to Gerhard Scholz
I would suggest an "experimental" solution {$inline unsafe ?} which does the inline without checks, and maybe gives a warning at compiletime: Warning: inlined func/proc might be unsafe.

The used registers still have to be known. For pascal code this is info that is gained during the compilation. For asm this is afaik not kept.

However if sb would work on this and submit a patch (scanning assembler blocks to build a register use), it would probably help.

Could save some code and some exection time. I do not understand the argument with e.g. EBP usage. I would say this is dangerous in not inlined code also, isn't it?
procedure x(a:integer);assembler; stdcall;

asm
movl 8(%ebp),%eax
end;

Will load parameter in eax. However when inlined it will fail.

Reply by email

Peter Vreman
to Marco van de Voort
you wrote 23 lines
> I would suggest an "experimental" solution {$inline unsafe ?} which does the > inline without checks, and maybe gives a warning at compiletime: Warning: > inlined func/proc might be unsafe. The used registers still have to be known. For pascal code this is info that is gained during the compilation. For asm this is afaik not kept. However if sb would work on this and submit a patch (scanning assembler blocks to build a register use), it would probably help. > Could save some code and some exection time. > > I do not understand the argument with e.g. EBP usage. I would say this is > dangerous in not inlined code also, isn't it? procedure x(a:integer);assembler; stdcall; asm movl 8(%ebp),%eax end; Will load parameter in eax. However when inlined it will fail.

Also a lot of assembler procedures (coming from delphi) expect the parameters in specific registers. The compiler then firsts needs to load the values in these registers like the register calling convention describes. The result is in a lot of cases not what was expected and it makes the compiler a lot more complex regarding inlining. So for now the inlining of assembler code is disabled to keep the code in the compiler simple. Also note that this behaviour is compatible with delphi 2005.

Peter

Reply by email