This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Newbie questions (where's the FAQ)


> I'm kinda new to this whole GNU thing, so I need to figure out how to do some
> basic things.
> I'm very interested in using the gold linker to link some large executables.

Welcome! I hope we can help.

> 1. ?Is there a FAQ? ?Where is it?

For gold, no, there's no FAQ at the moment. There's a bit of advice to
be found by searching the archives of this mailing list. Ian also has
a very helpful series of blog entries on the linker, starting here:

http://www.airs.com/blog/archives/date/2007/08/

> 2. ?I need a patch that is described in the forum, but it was not included
> in the download (that is, the gold I built behaves in a way that indicates
> the patch is not there). ?In fact, the file that the patch modifies was not
> included in the download. ?So how do I apply the patch, or get a download
> with the patch in it? ?Is there a .bleeding download, or some such, with all
> patches applied?

Based on your next question, it sounds like you discovered how to
download the latest top-of-trunk binutils. That should already include
any patches you've seen on this list.

> 3. ?I believe I will eventually want to make changes to the linker, at least
> for my own use (and to offer back to the community, if they want them). ?I
> was able to do the anonymous CVS to download the full binutils source; but I
> don't know how to build gold from that. ?If I could do that, I could
> probably apply patches.

It should be the same as how you built after downloading a source
tarball. You need to use the --enable-gold option when you configure
at the top level, and you need to make all-binutils before you can
make all-gold.

> 4. ?The README file for gold is a reasonable 50,000-foot overview of what it
> does, but it would also be very helpful to have a 10,000, or even 5000-foot
> view, describing the passes the linker performs and what it does in each
> pass, plus an overview of the data structures used, and ELF layout of the
> output files produced. ?Does that exist? ?If so, where?

Well, here's a 49,000-foot view:

It's actually a fairly standard "2-pass" linker where the first pass
scans over the input files collecting symbols and sections, and the
second pass goes over the input files again to apply relocations and
write the output file. In between the two passes is a fairly
substantial layout phase. You can get a good idea of the overall
control flow by looking at queue_initial_tasks, queue_middle_tasks,
and queue_final_tasks, in the source file gold.cc. The control flow is
handled by the workqueue -- everything is broken into individual tasks
that can be run in parallel threads.

The central concepts include: the Layout class (layout.h), which
manages the layout of the output file; the Object class and the Relobj
class derived from it (object.h), which represent the input objects;
the Output_data class (output.h), which represents the sections of the
output file (mostly Output_section objects that collect Input_section
objects); the Symbol_table class (symbol.h); and the Target class
(target.h), which abstracts all the target specifics.

Feel free to post questions here -- that's the best way to get started on a FAQ.

-cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]