GNU bug report logs - #13118
[PATCH] factor: disable longlong.h logic for x32 builds

Previous Next

Package: coreutils;

Reported by: Mike Frysinger <vapier <at> gentoo.org>

Date: Fri, 7 Dec 2012 20:45:01 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mike Frysinger <vapier <at> gentoo.org>
Subject: bug#13118: closed (Re: bug#13118: [PATCH] factor: disable
 longlong.h logic for x32 builds)
Date: Thu, 20 Dec 2012 02:31:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#13118: [PATCH] factor: disable longlong.h logic for x32 builds

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 13118 <at> debbugs.gnu.org.

-- 
13118: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13118
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Mike Frysinger <vapier <at> gentoo.org>
Cc: 13118-done <at> debbugs.gnu.org
Subject: Re: bug#13118: [PATCH] factor: disable longlong.h logic for x32 builds
Date: Thu, 20 Dec 2012 02:29:50 +0000
On 12/07/2012 08:55 PM, Pádraig Brady wrote:
> On 12/07/2012 08:44 PM, Mike Frysinger wrote:
>> The current x86_64 asm code does not work for x32 ABIs, so disable it
>> until someone can fix it.  Simply deleting the q suffix is not enough.
>>
>> * src/longlong.h: Check for __ILP32__ for x86_64 targets.
>> ---
>>   src/longlong.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/longlong.h b/src/longlong.h
>> index f2b2c49..baf001c 100644
>> --- a/src/longlong.h
>> +++ b/src/longlong.h
>> @@ -1006,7 +1006,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
>>   #endif
>>   #endif /* 80x86 */
>>
>> -#if defined (__amd64__) && W_TYPE_SIZE == 64
>> +#if defined (__amd64__) && W_TYPE_SIZE == 64 && !defined (__ILP32__)
>>   #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
>>     __asm__ ("addq %5,%q1\n\tadcq %3,%q0"                    \
>>          : "=r" (sh), "=&r" (sl)                    \
>>
>
> I think we may go for something more general here,
> as we're having all sorts of problems in this area.
> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=history;f=src/longlong.h
>
> It seems that we need _LP64 defined,
> to enable W_TYPE_SIZE == 64 code safely.

I've not come up with anything more generic for the moment,
so will go with this slightly adjusted patch for now.
Was this a runtime or build time issue BTW?
What was the failure mode if runtime?

thanks,
Pádraig.

commit 2178e2ad8dce68862ea9545328aae999700c54cc
Author: Mike Frysinger <vapier <at> gentoo.org>
Date:   Fri Dec 7 15:44:18 2012 -0500

    factor: disable x86_64 assembly code for x32 builds

    The current x86_64 asm code does not work for x32 (__ILP32__) ABIs,
    so disable it.  Note simply deleting the q suffix is not enough.

    * src/longlong.h: Restrict x86_64 assembly to _LP64 targets,
    which is consistent with other checks in longlong.h and
    avoids this code on x32.

diff --git a/src/longlong.h b/src/longlong.h
index f2b2c49..1792045 100644
--- a/src/longlong.h
+++ b/src/longlong.h
@@ -683,7 +683,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
   && defined (_PA_RISC2_0) && defined (_LP64)
 /* Note the _PA_RISC2_0 above is to exclude this code from GCC with
    default -march options which doesn't support these instructions.
-   Also the width check for 'long' is to avoid ilp32 runtimes where
+   Also the width check for 'long' is to avoid ILP32 runtimes where
    GNU/Linux and narrow HP-UX kernels are known to have issues with
    clobbering of context between the add and add,dc instructions.  */
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
@@ -1006,7 +1006,9 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
 #endif
 #endif /* 80x86 */

-#if defined (__amd64__) && W_TYPE_SIZE == 64
+#if defined (__amd64__) && W_TYPE_SIZE == 64 && defined (_LP64)
+/* Note the width check for 'long' is to avoid ILP32 runtimes (x32)
+   where the ABI is known to be incompatible with the following.  */
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   __asm__ ("addq %5,%q1\n\tadcq %3,%q0"                                        \
           : "=r" (sh), "=&r" (sl)                                      \


[Message part 3 (message/rfc822, inline)]
From: Mike Frysinger <vapier <at> gentoo.org>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] factor: disable longlong.h logic for x32 builds
Date: Fri,  7 Dec 2012 15:44:18 -0500
The current x86_64 asm code does not work for x32 ABIs, so disable it
until someone can fix it.  Simply deleting the q suffix is not enough.

* src/longlong.h: Check for __ILP32__ for x86_64 targets.
---
 src/longlong.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/longlong.h b/src/longlong.h
index f2b2c49..baf001c 100644
--- a/src/longlong.h
+++ b/src/longlong.h
@@ -1006,7 +1006,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
 #endif
 #endif /* 80x86 */
 
-#if defined (__amd64__) && W_TYPE_SIZE == 64
+#if defined (__amd64__) && W_TYPE_SIZE == 64 && !defined (__ILP32__)
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   __asm__ ("addq %5,%q1\n\tadcq %3,%q0"					\
 	   : "=r" (sh), "=&r" (sl)					\
-- 
1.7.12.4




This bug report was last modified 12 years and 216 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.