Re: Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-07 Thread Torbjörn Granlund
I took the trouble of installing FreeBSD under qemu.  I think I
understand the problem:

sparc64-fbsd$ gcc -v
Using built-in specs.
Target: sparc64-undermydesk-freebsd
Configured with: FreeBSD/sparc64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
  

sparc64-fbsd$ as -v
GNU assembler version 2.17.50 [FreeBSD] 2007-07-03 (sparc64-unknown-freebsd) 
using BFD version 2.17.50 [FreeBSD] 2007-07-03


I've highlighted the problem with .  Yes, the provided toolchain is
hopelessly outdated.

I do not intend to spend more time on implementing workarounds for
shortcomings of a 14 year toolchain on a dead platform.  Sorry.

-- 
Torbjörn
Please encrypt, key id 0xC8601622
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-05 Thread Marc Glisse

On Fri, 5 Nov 2021, Marc Glisse wrote:


Do we test with clang on any of the sparc64-linux systems?


Hmm, I see https://reviews.llvm.org/D102985 , 
https://reviews.llvm.org/D51613 , etc, not good signs, maybe we can forget 
this suggestion.


--
Marc Glisse
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-05 Thread Alex Dupre
Marco Bodrato wrote:
>> Which lines cause these syntax errors?
> 
> It seems they are the lines containing the various %gdop*(ctz_table).

Yes, it seems so.

>> What syntax for pic data references is accepted by the assembler on
>> FreeBSD?
> 
> Unfortunately, I don't know.

Neither do I. I'm trying to see if I can get and give you remote access
to a FreeBSD sparc64 machine.

Btw, Ciao Marco, immagino tu conosca un tuo (a quanto pare ex) collega
Luigi Rizzo?

-- 
Alex Dupre

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-05 Thread Marco Bodrato

Il 2021-11-05 15:12 Torbjörn Granlund ha scritto:

Alex Dupre  writes:



  tmp-gcd_11.s: Assembler messages:
  tmp-gcd_11.s:210: Error: Illegal operands
  tmp-gcd_11.s:211: Error: Illegal operands
  tmp-gcd_11.s:212: Error: Illegal operands


Above, we saw line numbers...


  root@freebsd12:/usr/ports/math/gmp/work/gmp-6.2.1/mpn # diff
tmp-gcd_11.s.noPIC tmp-gcd_11.s
  206,209c206,212
  <   sethi   %h44(ctz_table), %o5
  <   or  %o5, %m44(ctz_table), %o5
  <   sllx%o5, 12, %o5
  <   or  %o5, %l44(ctz_table), %o5
  ---
206>   rd  %pc, %o5
207>   sethi   %hi(_GLOBAL_OFFSET_TABLE_+4), %g4
208>   add %g4, %lo(_GLOBAL_OFFSET_TABLE_+8), %g4
209>   add %o5, %g4, %g4
210>   sethi   %gdop_hix22(ctz_table), %o5
211>   xor %o5, %gdop_lox10(ctz_table), %o5
212>   ldx [%g4 + %o5], %o5, %gdop(ctz_table)


Above I added line numbers (because diff says "c206,212")


Which lines cause these syntax errors?


It seems they are the lines containing the various %gdop*(ctz_table).


What syntax for pic data references is accepted by the assembler on
FreeBSD?


Unfortunately, I don't know.

Ĝis,
m
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-05 Thread Torbjörn Granlund
Alex Dupre  writes:

  tmp-gcd_11.s: Assembler messages:
  tmp-gcd_11.s:210: Error: Illegal operands
  tmp-gcd_11.s:211: Error: Illegal operands
  tmp-gcd_11.s:212: Error: Illegal operands

  The m4-generated assembly codes above (w/ w/out PIC) differ in these lines:

  root@freebsd12:/usr/ports/math/gmp/work/gmp-6.2.1/mpn # diff 
tmp-gcd_11.s.noPIC tmp-gcd_11.s
  206,209c206,212
  <   sethi   %h44(ctz_table), %o5
  <   or  %o5, %m44(ctz_table), %o5
  <   sllx%o5, 12, %o5
  <   or  %o5, %l44(ctz_table), %o5
  ---
  >   rd  %pc, %o5
  >   sethi   %hi(_GLOBAL_OFFSET_TABLE_+4), %g4
  >   add %g4, %lo(_GLOBAL_OFFSET_TABLE_+8), %g4
  >   add %o5, %g4, %g4
  >   sethi   %gdop_hix22(ctz_table), %o5
  >   xor %o5, %gdop_lox10(ctz_table), %o5
  >   ldx [%g4 + %o5], %o5, %gdop(ctz_table)

I don't have any sparc64-freebsd system to run tests on.

Which lines cause these syntax errors?

What syntax for pic data references is accepted by the assembler on
FreeBSD?

-- 
Torbjörn
Please encrypt, key id 0xC8601622
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Fwd: math/gmp FreeBSD 12.2 Ports build failure on sparc64

