diff mbox

Compile s_llround.c with -Wno-error for x32 build

Message ID 20141219134216.GA5739@gmail.com
State Superseded
Headers show

Commit Message

H.J. Lu Dec. 19, 2014, 1:42 p.m. UTC
On x32, I got

../sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c:75:24: error:
conflicting types for built-in function ‘lround’ [-Werror]
 weak_alias (__llround, lround)
                        ^
./../include/libc-symbols.h:128:26: note: in definition of macro
‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias
(#name)));
                          ^
../sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c:75:1: note: in
expansion of macro ‘weak_alias’
 weak_alias (__llround, lround)
 ^
cc1: all warnings being treated as errors

Since x32 returns 32-bit long int and 64-bit long long int in the
same 64-bit register, we make the 32b-bit lround an alias of the
64-bit llround.  This patch adds -Wno-error for x32 build to silence
the compiler.  Verified on x32, i686 and x86-64 with GCC 4.8.3.  I
checked it in as an obvious fix.

H.J.
---
 ChangeLog                   | 4 ++++
 sysdeps/x86_64/x32/Makefile | 6 ++++++
 2 files changed, 10 insertions(+)
 create mode 100644 sysdeps/x86_64/x32/Makefile

Comments

Joseph Myers Dec. 19, 2014, 4:25 p.m. UTC | #1
On Fri, 19 Dec 2014, H.J. Lu wrote:

> On x32, I got
> 
> ../sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c:75:24: error:
> conflicting types for built-in function ‘lround’ [-Werror]
>  weak_alias (__llround, lround)
>                         ^
> ./../include/libc-symbols.h:128:26: note: in definition of macro
> ‘_weak_alias’
>    extern __typeof (name) aliasname __attribute__ ((weak, alias
> (#name)));
>                           ^
> ../sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c:75:1: note: in
> expansion of macro ‘weak_alias’
>  weak_alias (__llround, lround)
>  ^
> cc1: all warnings being treated as errors
> 
> Since x32 returns 32-bit long int and 64-bit long long int in the
> same 64-bit register, we make the 32b-bit lround an alias of the
> 64-bit llround.  This patch adds -Wno-error for x32 build to silence
> the compiler.  Verified on x32, i686 and x86-64 with GCC 4.8.3.  I
> checked it in as an obvious fix.

I think -fno-builtin-lround would be better than -Wno-error if it works to 
fix the warning.  (Cf. the CFLAGS-nldbl-*.c settings in 
sysdeps/ieee754/ldbl-opt/Makefile.)
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index eda51f8..4c6a304 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@ 
 2014-12-19  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/x86_64/x32/Makefile: New file.
+
+2014-12-19  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/i386/ldbl2mpn.c (__mpn_extract_long_double): Replace
 	1L with (mp_limb_t) 1.
 
diff --git a/sysdeps/x86_64/x32/Makefile b/sysdeps/x86_64/x32/Makefile
new file mode 100644
index 0000000..47e567c
--- /dev/null
+++ b/sysdeps/x86_64/x32/Makefile
@@ -0,0 +1,6 @@ 
+ifeq ($(subdir),math)
+# Since x32 returns 32-bit long int and 64-bit long long int in the
+# same 64-bit register, we make the 32b-bit lround an alias of the
+# 64-bit llround.  Add -Wno-error to silence the compiler.
+CFLAGS-s_llround.c += -Wno-error
+endif