[rfc] long term idea: remove appending linkage
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 6 17:28:27 PST 2015
> On 2015-Dec-06, at 16:09, Reid Kleckner <rnk at google.com> wrote:
>
> On Sun, Dec 6, 2015 at 9:43 AM, David Majnemer <david.majnemer at gmail.com> wrote:
>
>
> On Sunday, December 6, 2015, Rafael EspĂndola <llvm-commits at lists.llvm.org> wrote:
> Looking at how unique appending linkage handling is I started
> wondering if we still need it at all.
>
> Now that we have sections, private linkage and comdats, I don't think we do.
>
> Things like
>
> @llvm.global_ctors = ... { i32 A1, i32 B1, i8* C1 }, { i32 A2, i32 B2, i8* C2 }
>
> can be represented as
>
> @ctor1 = private ... { i32 A1, i32 B1 }, section
> "llvm.metadata.ctors", comdat $(comdat of C1).
> @ctor2 = private ... { i32 A2, i32 B2 }, section
> "llvm.metadata.ctors", comdat $(comdat of C2).
>
> This wouldn't work on Mach-O because it doesn't have COMDATs.
>
> That's OK, MachO uses guard variables to prevent double initialization instead of comdats.
In the absence of comdats, would -globalopt/-globaldce do the
right thing with @ctor1 and @C1?
(I have no problem with this direction, just wondering how
close we are right now...)
More information about the llvm-commits
mailing list