<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63128>63128</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ASan] Always emit global metadata in the asan_globals section, and mark it "large" under -mcmodel=medium
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rnk
</td>
</tr>
</table>
<pre>
cc @vitalybuka @aeubanks
Our users are looking at the medium code model, and asan global metadata is the kind of large, non-performance sensitive data used only at startup and shutdown that we'd like to move out to the large data section.
First, I noticed that `clang -fsanitize=address` doesn't put asan global metadata in its own section by default on ELF, but it does on [COFF](https://gcc.godbolt.org/z/49srvYqPx) (`.ASAN$GL`). Can we switch the section here, just for consistency, and to group all the data together, far away from other globals? Once we've grouped the ASan globals together, we can optimize ASan startup time (and save code size!) by registering all the globals for the module once using `__start_asan_globals` / `__stop_asan_globals`.
Second, I want to figure out how to mark that asan_globals section as large (`SHF_X86_64_LARGE`), so that it gets moved far away in the medium code model. This is new work, I'm not sure how to do that.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE2T4jYQ_TXi0jWUkbEHDhzYYb1J1VQmlckhOVGy1dhaZImoWxDm16ckw-7OZvfChy31e6_f61ZEpneIG1F9ENVupiIPPmyCO85ar6-brgOxLM6Glb228ajSP4WxVe5IIIqdKLbT50sMEAkDgQoI1vujcT0oBh4QRtQmjtB5jTB6jVbIJ1BOgyLloLe-VRZGZKUVKzCULx2N0-APYFXoMV1w3j2cMBx8GJXrEAgdGTZnhHwtEmrwzl4TKrEKHE8ZhIbI2l8c8KAYLijkowZrjgjsYfRnBB85_U6oGW0qSNix8W7-rczGBOJE5ldwnk2Heqoq6qKzyvXwcCDlDJs3FOVOaR2QSNQFaI_khHxkOEX-iW4HhgkS0xs0tFfQeFDRMngHH5-bBN1GBsO5Ynoqqg9PL00jqp2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