[PATCH] D36351: [lld][ELF] Add profile guided section layout

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 8 14:22:42 PST 2018


Michael Spencer <bigcheesegs at gmail.com> writes:

>> > +  }
>> > +}
>>
>> With --symbol-ordering-file we produce warnings if, for example, the
>> symbol is found to be absolute. The same issue applies here, no? Can you
>> refactor the code so that we print the same warnings for
>> --call-graph-ordering-file?
>>
>
> Given how the call graph files are likely to be produced I would expect
> warning on that would just be noise.

Maybe, but it can still find bugs in whatever tools are producing the
file. My initial version of the script for converting hfsort output
would not convert all sections and I only noticed because of a warning
saying it could not find symbol '.text.something'.

>
>> > +using ClusterIndex = std::ptrdiff_t;
>> > +using SectionIndex = std::ptrdiff_t;
>> > +using EdgeIndex = std::ptrdiff_t;
>>
>> Does this means that we use 64 bit integers for indexes? Why?
>>
>
> On a 64 bit platform, yes.  It's used because it can index all sections on
> whatever platform it's on.  It's signed because the only reason to use
> unsigned types is if you need the range, are bit twiddling, or need modular
> arithmetic.

What I don't get is why 64 bits. How can we ever get more than 2^32
sections? Even SHT_SYMTAB_SHNDX uses 32 bits

> We don't use float/double anywhere else in the compiler.  I do not have
> high confidence that all supported versions of clang, gcc, and msvc for all
> supported targets will have bit identical behavior here.

But that is basically cargo culting it into the linker. There are two
important differences. First, when APFloat was implemented x87 was used
by the most common hosts. Second, the use of floating point in this
patch is trivial. It is only ever used to compare fractions.

Cheers,
Rafael


More information about the llvm-commits mailing list