This is the mail archive of the
mailing list for the binutils project.
Re: stateful handling of some ld flags
- From: Alan Modra <amodra at gmail dot com>
- To: Ulrich Drepper <drepper at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 2 Jul 2014 17:18:49 +0930
- Subject: Re: stateful handling of some ld flags
- Authentication-results: sourceware.org; auth=none
- References: <87tx74g6hk dot fsf at x240 dot local dot i-did-not-set--mail-host-address--so-tickle-me>
On Sat, Jun 28, 2014 at 03:48:55PM -0400, Ulrich Drepper wrote:
> This patch is a possible solution for a problem that bugged me for a
> very long time. If you provide rules to link with a set of libraries
> (for instance, when using pkg-config) one cannot use --as-needed,
> --copy-dt-needed-entries, --whole-archive (and the respective inverse
> versions) because it is not known what the current state is. One cannot
> switch back.
> Other programs, for instance, gcc have similar problems. A solution is
> to use push/pop pairs.
> This patch implements this for this three sets of command line options.
> No need to do this for the linker script equivalent, it already does the
> right thing.
> I don't think it is possible to have a general push state/pop state
> pair, there are simply too many settings which can or cannot be assumed
> to be affected.
> What do you think?
I like the idea, but a general push/pop affecting input files is not
as hard as you think. Of the flags in input_flags, just four are
persistent control flags: dynamic, add_DT_NEEDED_for_dynamic,
add_DT_NEEDED_for_regular and whole_archive. The rest are controls
for a single file or status flags. One status flag, missing_file,
I'd rather see --push-control/--pop-control options that push/pop
input_flags to a stack, making missing_file sticky on a pop. That
would see the "dynamic" flag covered and any future extensions as
well. Fewer new options are better, and note that we currently allow
abbreviations like "--whole" for "--whole-archive". If you add
"--whole-archive-push" then this abbreviation will no longer be
Australia Development Lab, IBM