<div dir="ltr">Hi Frank,<div><br></div><div>    preprocess it using -P or -E and see what you get.  i.e. run the compiler with all the same flags (except -c and/or -o) but suppling either -E or -P (if -P pipe the result into foo.i).  Then you can see what source the compiler is actually compiling.  Then grep for pageMask in the result.  Let&#39;s see what mangling is actually happening.</div>
<div><br></div><div>HTH</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 2:21 PM, Frank Shearar <span dir="ltr">&lt;<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I didn&#39;t express myself properly. pageMask occurs in a #define (line<br>
293), but its definition is on line 100. But what confuses me is that<br>
since it&#39;s outside the function definition, it should surely be<br>
visible in the function. But the error I get says that on line 298,<br>
&quot;error: &#39;pageMask&#39; undeclared (first use in this function)&quot;.<br>
<span class="HOEnZb"><font color="#888888"><br>
frank<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 10 January 2013 21:43, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Frank,<br>
&gt;<br>
&gt;     where&#39;s the #define of pageMask?  There shouldn&#39;t be one  pageMask is an unsigned int.  i.e.<br>
&gt;<br>
&gt; McStalker.oscogvm$ grep -n pageMask platforms/unix/vm/*<br>
&gt; platforms/unix/vm/sqUnixMemory.c:100:static unsigned int pageMask = 0;<br>
&gt; platforms/unix/vm/sqUnixMemory.c:102:#define valign(x)  ((x) &amp; pageMask)<br>
&gt; platforms/unix/vm/sqUnixMemory.c:123:  pageMask= ~(pageSize - 1);<br>
&gt; platforms/unix/vm/sqUnixMemory.c:125:  DPRINTF((&quot;uxAllocateMemory: pageSize 0x%x (%d), mask 0x%x\n&quot;, pageSize, pageSize, pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:178:      assert(0 == (newDelta &amp; ~pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:179:      assert(0 == (newSize  &amp; ~pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:196:     assert(0 == (heapSize  &amp; ~pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:213:      assert(0 == (newDelta &amp; ~pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:214:      assert(0 == (newSize  &amp; ~pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:231:     assert(0 == (heapSize  &amp; ~pageMask));<br>
&gt; platforms/unix/vm/sqUnixMemory.c:293:# define roundDownToPageBoundary(v) ((v)&amp;pageMask)<br>
&gt; platforms/unix/vm/sqUnixMemory.c:294:# define roundUpToPageBoundary(v) (((v)+pageSize-1)&amp;pageMask)<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Jan 10, 2013 at 1:40 PM, Frank Shearar &lt;<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; First, thanks Eliot for fixing up the UUID plugin.<br>
&gt;&gt;<br>
&gt;&gt; With that fixed, the next error I get when compiling (32 bit) on<br>
&gt;&gt; FreeBSD is this:<br>
&gt;&gt;<br>
&gt;&gt; sqUnixMemory.c<br>
&gt;&gt; /usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:<br>
&gt;&gt; In function &#39;sqMakeMemoryExecutableFromTo&#39;:<br>
&gt;&gt; /usr/home/jenkins/workspace/CogVM-FreeBSD/target/Squeak-vm-unix-4.6.0-Cog-2664-unofficial-src/platforms/unix/vm/sqUnixMemory.c:298:<br>
&gt;&gt; error: &#39;pageMask&#39; undeclared (first use in this function)<br>
&gt;&gt;<br>
&gt;&gt; The line number looks a bit wrong, because pageMask is in a #define on<br>
&gt;&gt; line 293. (Ah, it&#39;s because line 298 uses the #define.) At any rate,<br>
&gt;&gt; the relevant function + context looks like this:<br>
&gt;&gt;<br>
&gt;&gt; #if COGVM<br>
&gt;&gt; # define roundDownToPageBoundary(v) ((v)&amp;pageMask)<br>
&gt;&gt; # define roundUpToPageBoundary(v) (((v)+pageSize-1)&amp;pageMask)<br>
&gt;&gt; void<br>
&gt;&gt; sqMakeMemoryExecutableFromTo(unsigned long startAddr, unsigned long endAddr)<br>
&gt;&gt; {<br>
&gt;&gt;         unsigned long firstPage = roundDownToPageBoundary(startAddr);<br>
&gt;&gt;         if (mprotect((void *)firstPage,<br>
&gt;&gt;                                  endAddr - firstPage + 1,<br>
&gt;&gt;                                  PROT_READ | PROT_WRITE | PROT_EXEC) &lt; 0)<br>
&gt;&gt;                 perror(&quot;mprotect(x,y,PROT_READ | PROT_WRITE | PROT_EXEC)&quot;);<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; void<br>
&gt;&gt; sqMakeMemoryNotExecutableFromTo(unsigned long startAddr, unsigned long endAddr)<br>
&gt;&gt; {<br>
&gt;&gt;         unsigned long firstPage = roundDownToPageBoundary(startAddr);<br>
&gt;&gt;         if (mprotect((void *)firstPage,<br>
&gt;&gt;                                  endAddr - firstPage + 1,<br>
&gt;&gt;                                  PROT_READ | PROT_WRITE) &lt; 0)<br>
&gt;&gt;                 perror(&quot;mprotect(x,y,PROT_READ | PROT_WRITE)&quot;);<br>
&gt;&gt; }<br>
&gt;&gt; #endif /* COGVM */<br>
&gt;&gt;<br>
&gt;&gt; A bit confusing, given that pageMask is declared on line 100, as<br>
&gt;&gt; whatever C calls a top level form. A global?<br>
&gt;&gt;<br>
&gt;&gt; What can I do to make things work?<br>
&gt;&gt;<br>
&gt;&gt; The full ouput&#39;s viewable here: <a href="http://squeakci.org/job/CogVM-FreeBSD/13/console" target="_blank">http://squeakci.org/job/CogVM-FreeBSD/13/console</a><br>
&gt;&gt;<br>
&gt;&gt; frank<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; best,<br>
&gt; Eliot<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div>