This allows grouping all sections like ".ctors.12345" into ".ctors".
For MinGW, the numerical values for such ctors are all zero-padded, so a lexical sort is good enough.
Differential D40408
[LLD] [COFF] Interpret a period as a separator for section suffix just like '$' mstorsjo on Nov 24 2017, 12:56 AM. Authored by
Details This allows grouping all sections like ".ctors.12345" into ".ctors". For MinGW, the numerical values for such ctors are all zero-padded, so a lexical sort is good enough.
Diff Detail
Event TimelineComment Actions Ah, okay, this is the lld-side patch. I wonder if you can't just create .ctors$12345 instead of .ctors.12345 for COFF. Do you need this? Comment Actions On the LLVM side, I'm trying to match what GCC does, to allow using this with clang as compiler while using the GNU binutils in MinGW. (Even if we'd make LLVM produce .ctors$12345, we need to sort them numerically so that .ctors$5 would end up before .ctors$12345.)
Comment Actions Added comments, removed redundant checking for periods (replaced with asserts), removed the redundant StringRef references. Comment Actions I noticed that GCC actually does zero pad these, and GNU ld expects them zero padded, so this simplifies this patch quite significantly. The .ctors$zzz part is only used in the llvm/lld specific parts of mingw-w64, and can be replaced with .ctors.99999 or something similar once this goes in, to avoid the need for the special sorting of them. Comment Actions Nice! LGTM
|