This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers, CMake] Also use version script for libclang_rt.asan-i386.so
ClosedPublic

Authored by ro on Nov 8 2017, 5:45 AM.

Details

Summary

When building LLVM on x86_64-pc-linux-gnu (Fedora 25) with the bundled gcc 6.4.1
which uses gld 2.26.1-1.fc25, the dynamic/Asan-i386-calls-Dynamic-Test and
dynamic/Asan-i386-inline-Dynamic-Test tests failed to link with

/usr/bin/ld: /var/scratch/gcc/llvm/dist/lib/clang/6.0.0/lib/linux/libclang_rt.asan-i386.so: fork: invalid version 21 (max 0)
/var/scratch/gcc/llvm/dist/lib/clang/6.0.0/lib/linux/libclang_rt.asan-i386.so: error adding symbols: Bad value

I tried building with a self-compiled gcc 7.1.0 using gld 2.28, but the error remained.

It seems the error has been hit before (cf. https://reviews.llvm.org/rL314085), but
no real explanation has been found.

However, the problem goes away when linking the i386 libclang_rt.asan with a version
script just like every other variant is. Not using the version script in this single case
dates back to the initial introduction of the version script in r236551, but this change
was just checked in without any explanation AFAICT.

Since I've not found any other workaround and no reason for not always using the
version script, I propose to do so.

Tested on x86_64-pc-linux-gnu.

Diff Detail

Event Timeline

ro created this revision.Nov 8 2017, 5:45 AM
eugenis accepted this revision.Nov 8 2017, 12:52 PM

Yeah, I've always wondered about the reason for the special case. Lets see what happens. Please be ready to revert if the bots don't like this.

This revision is now accepted and ready to land.Nov 8 2017, 12:52 PM
ro added a comment.Nov 8 2017, 12:57 PM

Fine, thanks. However, I still need someone to commit (and eventually revert) this for me.

I can do that.

This revision was automatically updated to reflect the committed changes.