aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-04-25 15:55:36 +0100
committerMichael Brown <mcb30@ipxe.org>2014-04-25 16:06:37 +0100
commit082cedb3c3cdc5fd5eb0c614b81a1ff2ff9499be (patch)
tree95b24f7f0948e2e1d94805da0b004069f09bd5b8 /src
parentad7d5af5e19a016e484188a2c75818bb2d0a35db (diff)
downloadipxe-082cedb3c3cdc5fd5eb0c614b81a1ff2ff9499be.zip
ipxe-082cedb3c3cdc5fd5eb0c614b81a1ff2ff9499be.tar.gz
ipxe-082cedb3c3cdc5fd5eb0c614b81a1ff2ff9499be.tar.bz2
[build] Fix __libgcc attribute for recent gcc versions
We observed some time ago (in commit 4ce8d61 "Import various libgcc functions from syslinux") that gcc seems to treat calls to the implicit arithmetic functions (e.g. __udivdi3()) as being affected by -mregparm but unaffected by -mrtd. This seems to be no longer the case with current gcc versions, which treat calls to these functions as being affected by both -mregparm and -mrtd, as expected. There is nothing obvious in the gcc changelogs to indicate precisely when this happened. From experimentation with available gcc versions, the change occurred sometime between v4.6.3 and v4.7.2. We assume that only versions up to v4.6.x require the special treatment. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/include/bits/compiler.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/i386/include/bits/compiler.h b/src/arch/i386/include/bits/compiler.h
index 000db0c..d48b4b3 100644
--- a/src/arch/i386/include/bits/compiler.h
+++ b/src/arch/i386/include/bits/compiler.h
@@ -19,8 +19,19 @@ FILE_LICENCE ( GPL2_OR_LATER );
* The implicit calls to memcpy() and memset() which gcc can generate
* do not seem to have this inconsistency; -mregparm and -mrtd affect
* them in the same way as any other function.
+ *
+ * Update (25/4/14): it appears that more recent gcc versions do allow
+ * -mrtd to affect calls to the implicit arithmetic functions. There
+ * is nothing obvious in the gcc changelogs to indicate precisely when
+ * this happened. From experimentation with available gcc versions,
+ * the change occurred sometime between v4.6.3 and v4.7.2. We assume
+ * that only versions up to v4.6.x require the special treatment.
*/
+#if ( __GNUC__ < 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ <= 6 ) )
#define __libgcc __attribute__ (( cdecl ))
+#else
+#define __libgcc
+#endif
#endif /* ASSEMBLY */