2021-11-05 Thread Alex Dupre
Hello,
I'm the maintainer of the FreeBSD port of GMP. I received a few reports
about the same compilation issue with sparc64 machines, sometimes quite
detailed like the one in the attached message. I haven't a sparc64
machine and neither the skill to fix an asm issue, so I'm forwarding the
issue to you, hoping you can help/fix it. If you need additional details
I can put you in contact with one of our users.

-- 
Alex Dupre
--- Begin Message ---
Alex,

After some digging it looks like '-fPIC -DPIC' in math/gmp/mpn fails only
for the "gcd_11.asm".  All other assembly codes in this area build OK.

* Making the gcd_11.o with no "-DPIC" option to m4 works:

root@freebsd12:/usr/ports/math/gmp/work/gmp-6.2.1/mpn # /bin/ls -ld gcd_11.asm
lrwxr-xr-x  1 root  wheel  25 Sep 24 14:59 gcd_11.asm -> 
../mpn/sparc64/gcd_11.asm
root@freebsd12:/usr/ports/math/gmp/work/gmp-6.2.1/mpn # make gcd_11.o
m4 -DOPERATION_gcd_11 `test -f 'gcd_11.asm' || echo './'`gcd_11.asm 
>tmp-gcd_11.s
cc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I..  -D__GMP_WITHIN_GMP -I..  
-DOPERATION_`echo gcd_11 | sed 's/_$//'`-O2 -pipe  -fstack-protector-strong 
-fno-strict-aliasing  tmp-gcd_11.s -o gcd_11.o

* But running it within "libtool" via m4-ccas (with -fPIC -DPIC) fails:

root@freebsd12:/usr/ports/math/gmp/work/gmp-6.2.1/mpn # make gcd_11.lo
/bin/sh ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" cc 
-std=gnu99 -c -DHAVE_CONFIG_H -I. -I..  -D__GMP_WITHIN_GMP -I..  
-DOPERATION_`echo gcd_11 | sed 's/_$//'`-O2 -pipe  -fstack-protector-strong 
-fno-strict-aliasing  `test -f 'gcd_11.asm' || echo './'`gcd_11.asm
libtool: compile:  ../mpn/m4-ccas --m4=m4 cc -std=gnu99 -c -DHAVE_CONFIG_H -I. 
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_11 -O2 -pipe 
-fstack-protector-strong -fno-strict-aliasing gcd_11.asm  -fPIC -DPIC -o 
.libs/gcd_11.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_gcd_11 -DPIC gcd_11.asm 
>tmp-gcd_11.s
 cc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. 
-DOPERATION_gcd_11 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing 
tmp-gcd_11.s -fPIC -DPIC -o .libs/gcd_11.o
tmp-gcd_11.s: Assembler messages:
tmp-gcd_11.s:210: Error: Illegal operands
tmp-gcd_11.s:211: Error: Illegal operands
tmp-gcd_11.s:212: Error: Illegal operands

The m4-generated assembly codes above (w/ w/out PIC) differ in these lines:

root@freebsd12:/usr/ports/math/gmp/work/gmp-6.2.1/mpn # diff tmp-gcd_11.s.noPIC 
tmp-gcd_11.s
206,209c206,212
<   sethi   %h44(ctz_table), %o5
<   or  %o5, %m44(ctz_table), %o5
<   sllx%o5, 12, %o5
<   or  %o5, %l44(ctz_table), %o5
---
>   rd  %pc, %o5
>   sethi   %hi(_GLOBAL_OFFSET_TABLE_+4), %g4
>   add %g4, %lo(_GLOBAL_OFFSET_TABLE_+8), %g4
>   add %o5, %g4, %g4
>   sethi   %gdop_hix22(ctz_table), %o5
>   xor %o5, %gdop_lox10(ctz_table), %o5
>   ldx [%g4 + %o5], %o5, %gdop(ctz_table)

Omitting the -fPIC -DPIC for the "m4" step but including it in the "cc" step of
m4-ccas goes through..

I saw this report of a similar issue under OpenBSD:
https://openbsdmailbox.blogspot.com/2020/02/re-update-develgmp-needs-testing-on_47.html

-arun

On Mon, Sep 20, 2021 at 09:20:52AM +0200, Alex Dupre wrote:
> On 20/09/21 04:34, Arun Venkataraman wrote:
> > I have installed FreeBSD 12.2 Sparc64 on a faithful old Sun Ultra 5, and
> > currently am trying to build packages from source via the Ports Collection
> > (no binary packages are available for this arch).  The math/gmp dependency
> > build fails with the assembler complaining about Illegal Operands per the
> > attached "make" output.  (FWIW I did also try setting MAKE_JOBS_UNSAFE=yes).
> 
> I guess you enabled the CPU_OPTS option that is disabled by default.
> 
> -- 
> Alex Dupre

-- 
Arun Venkataraman 
IT Manager, Arecibo Observatory/HC03 Box 53995/Arecibo, PR 00612
--- End Message ---
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs