Is it better to use polink instead of link.exe ?
If so, can I substitute it for link in my batch files ?
Thanks.
Hi Andy,
Quote from: Magnum on April 28, 2013, 12:22:12 AM
Is it better to use polink instead of link.exe ?
If so, can I substitute it for link in my batch files ?
Thanks.
I think that both linkers are quiet good. If you're programming with ml why not use the native linker? During my first attempts with ml 5 (or so) in the 80s I've had some difficulties with the MS linker, because it did generate false addresses in COM files. I had to patch in the right addresses by hand with the hex tool of the Norton Commander. I've solved that question by using TASM and TLINK. But these times are over, I guess.
Gunther
Hi Magnum,
QuoteIf so, can I substitute it for link in my batch files ?
Yes, you can. Polink is a powerful linker.
Quote from: Vortex on April 28, 2013, 02:55:31 AM
QuoteIf so, can I substitute it for link in my batch files ?
Yes, you can.
You can ... usually. However, if debug info is to be generated (-Zi), you should be aware that polink won't understand the info if Masm v8 or newer has been used. Also, the debug info written by polink might not be comprehensible for MS Visual C or WinDbg. OTOH, if you want to use the debugger integrated into POIDE, using polink is virtually a must.
Thanks guys for the info.
Andy
i wouldn't say PoLink is "better", just different
it can generate smaller files with the normal switches
however, MS Link is a very good tool, perhaps more versatile, more options
it can generate smaller files as well, by combining sections, etc
I would like to stick with link.
How do I combine sections ?
OFF TOPIC subject Carbs
I am rusty with carbeurators.
I found gas in the bottom of the air filter holder for a sears mower.
Took the fuel bowl off.
I think I need to adjust the float but the float is plastic with no adjustment tab.
In the old days, I think the "tang" could be adjusted.
I want to adjust the needle so it makes contact sooner to stop the gas flow.
Any other way to adjust it ?
Thanks.
here are a few LINK lines i was playing with...
Link /SUBSYSTEM:CONSOLE /OPT:NOREF /MERGE:.data=.text /ALIGN:4 %1.obj
Link /SUBSYSTEM:CONSOLE /OPT:NOREF /MERGE:.data=.text /ALIGN:16 %1.obj
Link /SUBSYSTEM:CONSOLE /OPT:NOREF /MERGE:.data=.text %1.obj
you may have to use different alignment, depending on your code
for example, some SSE data needs to be 16-aligned
This results in a better than 1000 byte savings if the data section is eliminated.
It looks like the minimum size that is allocated is 1024 byte chunks.
I guess it would only be useful if all you had was text.
start:
jmp next
string db "Now is the time.",0
next:
there are other kinds of constant data, like look-up tables, etc, too
but, there may be some side-effects in the way data and code are cached
Hi Magnum,
I use polink since 8 years and I didn't have any serious problem.
Today I stumbled into an odd behaviour of polink:
ORG $+BufLen-1
; db ?
Without the db ?, data was overwritten. MS link doesn't do that...
However, I haven't been able to isolate this behaviour - the snippet below works.
include \masm32\include\masm32rt.inc
crtbuf MACRO var, BufLen, msAlign:=<4> ; cb pBuffer, 1000 [, 16]
LOCAL cblabel
.data?
align msAlign
cblabel LABEL BYTE
var equ offset cblabel
ORG $+BufLen-1
; db ?
.code
ENDM
.data?
somevalue dd ?
.code
start: crtbuf buffer, 80
mov eax, offset buffer
int 3
invoke lstrcpy, offset buffer, chr$("This is a text that is exactly 44 bytes long")
print offset buffer, 13, 10
mov somevalue, "tihs" ; no effect
print offset buffer, 13, 10
exit
end start
Quote from: jj2007 on August 20, 2013, 08:29:34 AM
Today I stumbled into an odd behaviour of polink:
ORG $+BufLen-1
; db ?
Without the db ?, data was overwritten. MS link doesn't do that...
However, I haven't been able to isolate this behaviour - the snippet below works.
How much data was overwritten in the case when this behaviour showed itself?
BTW, why ORG $+BufLen-1, not ORG $+BufLen? May not it be a reason?
Quote from: Antariy on August 20, 2013, 10:41:56 AM
How much data was overwritten in the case when this behaviour showed itself?
Quite a lot, as if polink had decided to merge a segment, ignoring the ORG.
QuoteBTW, why ORG $+BufLen-1, not ORG $+BufLen? May not it be a reason?
It was actually ORG $+BufLen. The "-" was added for the extra db ?
Will try tomorrow if I find my test case on the other puter.
Quote from: jj2007 on August 20, 2013, 12:04:15 PM
QuoteBTW, why ORG $+BufLen-1, not ORG $+BufLen? May not it be a reason?
It was actually ORG $+BufLen. The "-" was added for the extra db ?
Ah, it's clear now.
Quote from: jj2007 on August 20, 2013, 12:04:15 PM
Will try tomorrow if I find my test case on the other puter.
It seems I get - you need to define "somevalue"
after you defined a buffer. I.e. like this:
.code
start: crtbuf buffer, 80
mov eax, offset buffer
.data?
somevalue dd ?
.code
int 3
invoke lstrcpy, offset buffer, chr$("This is a text that is exactly 44 bytes long")
print offset buffer, 13, 10
mov somevalue, "tihs" ; no effect
print offset buffer, 13, 10
exit
end start
Will check it now.
No, I did not reproduce that effect, even tried to place it here:
int 3
invoke lstrcpy, offset buffer, chr$("This is a text that is exactly 44 bytes long")
.data?
somevalue dd ?
.code