This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Moved optimized callbacks into a separate library.
ClosedPublic

Authored by kstoimenov on Dec 22 2021, 11:44 AM.

Details

Diff Detail

Event Timeline

kstoimenov created this revision.Dec 22 2021, 11:44 AM
kstoimenov requested review of this revision.Dec 22 2021, 11:44 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 22 2021, 11:44 AM
Herald added subscribers: Restricted Project, cfe-commits. · View Herald Transcript

Updated a comment.

vitalybuka accepted this revision.Dec 22 2021, 3:23 PM

I suspect Driver part is going to be reverted a couple of time. Maybe extract it into a separate patch?

compiler-rt/lib/asan/CMakeLists.txt
171

why no changes for APPLE?

This revision is now accepted and ready to land.Dec 22 2021, 3:23 PM

I don't like the name "asan_dso". DSO means "dynamic shared object", and this is the very opposite of that. Maybe "asan_private" or "asan_helper"?

I got a couple of options myself:

adan_instrumentation
asan_fast_path
asan_mini

What do you think?

Maybe asan_client (like stats_client above), or asan_inline?

kstoimenov updated this revision to Diff 396031.EditedDec 23 2021, 7:57 AM
kstoimenov marked an inline comment as done.

Renamed dso to static.

Renamed it 'dso' to 'static'. I know it could be a little bit confusing. I was considering 'static_link' or 'always_static', but it seems too long.

This revision was landed with ongoing or failed builds.Dec 23 2021, 8:41 AM
This revision was automatically updated to reflect the committed changes.
vitalybuka reopened this revision.Dec 23 2021, 12:04 PM
This revision is now accepted and ready to land.Dec 23 2021, 12:04 PM

Added asan_rtl_static.cpp empty file.

s/set/append/

Fixed a comment.

kstoimenov requested review of this revision.Dec 23 2021, 1:09 PM

Added empty asan_static_rtl.cpp to work around the Windows build problem.

vitalybuka accepted this revision.Dec 23 2021, 2:48 PM
This revision is now accepted and ready to land.Dec 23 2021, 2:48 PM
This revision was landed with ongoing or failed builds.Dec 23 2021, 4:41 PM
This revision was automatically updated to reflect the committed changes.
kstoimenov reopened this revision.Dec 24 2021, 7:51 AM
This revision is now accepted and ready to land.Dec 24 2021, 7:51 AM
kstoimenov updated this revision to Diff 397613.Jan 5 2022, 9:23 AM

Removed driver part.

This revision was landed with ongoing or failed builds.Jan 5 2022, 9:27 AM
This revision was automatically updated to reflect the committed changes.
thetruestblue added inline comments.
compiler-rt/lib/asan/CMakeLists.txt
198

Can you explain the motivation here?

RTAsan_static object library isn't built on Apple & Apple ASAN doesn't support static libraries. is there a reason why this was added to Apple that I'm missing?

I don't believe this actually builds anything on Apple platforms since no OS is passed and in add_compiler_rt_runtime no libnames get set.

Even the tests added are not-apple specific.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2023, 12:26 PM
kstoimenov added inline comments.Feb 24 2023, 4:43 PM
compiler-rt/lib/asan/CMakeLists.txt
198

As far as I remember it was because of the __asan_report_(load|store)n functions defined in asan_rtl_static.cpp. They are defined as weak so that we could link the binary without providing the implementation, which was later loaded from asan_rtl DSO.

It is possible that we don't need this on Apple, but we will most likely need that on Windows. So if you are planning to make changes here you might have to revisit the 'NOT WIN32 AND NOT APPLE' statements to make sure we don't break the Windows build.