diff options
author | Stefan Reinauer <stepan@coresystems.de> | 2009-09-26 15:52:05 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2009-09-26 15:52:05 +0000 |
commit | 5db685fedfe7f291719c90088bbf7618b31f3da6 (patch) | |
tree | 8dfd874dd1cae317260fbcb9703c13503e7647b1 /src/lib/gcc.c | |
parent | 19a99c6965511db908a56018c0bb586ce11ee157 (diff) | |
download | coreboot-staging-5db685fedfe7f291719c90088bbf7618b31f3da6.zip coreboot-staging-5db685fedfe7f291719c90088bbf7618b31f3da6.tar.gz |
* drop libgcc from coreboot_apc.o, not needed.
* wrap libgcc calls into regparm(0) variants so that coreboot can be compiled
with other regparm values
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4679 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/lib/gcc.c')
-rw-r--r-- | src/lib/gcc.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/gcc.c b/src/lib/gcc.c new file mode 100644 index 0000000..edd3eb9 --- /dev/null +++ b/src/lib/gcc.c @@ -0,0 +1,34 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2009 coresystems GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA + */ + +/* GCC's libgcc handling is quite broken. While the libgcc functions + * are always regparm(0) the code that calls them uses whatever the + * compiler call specifies. Therefore we need a wrapper around those + * functions. See gcc bug PR41055 for more information. + */ + +#define WRAP_LIBGCC_CALL(type, name) \ + type __real_##name(type a, type b) __attribute__((regparm(0))); \ + type __wrap_##name(type a, type b) { return __real_##name(a, b); } + +WRAP_LIBGCC_CALL(long long, __divdi3) +WRAP_LIBGCC_CALL(unsigned long long, __udivdi3) +WRAP_LIBGCC_CALL(long long, __moddi3) +WRAP_LIBGCC_CALL(unsigned long long, __umoddi3) + |