This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: simulating section-gc with ar-archives?
Ian Lance Taylor <ian@airs.com> writes:
> > Does this mean that you could simulate section-gc by breaking all your
> > .o's up so that each file contained exactly one section, wrapping it
> > all up in a .a, and linking that?
> However, breaking up a .o after the fact is not necessarily trivial,
> and is in the general case impossible, because there is no way to
> correctly handle references to file static variables and functions.
Interesting; will objcopy warn me if there is a problem when
extracting a single section from a .o?
I'm thinking of just iterating over each section, calling "objcopy
--only-section=foo" on each section.
Also, what is a "file static variable"? Wouldn't any references from
one section to a static variable in another section be handled by a
reloc with the symbol name of the static variable?
- a