[llvm] r282451 - [CodeGen] Add support for emitting .init_array instead of .ctors on FreeBSD.

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 17:08:17 PDT 2016


On 29 September 2016 at 21:53, Davide Italiano <davide at freebsd.org> wrote
>
> On a side note, I checked that it was supported on 10 and 11, and I
> assumed FreeBSD supported both two majors at the time? (but from what
> I read also 9.3 is not EOL yet).

Right, 9.3 is not yet EOL, but even if it was (and no longer supported
by FreeBSD's security team) I don't think we want Clang to generate
binaries that won't run on it just yet. Also I'm leery of changing it
mid-stream in FreeBSD 10 or 11 since it could introduce a different
static ctor call ordering.

> Also, I do think that .ctors and .init_array should be able to be
> mixed and the linker should take care of mapping .ctors to .init_array
> in the output if both appears.
> gold does this for sure (and I think also bfd).

ld.bfd 2.17.50 at least does not.

>> I tried the change below in Clang, which is how I found in PR30494
>> that -fuse-init-array does nothing on certain targets.
>>
>> commit 35620dc26267407da73f5d82777398ad6552facc
>> Author: Ed Maste <emaste at freebsd.org>
>> Date:   Thu Sep 22 12:49:27 2016 -0400
>
> Fair enough, but please get approval from somebody Clang-side.

The change didn't work as-is, but I think it will with a slight
modification of your r282451.


More information about the llvm-commits mailing list