Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import various libgcc functions from syslinux.
Experimentation reveals that gcc ignores -mrtd for the implicit arithmetic functions (e.g. __udivdi3), but not for the implicit memcpy() and memset() functions. Mark the implicit arithmetic functions with __attribute__((cdecl)) to compensate for this. (Note: we cannot mark with with __cdecl, because we define __cdecl to incorporate regparm(0) as well.)
- Loading branch information
Michael Brown
committed
Jul 30, 2007
1 parent
f62d648
commit 4ce8d61
Showing
9 changed files
with
134 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* arch/i386/libgcc/__divdi3.c | ||
*/ | ||
|
||
#include "libgcc.h" | ||
|
||
LIBGCC int64_t __divdi3(int64_t num, int64_t den) | ||
{ | ||
int minus = 0; | ||
int64_t v; | ||
|
||
if ( num < 0 ) { | ||
num = -num; | ||
minus = 1; | ||
} | ||
if ( den < 0 ) { | ||
den = -den; | ||
minus ^= 1; | ||
} | ||
|
||
v = __udivmoddi4(num, den, NULL); | ||
if ( minus ) | ||
v = -v; | ||
|
||
return v; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* arch/i386/libgcc/__moddi3.c | ||
*/ | ||
|
||
#include "libgcc.h" | ||
|
||
LIBGCC int64_t __moddi3(int64_t num, int64_t den) | ||
{ | ||
int minus = 0; | ||
int64_t v; | ||
|
||
if ( num < 0 ) { | ||
num = -num; | ||
minus = 1; | ||
} | ||
if ( den < 0 ) { | ||
den = -den; | ||
minus ^= 1; | ||
} | ||
|
||
(void) __udivmoddi4(num, den, (uint64_t *)&v); | ||
if ( minus ) | ||
v = -v; | ||
|
||
return v; | ||
} |
Oops, something went wrong.