GCC has supported the function attributes
attribute((no_stack_protector)) since GCC 11 and
attribute((no_sanitize(""))) since GCC 8.
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Differential D104491
[Docs][Clang][Attr] mark no_stack_protector+no_sanitize GCC compatible nickdesaulniers on Jun 17 2021, 2:51 PM. Authored by
Details
GCC has supported the function attributes Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Diff Detail
Unit Tests Event TimelineComment Actions There might be subtle inconsistencies between values accepted by our no_sanitize and GCC's no_sanitize, because of internal naming differences, but I couldn't say what those are right now (I think no_sanitize("coverage") only works with Clang, and GCC wants no_sanitize_coverage which we don't have due to not allowing new no_sanitize_*). Comment Actions This change breaks code by removing the [[clang::no_sanitize]] spelling (and the fact that zero tests broke show we're missing test coverage here). We don't currently have a spelling to represent an attribute known to both Clang and GCC, nor do we currently have any attributes that use both the Clang and GCC spellings (which both include a GNU spelling that would be duplicated). I think you should keep the Clang spelling, add a GCC spelling, make sure that ClangAttrEmitter.cpp does not generate two GNU spellings for it, and add some basic test coverage for the change. Comment Actions I took a quick look at ClangAttrEmitter.cpp, and it looks like the only change that is needed is within the GetFlattenedSpelling() function. So not quite quick, but shouldn't be too bad (in case someone wants to pick this back up). |