[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26404] ld: INSERT [AFTER|BEFORE] variant for extension purposes
From: |
i at maskray dot me |
Subject: |
[Bug ld/26404] ld: INSERT [AFTER|BEFORE] variant for extension purposes |
Date: |
Thu, 17 Sep 2020 16:25:14 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26404
--- Comment #5 from Fangrui Song <i at maskray dot me> ---
Nick and Peter, thanks for looking into the feature request :)
(In reply to Nick Clifton from comment #4)
> (In reply to Peter Smith from comment #3)
> > As I understand it [*] just adding the script on the command line but
> > without the -T or --script will cause the linker to merge without the need
> > for INSERT etc.
>
> You are right. (I had thought that the fragment would override the
> built-in script where there are conflicts, but it appears that it
> augments it instead).
>
> So maybe what we need are *two* new command line options, just to make
> things clear: --augment-script=<name> and --overwrite-script=<name>.
Looks fine with me (a bit undecided on which one is better when expressing the
augment/overwrite intent, with command line option or a syntax). (Currently I
probably prefer a command line option more than a syntax.)
> Hmm, maybe this is going too far. We already have -t/--script, so
> how about we just add --script-action=[replace|merge|overwrite|new] ?
> So --script-action=replace would mean that --script replaces the built-in
> script, as it does at the moment. --script-action=merge would mean
> that --script would behave like script fragments do at the moment, and
> augment the built-in script. --script-action=overwrite would mean
> the same, except that where there are multiple definitions of the same
> section, the definition in the script replaces the definition in the
> built-in. --script-action=new means that only new definitions can be
> added and an error is generated if there are any conflicts.
--script-action is position dependent and affects all the following
-T/--script, right? I am wary of introducing new position dependent behaviors.
In a large build system, linker options may be collected from all over the
place, and having to worry about whether a lasting effect of an option can make
things brittle. I have seen problems due to not closing
--as-needed/-Bstatic/-Bdynamic (--start-group/--whole-archive can lead to
problems as well).
--
You are receiving this mail because:
You are on the CC list for the bug.