MSVC supports the following pragma, which can be used to automatically link a
library when a header file is included. This is used by for example Boost.
#pragma comment(lib, "requiredLibrary.lib")
Unfortunately, gold doesn't support this. Could you add it?
I assume this needs coordination with gcc.
It sounds like a reasonable idea to me, but to be honest it is not high on my priority list. No existing Unix linker works that way. The gold linker is free software, so brand new ideas like this tend to be written by the people who would like to see them implemented. If you are unable to implement it yourself, I would recommend sending a note to the firstname.lastname@example.org mailing list. However, please do not be surprised if nobody takes this up for you. Most free software developers are not waiting around trying to think of something to do. Most of them have far too much to do, and fixing bugs and implementing features that they use themselves is normally going to take priority over implementing a brand new feature which nobody is currently using.
I'm not trying to discourage you or to tell you that you are doing anything wrong. I'm just describing my perception of how free software development works. It's driven by volunteers who write code. Ideas are cheap, and there are far more ideas than will ever be implemented. Working code is expensive.
I'm also not saying that I will never implement this myself. But I am unlikely to implement it any time soon.
Here is a proposal for H/W S/W Attribute:
1. Minimum ISAs:
a. Only has EM_386 and EM_X86_64
4) Pentium Pro
b. Executables/DSOs compiled for Atom, … won't run on all x86 platforms:
i. Loader can't tell from EM_386/EM_X86_64 to know what ISAs a program requires.
2. GNU binutils supports build attribute and run-time platform compatibility data
a. Build attribute:
i. Used by linker to set run-time platform compatibility data
b. Run-time platform compatibility data
i. Used by loader to check platform capabilities required by an executable file/DSO.
c. Extend to x86:
1) Required ISAs.
a) Define ISAs tags/attributes
1) Stack size
2) Additional libraries:
I think it's a great idea, and have wanted to see this feature in Unix for a long time. Yes, there will need to be some cooperation with gcc, but that could be as simple as a note section, from which the linker could read additional -l options. There will be some additional complexity in determining where in the link order these additional options should be placed: a complete solution would have each library and each relocatable object note all of its direct dependencies so that the linker could construct a topological ordering. At that point, you could in theory just say "ld main.o" and get a working program out.
On Mon, Feb 28, 2011 at 8:42 PM, hjl.tools at gmail dot com
> --- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-02-28 19:42:19 UTC ---
> Here is a proposal for H/W S/W Attribute:
This does not sound related to this feature request.
Wrong bug number?