Build failure for 5.1.0-RC2 on Mac OS 10.8

David Fang fang at csl.cornell.edu
Thu Dec 13 00:11:43 CET 2012


Hi all,
 	Jack, I grabbed that copy of mod_34lsub1.asm and tried to 
cross-compile from powerpc-darwin8 to x86_64-darwin8, but I'm not sure 
that this works even unpatched, or I might not be configuring correctly.

I tried:
../configure --prefix=/sw --host=x86_64-apple-darwin8 ABI=64 
--libdir='/lib/gmp5' --infodir='/share/info' --enable-cxx --with-pic -C

and configure went through, having detected cross-compilation.

configure: summary of build options:

   Version:           GNU MP 5.1.0
   Host type:         x86_64-apple-darwin8
   ABI:               64
   Install prefix:    /sw
   Compiler:          gcc -std=gnu99
   Static libraries:  yes
   Shared libraries:  yes

But the build soon failed (unrelated to patch) with:

/bin/sh ../libtool --mode=compile --tag=CC ../../mpn/m4-ccas --m4="m4" gcc 
-std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP 
-I../.. -DOPERATION_`echo invert_limb_table | sed 's/_$//'`    -O2 
-pedantic -fomit-frame-pointer -m64  `test -f 'invert_limb_table.asm' || 
echo '../../mpn/'`invert_limb_table.asm
/bin/sh ../libtool --tag=CC   --mode=compile gcc -std=gnu99 
-DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. 
-DOPERATION_`echo add_1 | sed 's/_$//'`    -O2 -pedantic 
-fomit-frame-pointer -m64 -c -o add_1.lo add_1.c
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../mpn -I.. 
-D__GMP_WITHIN_GMP -I../.. -DOPERATION_add_1 -O2 -pedantic 
-fomit-frame-pointer -m64 -c add_1.c  -fno-common -DPIC -o .libs/add_1.o
libtool: compile:  ../../mpn/m4-ccas --m4=m4 gcc -std=gnu99 -c 
-DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. 
-DOPERATION_invert_limb_table -O2 -pedantic -fomit-frame-pointer -m64 
invert_limb_table.asm  -fno-common -DPIC -o .libs/invert_limb_table.o
m4  -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_invert_limb_table -DPIC 
invert_limb_table.asm >tmp-invert_limb_table.s
  gcc -std=gnu99 -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP 
-I../.. -DOPERATION_invert_limb_table -O2 -pedantic -fomit-frame-pointer 
-m64 tmp-invert_limb_table.s -fno-common -DPIC -o 
.libs/invert_limb_table.o
tmp-invert_limb_table.s:59:Unknown pseudo-op: .value
tmp-invert_limb_table.s:59:Rest of line ignored. 1st junk character valued 
48 (0).
tmp-invert_limb_table.s:60:Unknown pseudo-op: .value
tmp-invert_limb_table.s:60:Rest of line ignored. 1st junk character valued 
48 (0).

I'm not sure if the assembler is being invoked correctly, as I only see 
-m64, no reference to -arch.
According to 'man gcc' the only valid -arch options are ppc,ppc64,i368, no 
x86_64.  However /usr/libexec/gcc/darwin/x86_64/as does exist.

What options do you recommend for configuring a cross on darwin8?

Fang

> On Wed, Dec 12, 2012 at 08:23:47AM +0100, Torbjorn Granlund wrote:
>> What is the advantage of your Apple-specific code compared to the one I
>> put into the repo?
>>
>> Sure, using "long" is more compact that using quad.  But I don't think
>> the new code runs slower.  Do you disagree?
>>
>> I hesitate to change the code again for these reasons:
>>
>> 1. The repo code seem to work already, see gmplib.org/devel/tm-date.html
>> 2. We're late in the release process.
>> 3. Your code variant almost surely will not work on non-darwin systems, so
>>    we'd need to invent new m4 macros.
>> 4. I am busy writing my disertation.  :-)
>
> Torbjorn,
>    The darwin linker developer says that we should avoid your approach and use his
> for the following reason.
>
> The use of absolute addresses (in the .quad table) means the code is not PIC, so it
> cannot be used in a PIE executable which is the default for x86_64 programs (on Lion and later).
>
> I have tested my patch on Xcode 4.5.2 on darwin12, Xcode 4.5.2 on darwin11,
> Xcode 4.2 on darwin10 and Xcode 3.2.6 on darwin10. David Fang will be able
> to test darwin9 shortly.
>        Jack
> ps Note that darwin11 and later is ahead of most distros in that all executables are built
> as PIC and linked as pie to fully support Address Space Layout Randomization.
>
>>
>>  > Xcode 4.5.2 on darwin12
>>  > Xcode 4.5.2 on darwin11
>>  > Xcode 4.2 on darwin10
>>  > Xcode 3.2.6 on darwin10
>>  > Xcode 3.1.4 on darwin9
>>
>> Any chance you could check the present GMP code on these machines?
>>
>> PS. You're now the GMP project's unofficial darwin guru.  :-)
>>
>> --
>> Torbjörn
>

-- 
David Fang
http://www.csl.cornell.edu/~fang/
http://www.achronix.com/


More information about the gmp-bugs mailing list