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: Linker plugins should be aware of --defsym during symbol resolution


>> 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.

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

-cary


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