[LLVMdev] static initialization

Tim Northover t.p.northover at gmail.com
Wed Nov 26 07:10:51 PST 2014


Hi Raphael,

On 25 November 2014 at 23:48, Hiesgen, Raphael
<Raphael.Hiesgen at haw-hamburg.de> wrote:
> Apparently it works in a similar way on clang, but remains silent on the details.

The main issue I saw is that Clang doesn't supply a
crtbegin.o/crtend.o. Actually, I think most of that bit is documenting
the Linux platform ABI rather than any universal truths. When
compiling for Linux, Clang uses GCC's version of those files.

But it sounds like you're creating your own anyway, so it probably
doesn't matter.

> Is there a more detailed documentation I have overlooked or could you give me a hint how to acquire function pointers?

All the sections and so on are ABI details so they should be identical
when targeting the same platform. Are you seeing some particular
problem with the code emitted by Clang?

Across CPUs main difference to watch out for is whether .init_array
(newer systems) or .ctors (the traditional way) is being used
primarily. But both Clang and GCC should agree in each case.

Cheers.

Tim.



More information about the llvm-dev mailing list