开发者

Structure of COFF object files

I'm kinda having some issues with linking my assembly. I use NASM for assembly and then I link it with ld. One minor problem is that the GLOBAL directive only works if I define .data section which I believe has something reasonable to it, but still: how is that important for exporting symbols? (I decided to use coff since that was the most similar format with what came out from g++ with -c option).

开发者_运维技巧The major problem is, that even after I managed to link it, the calls lead to some address and the function is not there.

Thanks for your time reading and if you have some advice or maybe keywords I should google to get something about linking and symbols, that would be totally great.


I haven't used nasm on Windows, but from looking at the output of nasm -hf I'd guess you want the win32 format, not coff. The COFF format is an older object file format of which the PE-COFF (or just "PE") format now used on Windows is a newer version.

As for why you need to specify a SECTION before your GLOBAL directives takes effect, I'm not seeing that behavior. Is it possible you weren't declaring your GLOBAL prior to the label? Or possibly the symbol is being emitted, but was unable to provide correct linkage if e.g. it was intended as data variable but had space allocated in the .text section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