i#6524: Fix udivmoddi4.c 32-bit linux build fail and semantics (#6526)

For the targets we care about LIBGCC2_UNITS_PER_WORD == 4 (SImode in GCC
parlance).
Thus a double word is 8 bytes (DImode in GCC parlance).

Previously, __moddi3 was using a mix of word and double word widths,
causing a compilation failure on 32 bit linux with the Debian 13.2.0-4
compiler.
The semantics were also incorrect: inputs and outputs should be 64 bits
for the
hosts we care about (x86, aarch, 32 and 64 bit, and riscv64).

Fixes: #6524
This commit is contained in:
xdje42
2024-02-13 13:42:10 -08:00
committed by GitHub
parent c31fbd3d68
commit 6366e1e1c3
2 changed files with 16 additions and 10 deletions
+7 -5
View File
@@ -50,11 +50,13 @@ as it breaks some old assemblers:
For udivmoddi4.c, it contains the __udivmoddi4 and __moddi3 functions extracted from
libgcc2.c with the following lines added:
> /* This is extracted from gcc's libgcc/libgcc2.c with these typedefs added: */
> typedef short Wtype;
> typedef int DWtype;
> typedef unsigned int UWtype;
> typedef unsigned long long UDWtype;
> /* This is extracted from gcc's libgcc/libgcc2.c with these typedefs added.
> Note that for current targets (x86, aarch, riscv - 32 and 64 bit)
> LIBGCC2_UNITS_PER_WORD == 4. Thus a double word is 8 bytes. */
> typedef int32_t Wtype;
> typedef int64_t DWtype;
> typedef uint32_t UWtype;
> typedef uint64_t UDWtype;
> #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
> struct DWstruct {Wtype high, low;};
> #else
+9 -5
View File
@@ -23,11 +23,15 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This is extracted from gcc's libgcc/libgcc2.c with these typedefs added: */
typedef short Wtype;
typedef int DWtype;
typedef unsigned int UWtype;
typedef unsigned long long UDWtype;
#include <stdint.h>
/* This is extracted from gcc's libgcc/libgcc2.c with these typedefs added.
Note that for current targets (x86, aarch, riscv - 32 and 64 bit)
LIBGCC2_UNITS_PER_WORD == 4. Thus a double word is 8 bytes. */
typedef int32_t Wtype;
typedef int64_t DWtype;
typedef uint32_t UWtype;
typedef uint64_t UDWtype;
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
struct DWstruct {Wtype high, low;};
#else