<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Tue, Mar 18, 2014 at 8:26 PM, Joel Sherrill <span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div>
<br>
<div>On 3/18/2014 1:07 PM, Hesham Moustafa
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I am working on modifying or1k newlib port to be built for
RTEMS. Building and installing</div>
<div>newlib with --target=or1k-elf is done successfully,
however, when I try to build newlib</div>
<div>with --target=or1k-rtems4.11 I got conflict error.</div>
<div><br>
</div>
<div>part of this error is </div>
<div>"sys/rtems/crt0.c:72:22: error: conflicting types for
‘read’"</div>
<div><br>
</div>
</div>
</blockquote></div>
Hmmm... how old is there newlib? <br>
<br></div></blockquote></div><div>I think their toolchain depends on newlib-2.0.0, but I have generated patches</div><div> to work with newlib-2.1.0.</div><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
What's the prototype for read() versus unistd.h (or whereever it
turns out to<br>
be prototyped)?<br>
<br></div></blockquote></div><div>in newlib/libc/include/sys/unistd.h </div><div><br></div><div>_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte )); </div><div>_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte ));<br>
</div><div><br></div><div>and write function which conflicts too.</div><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
It may also be possible that the or1k port doesn't have the
underlying type<br>
definitions complete or correct.<br>
<br>
<a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html" target="_blank">http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html</a> <br>
<br>
isn't the latest but read() requires ssize_t and size_t to be
correctly and<br>
consistently defined for a target.<br>
<br>
You may end up having to reproduce the compile of crt0.c by hand and<br>
change the -c to a -E .. changing the output file.. and see what
really<br>
is being preprocessed<div><br></div></div></blockquote></div><div>I did that exactly and I found out that both read and write are prototyped as</div><div><br></div><div>int read (int __fd, void *__buf, size_t __nbyte );</div>
<div>int write (int __fd, const void *__buf, size_t __nbyte ); </div><div><br></div><div>Also there is another syntax error at crt0.c </div><div>"../../../../../../../newlib-2.1.0-or1k/newlib/libc/sys/rtems/crt0.c:74:37: error: expected ‘)’ before ‘*’ token</div>
<div> RTEMS_STUB(int, sigfillset(sigset_t *set), { return -1; })"</div><div><br></div><div>When I checked the output of -E I found out the following prototype :</div><div>int rtems_stub_sigfillset(sigset_t *set) { return -1; }; int (*(sigset_t *set) = ~(0), 0) { return -1; }<br>
</div><div><br></div><div>and </div><div>typedef unsigned long sigset_t;</div><div>is out there.</div><div><br></div><div>(I did not apply newlib-sys-signal-20130532.diff patch, yet, at the RSB which</div><div> do nothing with this error)</div>
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div>
<blockquote type="cite">
<div dir="ltr">
<div>or1k/newlib port implements some stuff at libgloss
(including or1k/crt0.S)</div>
<div><br>
</div>
</div>
</blockquote></div>
rtems uses nothing in libgloss.<div><br>
<blockquote type="cite">
<div dir="ltr">
<div>I just use --target=or1k-xxx --prefix=xxx as configuration
options for newlib.</div>
<div><br>
</div>
</div>
</blockquote></div>
The RTEMS builds take more. Check rtems-source-builder. Also if you
are<br>
not building or1k-rtems tools including binutils and gcc+newlib
together<br>
at the same time, it may be causing issues.</div></blockquote></div><div>For RSB, I can only see that newlib is linked into gcc directory and then gcc is built with</div><div>--with-newlib option (what am I missing ?)</div>
<div><br></div><div>binutils (or1k-rtems4.11-*) is installed</div><div>and exported at prefix location. The process which I make is </div><div>1- Build and install patched binutils-2.24 for RTEMS [successful]</div><div>2- Build and install bootstrap patched gcc-4.8.2 [successful]</div>
<div>3- Build and install patched newlib-2.1.0 [stuck here]</div><div>4- Build and install patched gcc-4.8.2 with newlib</div><div><br></div><div>Again, this process works fine with --target=or1k-elf and I am able to compile simple </div>
<div>hello world program, it only conflicts at the previous 3rd point when targeting </div><div>or1k-rtems4.11.</div><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <br>
<blockquote type="cite">
<div dir="ltr">
<div>Thanks,</div>
<div>Hesham</div><span><font color="#888888">
</font></span></div><span><font color="#888888">
</font></span></blockquote><span><font color="#888888">
<br>
<pre cols="72">--
Joel Sherrill, Ph.D. Director of Research & Development
<a href="mailto:joel.sherrill@OARcorp.com" target="_blank">joel.sherrill@OARcorp.com</a> On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985</pre>
</font></span></div>
</blockquote></div></div><br></div></div>
</div><br></div>