[RFC] COMDAT Safe Module Level Multi versioning
Cary Coutant
ccoutant@gmail.com
Tue Aug 18 21:24:00 GMT 2015
> +@item -fno-weak-comdat-functions
> +@opindex fno-weak-comdat-functions
> +Do not use weak symbol support for comdat non-virtual functions, even if it
> +is provided by the linker. By default, G++ uses weak symbols if they are
> +available. This option is useful when comdat functions generated in certain
> +compilation units need to be kept local to the respective units and not exposed
> +globally. This does not apply to virtual comdat functions as their pointers
> +may be taken via virtual tables. This can cause unintended behavior if
> +the addresses of comdat functions are used.
>
> It's not really the "weak" that is causing the problem -- it's the
> "comdat". What the option really is doing is making the functions
> static rather than comdat. (It's all gated under flag_weak because
> weak symbols are the fall-back to link-once and comdat symbols.) I'd
> suggest phrasing this more in terms of static vs. comdat.
Oh, also, I'd suggest clarifying what you mean by "if the addresses of
comdat functions are used". I think what you really mean here is "if
pointers to the [now non-comdat] functions are compared for equality."
-cary
More information about the Binutils
mailing list