Reloc::Default should trigger PIC on plateformq where PIE is the defaul

Pretty all is in the title. Is there a reason why this isn’t done ? With debian and ubuntu switching to PIE by default, this is become more and more of a hassle to get this working properly, and I’d rather see that fixed in LLVM rather than in each driver that do something with it.

Has someone already looked into this ? If so, what are the conclusions ?

Amaury SECHET via llvm-dev <llvm-dev@lists.llvm.org> writes:

Pretty all is in the title. Is there a reason why this isn't done ? With
debian and ubuntu switching to PIE by default, this is become more and more
of a hassle to get this working properly, and I'd rather see that fixed in
LLVM rather than in each driver that do something with it.

Has someone already looked into this ? If so, what are the conclusions ?

I did some time ago. My memory is fuzzy, but I think my idea was to
remove "Default" completely and have the caller fully specify what the
desired reloc model was.

A target construction can then take an Optional<Model> and map None to
whatever default it wants.

Cheers,
Rafael

Rough plan (previously discussed): https://reviews.llvm.org/D21100#455440
This is needed to LTO the FreeBSD base system, among others.

Davide Italiano <davide@freebsd.org> writes: