Supporting Dynamic Linking

Robbert Haarman <comp.lang.misc@inglorion.net>
Sun, 21 Nov 2010 18:37:22 +0100

          From comp.compilers

Related articles
Supporting Dynamic Linking comp.lang.misc@inglorion.net (Robbert Haarman) (2010-11-21)
Re: Supporting Dynamic Linking ian@airs.com (Ian Lance Taylor) (2010-11-22)
| List of all articles for this month |

From: Robbert Haarman <comp.lang.misc@inglorion.net>
Newsgroups: comp.compilers,comp.lang.misc
Date: Sun, 21 Nov 2010 18:37:22 +0100
Organization: Wanadoo
Keywords: code, linker, question
Posted-Date: 21 Nov 2010 23:06:30 EST

Hi everyone!


One of the features I am currently working on for Voodoo is making
currently being worked on is making the Voodoo compiler emit code
suitable for use in dynamic libraries. The main impediment here is that
the linker likes to know the size of objects in a dynamic library, but
Voodoo does not currently provide this information. For example, if one
writes:


section data


some_label:
word 0
word 1


another_label:
word 2


What is the size that should be reported to the linker for some_label?
Perhaps it is one word. Perhaps two. Perhaps another_label is actually
inside the object that starts at some_label, and the size is actually
3 words. Perhaps it is yet another value. One way to resolve this
would be to surround the part that is to be exported by a data ... end data
block, i.e.


some_label:
data
word 0
word 1
end data


would make clear that there are two words in the object that starts at
some_label. Perhaps there should also be a default case; for example,
if no data ... end data block is provided, only the first byte/word/string
after the label is exported.


I would appreciate knowing people's thoughts on this matter. How has
this been solved before? Are any of these solutions particularly suitable
for Voodoo, keeping in mind Voodoo's purpose of combining staying
close to the hardware level with being portable to different architectures?


Kind regards,


Bob


--
Give a man a fish and he will eat for a day. Teach a man to fish and he
will eat for a lifetime.
-- Confucius



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.