Fri Mar 25 15:48:30 GMT 2005
> I might be misreading your example, but I think we might be able to get
> it working with some different symbol properties. I attached the example
> that I came up with in this email. This example seems to demonstrate the
> behavior I'm looking for on Solaris 10, and SuSE Linux (haven't tried
> other systems yet). It's just very very basic "pragma weak" style
> functionality (as far I can tell).
With your example, I get prog1 returning 0 and prog2 returning a non-NULL
address. Is that what you expected? I can see how you could get some
usefulness out of that.
The bothersome part in my view is that the bind=WEAK still is tied to the
symbol and not the individual reference (or relocation, to be more precise).
So, within a single object, you can't emit one reference for the Dwarf and
say it's weak, and then another as part of code generation (e.g. for a call),
and say it's strong.
But I suppose you still can get it to work. You'll just have to keep track
of all the references you emit in the assembly, and if only emit the weak
directive if all of the references are for weak purposes (e.g. Dwarf
references), and avoid it if any are strong (e.g. a call, assuming there's no
#pragma weak in the user source).
Was this your plan? If so, it seems like a decent plan to me.
I may even have to look into this technique for a problem that's been nagging
me in our Ada compiler for a while: pragma import.
Concurrent Computer Corporation
More information about the Dwarf-discuss