Build failure for 5.1.0-RC2 on Mac OS 10.8

Jack Howarth howarth at
Wed Dec 12 00:20:22 CET 2012

On Tue, Dec 11, 2012 at 11:15:35PM +0100, Torbjorn Granlund wrote:
> Jack Howarth <howarth at> writes:
>   +  .set LC1, L1-Ltab
>   +  .long	LC1
>   and his reasoning as follows...
>   --------------------------------------------------
>   The deal is, you want the assembler to evaluate the deltas and not
>   pass relocations on to the linker. You can see the compiler doing this
>   is you just compile a simple switch like:
> Thank for the information.
> This behaviour is highly unusual, and I know not all Apple assembler
> releases require that, and I would expect some Apple assemblers to
> actually reject that syntax.

   I can confirm that the attached mod_34lsub1.fixed.s can be compiled
with 'as -arch x86_64' on the following Apple Xcode releases...

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

I don't have darwin8 available to check Xcode 2.5 but David Fang
can probably check that for us.

> It should be noted that no other concurrent assemblers fail to compute
> sym1-sym2 when both symbols are in the same segment.  They don't
> require any contortions in order to trigger symbol arithmetic that is
> fully foldable.
> We know that the code of RC1 works with some Apple assemblers/linkers,
> but not with ones older and newer.  This make me take an extremely
> conservative stance wrt Apple porting.
> We will never get stable Apple support, however hard we try.  Only if
> Apple decided for what to support, and wrote a good test suite
> enforcing the decision, and educated their staff, than we could reach
> the same GMP quality with Apple as with other platforms.  But the
> damage is already done with the mess of inconsistent tools out there.
> -- 
> Torbjörn
-------------- next part --------------

	.align	5, 0x90
	.globl	___gmpn_mod_34lsub1


	mov	$0x0000FFFFFFFFFFFF, %r11

	mov	(%rdi), %rax

	cmp	$2, %rsi
	ja	Lgt2

	jb	Lone

	mov	8(%rdi), %rsi
	mov	%rax, %rdx
	shr	$48, %rax		

	and	%r11, %rdx		
	add	%rdx, %rax
	mov	%esi, %edx

	shr	$32, %rsi		
	add	%rsi, %rax

	shl	$16, %rdx		
	add	%rdx, %rax

Lgt2:	mov	8(%rdi), %rcx
	mov	16(%rdi), %rdx
	xor	%r9, %r9
	add	$24, %rdi
	sub	$12, %rsi
	jc	Lend
	.align	4, 0x90
	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	adc	$0, %r9
	add	24(%rdi), %rax
	adc	32(%rdi), %rcx
	adc	40(%rdi), %rdx
	adc	$0, %r9
	add	48(%rdi), %rax
	adc	56(%rdi), %rcx
	adc	64(%rdi), %rdx
	adc	$0, %r9
	add	$72, %rdi
	sub	$9, %rsi
	jnc	Ltop

Lend:	lea	Ltab(%rip), %r8

	movslq	36(%r8,%rsi,4), %r10
	lea	(%r10, %r8), %r8
	jmp	*%r8

  .set LC1, L1-Ltab
  .long	LC1
  .set LC2, L2-Ltab
  .long	LC2
  .set LC3, L3-Ltab
  .long	LC3
  .set LC4, L4-Ltab
  .long	LC4
  .set LC5, L5-Ltab
  .long	LC5
  .set LC6, L6-Ltab
  .long	LC6
  .set LC7, L7-Ltab
  .long	LC7
  .set LC8, L8-Ltab
  .long	LC8

L6:	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	adc	$0, %r9
	add	$24, %rdi
L3:	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	jmp	Lcj1

L7:	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	adc	$0, %r9
	add	$24, %rdi
L4:	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	adc	$0, %r9
	add	$24, %rdi
L1:	add	(%rdi), %rax
	adc	$0, %rcx
	jmp	Lcj2

L8:	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	adc	$0, %r9
	add	$24, %rdi
L5:	add	(%rdi), %rax
	adc	8(%rdi), %rcx
	adc	16(%rdi), %rdx
	adc	$0, %r9
	add	$24, %rdi
L2:	add	(%rdi), %rax
	adc	8(%rdi), %rcx

Lcj2:	adc	$0, %rdx
Lcj1:	adc	$0, %r9
L0:	add	%r9, %rax
	adc	$0, %rcx
	adc	$0, %rdx
	adc	$0, %rax

	mov	%rax, %rdi		
	shr	$48, %rax		

	and	%r11, %rdi		
	mov	%ecx, %r10d	

	shr	$32, %rcx		

	add	%rdi, %rax		
	movzwl	%dx, %edi		
	shl	$16, %r10		

	add	%rcx, %rax		
	shr	$16, %rdx		

	add	%r10, %rax		
	shl	$32, %rdi		

	add	%rdx, %rax		
	add	%rdi, %rax		


More information about the gmp-bugs mailing list