<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Joe Ciccone wrote:
<blockquote cite="mid47952401.1020904@gmail.com" type="cite">
  <pre wrap="">boz283 wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap=""> 

-----Original Message-----
*From:* <a class="moz-txt-link-abbreviated" href="mailto:clfs-support-bounces@lists.cross-lfs.org">clfs-support-bounces@lists.cross-lfs.org</a>
[<a class="moz-txt-link-freetext" href="mailto:clfs-support-bounces@lists.cross-lfs.org">mailto:clfs-support-bounces@lists.cross-lfs.org</a>] *On Behalf Of *boz283
*Sent:* Saturday, January 19, 2008 10:04 PM
*To:* <a class="moz-txt-link-abbreviated" href="mailto:clfs-support@lists.cross-lfs.org">clfs-support@lists.cross-lfs.org</a>
*Subject:* [Clfs-support] Compilation error for SPARC v9 Multilib

 

At section 5.9 of SPARC Cross-Compiled Linux From Scratch - Version
SVN-20080119-Sparc64-Multilib

<a class="moz-txt-link-freetext" href="http://cross-lfs.org/view/svn/sparc64/cross-tools/glibc.html">http://cross-lfs.org/view/svn/sparc64/cross-tools/glibc.html</a>

When I say make, I get the following error. I have googled for it, and
I didn’t find any error. I looked at the code and deleted “1” from one
of the parameters. But then I got to the second error which is shown
under =====.

 

 

/clfs/sources/glibc-build/nptl/pthread_cond_signal.o.dt -MT
/home/sparc/clfs/sources/glibc-build/nptl/pthread_cond_signal.o

pthread_cond_signal.c:51:19: error: macro "lll_futex_wake_unlock"
passed 5 arguments, but takes just 4

pthread_cond_signal.c: In function '__pthread_cond_signal':

pthread_cond_signal.c:49: error: 'lll_futex_wake_unlock' undeclared
(first use in this function)

pthread_cond_signal.c:49: error: (Each undeclared identifier is
reported only once

pthread_cond_signal.c:49: error: for each function it appears in.)

make[2]: ***
[/home/sparc/clfs/sources/glibc-build/nptl/pthread_cond_signal.o] Error 1

make[2]: Leaving directory `/home/sparc/clfs/sources/glibc-2.7/nptl'

make[1]: *** [nptl/subdir_lib] Error 2

make[1]: Leaving directory `/home/sparc/clfs/sources/glibc-2.7'

make: *** [all] Error 2

 

../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c: In function
'__old_sem_wait':

../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:158: error:
'futex' undeclared (first use in this function)

../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:158: error:
(Each undeclared identifier is reported only once

../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:158: error:
for each function it appears in.)

make[2]: *** [/home/sparc/clfs/sources/glibc-build/nptl/sem_wait.os]
Error 1

make[2]: Leaving directory `/home/sparc/clfs/sources/glibc-2.7/nptl'

make[1]: *** [nptl/subdir_lib] Error 2

make[1]: Leaving directory

 

 

 

I have added this to sem_wait.c at tht ebeginning of the function

Int *futex = (int *) sem;

As I have seen from this website

<a class="moz-txt-link-freetext" href="http://www.koders.com/c/fid292BACA000810CF10A513A9A4E400B574BA2BD1D.aspx">http://www.koders.com/c/fid292BACA000810CF10A513A9A4E400B574BA2BD1D.aspx</a>.

 

Glibc finished compiling without errors.

Am I doing something that is correct?


    </pre>
  </blockquote>
  <pre wrap=""><!---->I can confirm that it's broken, Looking into the fix that you posted.
_______________________________________________
Clfs-support mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Clfs-support@lists.cross-lfs.org">Clfs-support@lists.cross-lfs.org</a>
<a class="moz-txt-link-freetext" href="http://lists.cross-lfs.org/listinfo.cgi/clfs-support-cross-lfs.org">http://lists.cross-lfs.org/listinfo.cgi/clfs-support-cross-lfs.org</a>
  </pre>
</blockquote>
<br>
<pre wrap="">I have looked in to the code.
The lll_futex_wake_unlock is defined at
nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h as
#ifdef __sparc32_atomic_do_lock
/* Avoid FUTEX_WAKE_OP if supporting pre-v9 CPUs.  */
# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2) 1
#else
# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2,
private) \


So it seems that for the 32bit sparc this function returns always 1.
However there is no ifdef statement in pthread_cond_signal.c, that
changes the number of parameters this function is called.

      if (! __builtin_expect (lll_futex_wake_unlock
(&cond->__data.__futex, 1,
                                                     1,
&cond->__data.__lock,
                                                     pshared), 0))
        return 0;
      lll_futex_wake (&cond->__data.__futex, 1, pshared);

The compiler description says that "You may use |__builtin_expect| to
provide the compiler with branch prediction information." So knowing
that when I am compiling 32bit glibc for the multilib, I think I can
change the lowlevellock.h accordingly.
So I made it
#ifdef __sparc32_atomic_do_lock
/* Avoid FUTEX_WAKE_OP if supporting pre-v9 CPUs.  */
# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, <b>private</b>) 1
#else
# define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2,
private) \

Then there was another problem in sem_wait.c.
</pre>
<div
 style="border-style: none none double; border-color: -moz-use-text-color -moz-use-text-color windowtext; border-width: medium medium 2.25pt; padding: 0pt 0pt 1pt;">
<p class="MsoNormal" style="border: medium none ; padding: 0pt;"><font
 face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"></span></font><font
 face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;">../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:
In
function '__old_sem_wait':</span></font>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;"><br>
../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:158:
error: 'futex' undeclared (first use in this function)</span></font>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;"><br>
../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:158:
error: (Each undeclared identifier is reported only once</span></font>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;">../nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c:158:
error: for each function it appears in.)</span></font>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;"><br>
make[2]: *** [/home/sparc/clfs/sources/glibc-build/nptl/sem_wait.os]
Error 1</span></font>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;"><br>
make[2]: Leaving directory
`/home/sparc/clfs/sources/glibc-2.7/nptl'</span></font>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;"><br>
</span></font></p>
<font face="Arial" size="-1"><span
 style="font-size: 10pt; font-family: Arial;">make[1]: ***
[nptl/subdir_lib] Error 2</span></font>
<br>
<font size="-1"><font face="Arial"></font></font><br>
<font size="-1">make[1]: Leaving directory</font><br>
<br>
<font size="-1">I went to old versions of glibc, and i saw this patch. 
</font><font size="-1"><a class="moz-txt-link-freetext" href="http://sourceware.org/cgi-bin/cvsweb.cgi/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c.diff?cvsroot=glibc&r1=1.1&r2=1.2">http://sourceware.org/cgi-bin/cvsweb.cgi/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sem_wait.c.diff?cvsroot=glibc&r1=1.1&r2=1.2</a>
</font><br>
<pre>It seems that they have replaced the variable futex with &isem->value except line 158. So I did it, and compilation finished. I was able to complete the section successfully. I will try to compile an application and check its correctness soon.
</pre>
<br>
- val = atomic_decrement_if_positive (futex);<br>
+ val = atomic_decrement_if_positive (&isem->value);<br>
<br>
berkin<br>
<font size="-1"><br>
<br>
<br>
</font></div>
</body>
</html>