OSDN Git Service

scudo: Shrink secondary header and cache entry size by a word on Linux. NFCI.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 9 Dec 2020 21:30:52 +0000 (13:30 -0800)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 9 Dec 2020 22:14:49 +0000 (14:14 -0800)
Normally compilers will allocate space for struct fields even if the
field is an empty struct. Use the [[no_unique_address]] attribute to
suppress that behavior. This attribute that was introduced in C++20,
but compilers that do not support [[no_unique_address]] will ignore
it since it uses C++11 attribute syntax.

Differential Revision: https://reviews.llvm.org/D92966

compiler-rt/lib/scudo/standalone/secondary.h

index eda8886..ff41bd3 100644 (file)
@@ -31,7 +31,7 @@ struct Header {
   uptr BlockEnd;
   uptr MapBase;
   uptr MapSize;
-  MapPlatformData Data;
+  [[no_unique_address]] MapPlatformData Data;
 };
 
 constexpr uptr getHeaderSize() {
@@ -232,7 +232,7 @@ private:
     uptr BlockEnd;
     uptr MapBase;
     uptr MapSize;
-    MapPlatformData Data;
+    [[no_unique_address]] MapPlatformData Data;
     u64 Time;
   };