This is an archive of the discontinued LLVM Phabricator instance.

Msan, cmake configuration changes
ClosedPublic

Authored by devnexen on Feb 22 2018, 1:10 AM.

Details

Summary
  • Applies tls-exec generally, on FreeBSD despite enabling it in Msan, the TLS part does not execute.
  • Suppress PIE which does not go together with PIC in FreeBSD (linkage issue when trying to compile code with msan flag).

Diff Detail

Event Timeline

devnexen created this revision.Feb 22 2018, 1:10 AM

As discussed here https://reviews.llvm.org/D43080 this is the specific change into Msan cmake configuration part.

What is the problem with -fPIE? Is it not supported to link PIE and PIC objects in one binary?

What is the problem with -fPIE? Is it not supported to link PIE and PIC objects in one binary?

I ve tried with and if I compile any code with msan sanitizer I get linkage issue.

What kind of linkage issue?
I mean, in my view of the world, it is completely fine to build a static library with -fPIE and then link it to an executable. I'd like to understand what is wrong with that on FreeBSD.

krytarowski added a subscriber: dim.

Naively looking at https://hardenedbsd.org/content/easy-feature-comparison PIE on FreeBSD might need more work.

Adding @emaste and @dim from FreeBSD.

devnexen added a comment.EditedFeb 22 2018, 3:43 PM

What kind of linkage issue?
I mean, in my view of the world, it is completely fine to build a static library with -fPIE and then link it to an executable. I'd like to understand what is wrong with that on FreeBSD.

This is the error I get with both PIE and PIC
... relocation R_X86_64_TPOFF32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

eugenis accepted this revision.Mar 2 2018, 10:46 AM

OK, sure, as long as it's under if(FreeBSD).

Does it mean you are building MSan runtime as not position-independent code (i.e. not PIE nor PIC)? It would be suitable for non-PIE executables only.

This revision is now accepted and ready to land.Mar 2 2018, 10:46 AM
krytarowski closed this revision.Mar 3 2018, 4:02 AM

Hmm, this already landed as a part of D43080

I've added this -ftls flag as a separate commit SVN r. 326649