Linking with target Z80

Arnold Metselaar arnold.metselaar@planet.nl
Sat Oct 3 20:25:00 GMT 2009


Op woensdag 30 september 2009, schreef Chris Smith:
> I'm having trouble using ld to link assembled Z80 files.
>
> Attached is a small test suite which assembles and links two
> files into a static library, and a third file which it assembles
> and tries to link to the library.
>
> At the moment it wont link. I have even tried supplying the three
> .o's with ld, instead of the lib, and that fails too. I'm looking
> to get a z80-coff format out, so I can use objdump/objcopy to get
> what I need.
>
> I think I may have got this to almost work once, but it linked
> the entire library and not the bits it required, wasting precious
> space. I don't know how I did it though.
>
> I'm not new to binutils, which is why I'm going crazy ;-)
>
> Am I approaching this incorrectly, or is z80-ld borked?
>
> Many thanks.
> Chris

Hello Chris,

Your test case fails because z80-as treats labels in assembly as 
local symbols by default. To make a symbol available for use in 
other files you must explicitly make it global with the .global 
directive as in the attached patch for your test case.

Kind regards,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: z80ldtest.diff
Type: text/x-diff
Size: 591 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20091003/874e6328/attachment.bin>


More information about the Binutils mailing list