This is an archive of the discontinued LLVM Phabricator instance.

gn build: Build libclang.so on ELF platforms.
ClosedPublic

Authored by pcc on Aug 17 2021, 10:55 AM.

Details

Summary

This requires changing the ELF build to enable -fPIC, consistent
with other platforms.

Diff Detail

Event Timeline

pcc requested review of this revision.Aug 17 2021, 10:55 AM
pcc created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2021, 10:55 AM

Hm, I kind of like the PIC-less build. But probably not worth having a toggle for it, I suppose. So lg, but:

llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
16

probably should update these too:

% rg -F 'rget_type = "static_librar' llvm/utils/gn
llvm/utils/gn/secondary/compiler-rt/lib/tsan/BUILD.gn
12:  tsan_target_type = "static_library"

llvm/utils/gn/secondary/compiler-rt/lib/asan/BUILD.gn
12:  asan_target_type = "static_library"

llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
16:  libclang_target_type = "static_library"

llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
8:  lto_target_type = "static_library"
pcc updated this revision to Diff 366966.Aug 17 2021, 11:34 AM

Also libLTO.so

pcc added inline comments.Aug 17 2021, 11:34 AM
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
16

Done for llvm/tools/lto.

For the sanitizers the shared-ness of the runtime is tied to what works best on that platform, rather than whether it's PIC by default (note that all compiler-rt code is built with -fPIC), so I left them as is.

thakis accepted this revision.Aug 17 2021, 6:42 PM
thakis added inline comments.
llvm/utils/gn/secondary/llvm/tools/lto/BUILD.gn
19

Run gn format before comitting, it'll put this at the top.

This revision is now accepted and ready to land.Aug 17 2021, 6:42 PM
This revision was automatically updated to reflect the committed changes.
pcc marked an inline comment as done.Aug 18 2021, 1:49 PM