<div dir="ltr">It is consumed by the ASan runtime itself, which is loaded first well before main(int, char**) is invoked. In order for ASan to find it, the symbol to it has to be exported. See references to __asan_default_options in <a href="https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/asan/asan_flags.cpp">https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/asan/asan_flags.cpp</a>. GCC uses the same runtime library as does MSVC.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 16, 2023 at 5:38 AM Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com">thomas.stuefe@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">I’m curious, why does the options function have to be exported? Who is consuming it?</div><div dir="auto"><br></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed 15. Feb 2023 at 19:01, Justin King <<a href="mailto:jcking@openjdk.org" target="_blank">jcking@openjdk.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Update build-related infrastructure to support building with ASan under Microsoft Visual C++.<br>
<br>
-------------<br>
<br>
Commit messages:<br>
 - Move comment to appropriate location<br>
 - Use elif instead of separate if<br>
 - Only pass -fsanitize=address to linker for Clang/GCC<br>
 - Update asan_default_options.c with MSVC-specific extensions<br>
 - Support using ASan with MSVC<br>
<br>
Changes: <a href="https://git.openjdk.org/jdk/pull/12580/files" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/12580/files</a><br>
 Webrev: <a href="https://webrevs.openjdk.org/?repo=jdk&pr=12580&range=00" rel="noreferrer" target="_blank">https://webrevs.openjdk.org/?repo=jdk&pr=12580&range=00</a><br>
  Issue: <a href="https://bugs.openjdk.org/browse/JDK-8302599" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-8302599</a><br>
  Stats: 25 lines in 2 files changed: 18 ins; 0 del; 7 mod<br>
  Patch: <a href="https://git.openjdk.org/jdk/pull/12580.diff" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/12580.diff</a><br>
  Fetch: git fetch <a href="https://git.openjdk.org/jdk" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk</a> pull/12580/head:pull/12580<br>
<br>
PR: <a href="https://git.openjdk.org/jdk/pull/12580" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/12580</a><br>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span><br><table border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:20px 0px 0px;font-family:"Times New Roman""><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td valign="top" style="padding:0px 20px 0px 0px;vertical-align:top;border-right:1px solid rgb(213,213,213)"><img src="https://www.gstatic.com/images/branding/product/1x/googleg_64dp.png" alt="Google Logo" width="72" style="margin: 0px; padding: 0px; display: block; height: auto;"></td><td style="padding:0px 0px 0px 20px"><table border="0" cellspacing="0" cellpadding="0" style="margin:0px;padding:0px"><tbody style="margin:0px;padding:0px"><tr style="margin:0px;padding:0px"><td colspan="2" style="padding:1px 0px 5px;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:13px;line-height:13px;color:rgb(56,58,53);font-weight:700">Justin King</td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="padding:0px 0px 5px;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:11px;line-height:13px;color:rgb(56,58,53)">Software Engineer</td></tr><tr style="margin:0px;padding:0px"><td colspan="2" style="padding:0px 0px 5px;font-family:Arial,Helvetica,Verdana,sans-serif;font-size:11px;line-height:13px;color:rgb(56,58,53)"><a href="mailto:jcking@google.com" target="_blank">jcking@google.com</a></td></tr></tbody></table></td></tr></tbody></table><table style="border:none;border-collapse:collapse"><colgroup><col width="85"><col width="539"></colgroup><tbody><tr style="height:0pt"><td style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255);vertical-align:middle;padding:4.32pt"></td><td style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255);vertical-align:middle;padding:4.32pt"><br></td></tr></tbody></table></span></div></div>