This is an archive of the discontinued LLVM Phabricator instance.

[CMake][ELF] Disable -fno-semantic-interposition on debug builds
AbandonedPublic

Authored by ljmf00 on Jan 12 2022, 1:31 PM.

Details

Reviewers
MaskRay
Summary

When -fPIC is enabled via LLVM_ENABLE_PIC, -fno-semantic-interposition
optimization flag is added on both Release and Debug builds. This patch enables
it only on release builds.

Diff Detail

Event Timeline

ljmf00 created this revision.Jan 12 2022, 1:31 PM
ljmf00 requested review of this revision.Jan 12 2022, 1:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2022, 1:31 PM
ljmf00 edited the summary of this revision. (Show Details)Jan 12 2022, 1:35 PM
ljmf00 edited the summary of this revision. (Show Details)
ljmf00 retitled this revision from [CMake][ELF] Enable -fno-semantic-interposition on release builds to [CMake][ELF] Disable -fno-semantic-interposition on debug builds.Jan 12 2022, 1:37 PM

The exact issue is -fsanitize=fuzzer-no-link -fno-semantic-interposition -fPIC. The -O level does not matter.

ljmf00 added a comment.EditedJan 13 2022, 9:11 AM

The exact issue is -fsanitize=fuzzer-no-link -fno-semantic-interposition -fPIC. The -O level does not matter.

Correct, although, it is still an optimization flag, at least according to GCC documentation about optimization options (https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html) and as described by the above comments in the CMake configuration. Looking into the discussion on D102453, shouldn't we prefer reliability on debug builds rather than speed? Another point to take into consideration is build/link times, does this affect it?

EDIT: GCC disables -fsemantic-interposition when -Ofast is present.

MaskRay requested changes to this revision.Jan 24 2022, 3:10 PM

This may be abandoned :)

This revision now requires changes to proceed.Jan 24 2022, 3:10 PM
ljmf00 abandoned this revision.Jan 24 2022, 7:45 PM