]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
ARM: Disable compat mcount code when unneeded.
authorRoland McGrath <roland@hack.frob.com>
Fri, 10 Jan 2014 21:32:35 +0000 (13:32 -0800)
committerRoland McGrath <roland@hack.frob.com>
Fri, 10 Jan 2014 21:32:35 +0000 (13:32 -0800)
ChangeLog
ports/ChangeLog.arm
ports/sysdeps/arm/arm-mcount.S
ports/sysdeps/arm/gcc-compat.h [new file with mode: 0644]
sysdeps/generic/gcc-compat.h [new file with mode: 0644]

index 9a19fbf7496e2a67e6766891d85f4078c6a61d30..81421347a8b22c9281ec1283c1e92419e539dad7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-10  Roland McGrath  <roland@hack.frob.com>
+
+       * sysdeps/generic/gcc-compat.h: New file.
+
 2014-01-10  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * benchtests/asin-inputs: Correct slow inputs.
index 313377401a22091f5a103fb9378576173b799aeb..353c3d644421600547209e9ac07cbaba80995e56 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-10  Roland McGrath  <roland@hack.frob.com>
+
+       * sysdeps/arm/arm-mcount.S:
+       #include <shlib-compat.h> and <gcc-compat.h>.
+       (_mcount): Renamed to __mcount_arm_compat.  Made conditional on
+       [GCC_COMPAT (4, 3) || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_19)].
+       (_mcount, mcount): Define (as aliases) only under [GCC_COMPAT (4, 3)],
+       with compat_symbol under [SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_19)].
+
+       * sysdeps/arm/gcc-compat.h: New file.
+
 2014-01-01  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/arm/libm-test-ulps: Regenerated.
@@ -7,7 +18,9 @@
        * sysdeps/arm/fegetround.c (fegetround): Use libm_hidden_def.
 
 2013-11-26  Ondřej Bílka  <neleai@seznam.cz>
-       * sysdeps/unix/sysv/linux/arm/bits/shm.h: Use __glibc_reserved instead __unused.
+
+       * sysdeps/unix/sysv/linux/arm/bits/shm.h: Use __glibc_reserved
+       instead of __unused.
 
 2013-11-22  Roland McGrath  <roland@hack.frob.com>
 
index 8b8653c78ebb79af3e77bea6fcfa2d165d84bec4..7e433c6ff721ef41f4508ead062f1210cd61b1eb 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <sysdep.h>
 
+#undef mcount
 
 #ifdef __thumb2__
        .thumb
@@ -65,10 +66,20 @@ ENTRY(__gnu_mcount_nc)
 END(__gnu_mcount_nc)
 
 
+#include <gcc-compat.h>
+#include <shlib-compat.h>
+
+/* The new __gnu_mcount_nc entry point was introduced in 4.4, so the
+   static library needs the old one only to support older compilers.
+   Even in a configuration that only cares about newer compilers, the
+   shared library might need it only for strict ABI compatibility.  */
+
+#if GCC_COMPAT (4, 3) || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_19)
+
 /* Provide old mcount for backwards compatibility.  This requires
    code be compiled with APCS frame pointers.  */
 
-ENTRY(_mcount)
+ENTRY(__mcount_arm_compat)
        push    {r0, r1, r2, r3, fp, lr}
        cfi_adjust_cfa_offset (24)
        cfi_rel_offset (r0, 0)
@@ -83,7 +94,7 @@ ENTRY(_mcount)
        ldrne r0, [\B, #-4]
        movsne r1, lr
        blne __mcount_internal
-#if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__)
+# if defined (__ARM_ARCH_4T__) && defined (__THUMB_INTERWORK__)
        pop     {r0, r1, r2, r3, fp, lr}
        cfi_adjust_cfa_offset (-24)
        cfi_restore (r0)
@@ -93,12 +104,26 @@ ENTRY(_mcount)
        cfi_restore (fp)
        cfi_restore (lr)
        bx lr
-#else
+# else
        pop     {r0, r1, r2, r3, fp, pc}
+# endif
+END(__mcount_arm_compat)
+
 #endif
-END(_mcount)
+
+#if GCC_COMPAT (4, 3)
+
+strong_alias (__mcount_arm_compat, _mcount)
 
 /* The canonical name for the function is `_mcount' in both C and asm,
    but some old asm code might assume it's `mcount'.  */
-#undef mcount
 weak_alias (_mcount, mcount)
+
+#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_19)
+
+compat_symbol (libc, __mcount_arm_compat, _mcount, GLIBC_2_0)
+
+strong_alias (__mcount_arm_compat, __mcount_arm_compat_1)
+compat_symbol (libc, __mcount_arm_compat_1, mcount, GLIBC_2_0)
+
+#endif
diff --git a/ports/sysdeps/arm/gcc-compat.h b/ports/sysdeps/arm/gcc-compat.h
new file mode 100644 (file)
index 0000000..680f30e
--- /dev/null
@@ -0,0 +1,35 @@
+/* Macros for checking required GCC compatibility.  ARM version.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ARM_GCC_COMPAT_H
+#define _ARM_GCC_COMPAT_H 1
+
+#ifndef GCC_COMPAT_VERSION
+# ifdef __ARM_PCS_VFP
+/* The hard-float ABI was first supported in 4.5.  */
+#  define GCC_COMPAT_VERSION    GCC_VERSION (4, 5)
+# else
+/* The EABI configurations (the only ones we handle) were first supported
+   in 4.1.  */
+#  define GCC_COMPAT_VERSION    GCC_VERSION (4, 1)
+# endif
+#endif
+
+#include_next <gcc-compat.h>
+
+#endif
diff --git a/sysdeps/generic/gcc-compat.h b/sysdeps/generic/gcc-compat.h
new file mode 100644 (file)
index 0000000..ac4fa1e
--- /dev/null
@@ -0,0 +1,42 @@
+/* Macros for checking required GCC compatibility.  Generic version.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This is the base file.  More-specific sysdeps/.../gcc-compat.h files
+   can define GCC_COMPAT_VERSION and then #include_next this file.  */
+
+#ifndef _GENERIC_GCC_COMPAT_H
+#define _GENERIC_GCC_COMPAT_H 1
+
+/* This is the macro that gets used in #if tests in code: true iff
+   the library we build must be compatible with user code built by
+   GCC version MAJOR.MINOR.  */
+#define GCC_COMPAT(major, minor)        \
+  (GCC_COMPAT_VERSION <= GCC_VERSION (major, minor))
+
+/* This is how we compose an integer from major and minor version
+   numbers, for comparison.  */
+#define GCC_VERSION(major, minor)       \
+  (((major) << 16) + (minor))
+
+#ifndef GCC_COMPAT_VERSION
+/* GCC 2.7.2 was current at the time of the glibc-2.0 release.
+   We assume nothing before that ever mattered.  */
+# define GCC_COMPAT_VERSION     GCC_VERSION (2, 7)
+#endif
+
+#endif