[PATCH] D123010: [WIP][asan] Emit .size directive for global object size before redzone

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 21:41:45 PDT 2022


MaskRay added a comment.

It is more like: "we do not care much about which st_size to use, but I prefer the way with little complexity".

This patch tries to change the status quo with a bit more complexity, so I'd challenge it with the justification.
Your llvm-ifs argument in the comment would make a better summary, but see below I have a minor concern with regard to copy relocations.
In addition, asan instruments global variables so the ABI is different anyway. I do not see a very justification that unifying the two cases.

> In what cases do you imagine it would be useful to quickly see whether an area has been enlarged?

Mixing instrumented and uninstrumented global variables are error-prone, so knowing whether some have actually different IR sizes helps debugging if a program breaks.
Also imagine the scenario that asan improves to place some non-zero data into the trailing redzone, then this approach will actually break copy relocations.

> Matching GCC when their behavior is better seems like a worthy goal, especially if the cost to do so here isn't high. Do you expect the complexity of whatever solution this would end up with isn't worth the benefit?

I believe in many of the sanitizer cases Clang has the reference implementation and GCC is following.
In such cases changes need to have their own merits, the GCC compatibility is just a tie-breaker.
Actually I have some vague memory that GCC hasn't thought hard about what st_size it should use, as I vaguely remember some global variable instrumentation in GCC.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123010/new/

https://reviews.llvm.org/D123010



More information about the llvm-commits mailing list