<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>There is a good amount of expertise on this in Emscripten
community: <a class="moz-txt-link-freetext" href="https://github.com/emscripten-core/emscripten">https://github.com/emscripten-core/emscripten</a></p>
<p>You can also try to ask in one of the WebAssembly repos:
<a class="moz-txt-link-freetext" href="https://github.com/WebAssembly">https://github.com/WebAssembly</a><br>
</p>
<p>I think Luke Imhoff has done some work accessing the start
function, I am not sure if he is on this list. I personally don't
know of a way write to start function. There is a bit on it in
tool conventions:</p>
<p><a class="moz-txt-link-freetext" href="https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md#start-section">https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md#start-section</a><br>
</p>
<p>The __heap_base symbol is there because Wasm does not have the
memory layout C family languages expect. At higher opt level Clang
is usually pretty good at removing its use.</p>
<p>Best,</p>
<p>Petr<br>
</p>
<div class="moz-cite-prefix">On 10/15/19 4:50 PM, Bill Ticehurst via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:DM5PR00MB039243E7B744D579E78DF287D9930@DM5PR00MB0392.namprd00.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:285507027;
mso-list-type:hybrid;
mso-list-template-ids:-1275453428 -1 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:2;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:20.65pt;
text-indent:-.25in;
font-family:"Calibri",sans-serif;
mso-fareast-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:56.65pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:92.65pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:128.65pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:164.65pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:200.65pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:236.65pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:272.65pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:308.65pt;
text-indent:-.25in;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style>
<div class="WordSection1">
<p class="MsoNormal">Apologies if there is a better forum for
these questions. Please redirect me if so.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve been using the clang/wasm-ld tools to
experiment with some basic examples, and there’s a couple
things I’m wrestling with.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">1) How to denote a function as the “start”
function (<a
href="https://webassembly.github.io/spec/core/binary/modules.html#start-section"
moz-do-not-send="true">https://webassembly.github.io/spec/core/binary/modules.html#start-section</a>)<o:p></o:p></p>
<p class="MsoNormal">2) How to avoid the defaulted __heap_base
global.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve dug around on the samples, mailing
lists, and in the wasm-ld code for an attribute or flag to
specify the start function, but don’t see anything. Is this
just not implemented (or tracked) yet?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For 2), I always see the below global in
the compiled output even with the most trivial code that makes
no reference to it (e.g. compiling just a simple function that
only references values on the implicit operand stack).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(global (;0;) (mut i32) (i32.const 66560))<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Per <a
href="https://dassur.ma/things/c-to-webassembly/"
moz-do-not-send="true">https://dassur.ma/things/c-to-webassembly/</a>,
looks like this is the __heap_base value implicitly provided
for modeling the stack/heap as are usually present in most
C/C++ environments, even though unused in my compiled output.
Is this something that could/should be optimized away, but
again just isn’t implemented yet? Any way to suppress this
building with the current clang/wasm-ld toolchain?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ul style="margin-top:0in" type="disc">
<li class="MsoListParagraph"
style="margin-left:-15.35pt;mso-list:l0 level1 lfo1">
Bill<o:p></o:p></li>
</ul>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sent from <a
href="https://go.microsoft.com/fwlink/?LinkId=550986"
moz-do-not-send="true">
Mail</a> for Windows 10</p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
</body>
</html>