This is the mail archive of the 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: Linker plugins should be aware of --defsym during symbol resolution

On Tue, Feb 13, 2018 at 4:04 PM, Cary Coutant <> wrote:

> >> Do you have a real-world example? I'm having trouble imagining a case
> >> where --defsym would be used to override a symbol that's subject to
> >> the ODR and yet remain a valid program.
> >
> > I just concocted one:
> > ...
> > With defsym:
> >
> > $ ~/llvm/llvm_8_build/bin/clang++ hello[12].cc  -fuse-ld=gold
> > -Wl,--defsym,_Z3barv=_Z3bazv
> To me, this is the same as providing an overriding definition of bar()
> that prints "in baz", which clearly violates the one-definition rule.

On what basis do you consider this a valid thing to do, to the extent
> that you want to preserve the unoptimized behavior across LTO?
> Is there a real-world example where someone would want to do this in
> production code? I'm afraid I'd have zero sympathy for them. If they
> want something like that to work, they should just turn off
> cross-module inlining.

Fair enough. It was a contrived example, not based on anything I have seen
so far. If that violates ODR then I agree all bets are off.

Let me try with a modified change that marks these with LDPR_PREEMPTED_REG.
Sri, would you mind changing the patch and I'll give the new version a try?


> I need a lot more justification to extend the plugin API.
> -cary

Teresa Johnson |  Software Engineer | |  408-460-2413

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