mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 03:26:31 +01:00
steps-guix: add gcc-15.2.0 pass1 for kernel toolchain bootstrap
- add gcc-15.2.0 to steps-guix manifest after binutils-2.41 - keep full gcc-15.2.0 pass1 src_prepare cleanup/regeneration flow - switch configure/build/install to kernel toolchain bootstrap mode: --without-headers, --enable-multilib, all-gcc, all-target-libgcc - install into /kernel-toolchain and prioritize /kernel-toolchain/bin in PATH - add missing gcc distfiles entry for SARIF spec - include decDPD helper files used during src_prepare
This commit is contained in:
parent
0b16d6ddce
commit
856438676f
5 changed files with 569 additions and 1 deletions
59
steps-guix/gcc-15.2.0/files/decDPD.h.preamble
Normal file
59
steps-guix/gcc-15.2.0/files/decDPD.h.preamble
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
// SPDX-FileCopyrightText: 2007, 2009 Free Software Foundation, Inc.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
/* Conversion lookup tables for the decNumber C Library.
|
||||
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
Contributed by IBM Corporation. Author Mike Cowlishaw.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
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/>. */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* Binary Coded Decimal and Densely Packed Decimal conversion lookup tables */
|
||||
/* [Automatically generated -- do not edit. 2008.06.21] */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* For details, see DPDecimal.html on the General Decimal Arithmetic page. */
|
||||
|
||||
#include "decDPDSymbols.h"
|
||||
|
||||
/* This include file defines several DPD and BCD conversion tables: */
|
||||
/* */
|
||||
/* uint16_t BCD2DPD[2458]; -- BCD -> DPD (0x999 => 2457) */
|
||||
/* uint16_t BIN2DPD[1000]; -- Bin -> DPD (999 => 2457) */
|
||||
/* uint8_t BIN2CHAR[4001]; -- Bin -> CHAR (999 => '\3' '9' '9' '9') */
|
||||
/* uint8_t BIN2BCD8[4000]; -- Bin -> bytes (999 => 9 9 9 3) */
|
||||
/* uint16_t DPD2BCD[1024]; -- DPD -> BCD (0x3FF => 0x999) */
|
||||
/* uint16_t DPD2BIN[1024]; -- DPD -> BIN (0x3FF => 999) */
|
||||
/* uint32_t DPD2BINK[1024]; -- DPD -> BIN * 1000 (0x3FF => 999000) */
|
||||
/* uint32_t DPD2BINM[1024]; -- DPD -> BIN * 1E+6 (0x3FF => 999000000) */
|
||||
/* uint8_t DPD2BCD8[4096]; -- DPD -> bytes (x3FF => 9 9 9 3) */
|
||||
/* */
|
||||
/* In all cases the result (10 bits or 12 bits, or binary) is right-aligned */
|
||||
/* in the table entry. BIN2CHAR entries are a single byte length (0 for */
|
||||
/* value 0) followed by three digit characters; a trailing terminator is */
|
||||
/* included to allow 4-char moves always. BIN2BCD8 and DPD2BCD8 entries */
|
||||
/* are similar with the three BCD8 digits followed by a one-byte length */
|
||||
/* (again, length=0 for value 0). */
|
||||
/* */
|
||||
/* To use a table, its name, prefixed with DEC_, must be defined with a */
|
||||
/* value of 1 before this header file is included. For example: */
|
||||
/* #define DEC_BCD2DPD 1 */
|
||||
/* This mechanism allows software to only include tables that are needed. */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
228
steps-guix/gcc-15.2.0/files/decDPD_generate.c
Normal file
228
steps-guix/gcc-15.2.0/files/decDPD_generate.c
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
// SPDX-FileCopyrightText: 2025 Samuel Tyler <samuel@samuelt.me>
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* Creates decDPD.h.
|
||||
* Based upon the algorithm given on;
|
||||
* https://web.archive.org/web/20080308073422/http://www2.hursley.ibm.com/decimal/DPDecimal.html
|
||||
* originally written in the (obsolete) language Rexx.
|
||||
*
|
||||
* Is not bit-for-bit identical to the original decDPD.h, as we don't bother
|
||||
* to follow the same formatting.
|
||||
*
|
||||
* The original Rexx code follows;
|
||||
*/
|
||||
|
||||
// /* dpdGenerate.rex -- display Densely Packed Decimal table */
|
||||
// /* mfc 2000.10.03; Rexx version with new equations 2007.02.01 */
|
||||
//
|
||||
// do i=0 to 999
|
||||
// bcd=right(i, 3, 0) -- make three-digit hexadecimal string
|
||||
// bit10=bcd2dpd(x2b(bcd)) -- compress
|
||||
// bit12=dpd2bcd(bit10) -- expand
|
||||
// say bcd bit10 bit12 -- display
|
||||
// end i
|
||||
// exit
|
||||
//
|
||||
// /* bcd2dpd -- Compress BCD to Densely Packed Decimal
|
||||
// argument is a string of 12 characters, each 0 or 1, being 3 digits
|
||||
// of 4 bits, each being a valid BCD digit (0000-1001)
|
||||
// (for example, 923 is 100100100011)
|
||||
// result is a string of 10 characters, each 0 or 1
|
||||
// (for the example, this would be 1001010011)
|
||||
// */
|
||||
// bcd2dpd: procedure
|
||||
// -- assign each bit to a variable, named as in the description
|
||||
// parse arg a +1 b +1 c +1 d +1 e +1 f +1 g +1 h +1 i +1 j +1 k +1 m +1
|
||||
//
|
||||
// -- derive the result bits, using boolean expressions only
|
||||
// -- [the operators are: '&'=AND, '|'=OR, '\'=NOT.]
|
||||
// p=b | (a & j) | (a & f & i)
|
||||
// q=c | (a & k) | (a & g & i)
|
||||
// r=d
|
||||
// s=(f & (\a | \i)) | (\a & e & j) | (e & i)
|
||||
// t=g | (\a & e &k;) | (a & i)
|
||||
// u=h
|
||||
// v=a | e | i
|
||||
// w=a | (e & i) | (\e & j)
|
||||
// x=e | (a & i) | (\a & k)
|
||||
// y=m
|
||||
// -- concatenate the bits and return
|
||||
// return p||q||r||s||t||u||v||w||x||y
|
||||
//
|
||||
// /* dpd2bcd -- Expand Densely Packed Decimal to BCD
|
||||
// argument is a string of 10 characters, each 0 or 1; all 1024
|
||||
// possibilities are accepted (non-canonicals -> 999)
|
||||
// (for example, 1001010011)
|
||||
// result is a string of 12 characters, each 0 or 1
|
||||
// (for the example, 100100100011 -- 923)
|
||||
// */
|
||||
// dpd2bcd: procedure
|
||||
// -- assign each bit to a variable, named as in the description
|
||||
// parse arg p +1 q +1 r +1 s +1 t +1 u +1 v +1 w +1 x +1 y +1
|
||||
//
|
||||
// -- derive the result bits, using boolean expressions only
|
||||
// a= (v & w) & (\s | t | \x)
|
||||
// b=p & (\v | \w | (s & \t & x))
|
||||
// c=q & (\v | \w | (s & \t & x))
|
||||
// d=r
|
||||
// e=v & ((\w & x) | (\t & x) | (s & x))
|
||||
// f=(s & (\v | \x)) | (p & \s & t & v & w & x)
|
||||
// g=(t & (\v | \x)) | (q & \s & t & w)
|
||||
// h=u
|
||||
// i=v & ((\w & \x) | (w & x & (s | t)))
|
||||
// j=(\v & w) | (s & v & \w & x) | (p & w & (\x | (\s & \t)))
|
||||
// k=(\v & x) | (t & \w & x) | (q & v & w & (\x | (\s & \t)))
|
||||
// m=y
|
||||
// -- concatenate the bits and return
|
||||
// return a||b||c||d||e||f||g||h||i||j||k||m
|
||||
|
||||
void int2boolarr(uint32_t num, bool *arr, int bits) {
|
||||
int j = 0;
|
||||
for (int i = bits - 1; i >= 0; i--) {
|
||||
arr[j++] = (num >> i) & 0x1;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t boolarr2int(bool *dpd, int bits) {
|
||||
uint32_t num = 0;
|
||||
int j = 0;
|
||||
for (int i = bits - 1; i >= 0; i--) {
|
||||
num |= dpd[j++] << i;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
uint32_t bcd2dpd(uint16_t ibcd) {
|
||||
bool bcd[12];
|
||||
int2boolarr(ibcd, bcd, 12);
|
||||
|
||||
bool dpd[10];
|
||||
dpd[0] = bcd[1] | (bcd[0] & bcd[9]) | (bcd[0] & bcd[5] & bcd[8]);
|
||||
dpd[1] = bcd[2] | (bcd[0] & bcd[10]) | (bcd[0] & bcd[6] & bcd[8]);
|
||||
dpd[2] = bcd[3];
|
||||
dpd[3] = (bcd[5] & (~bcd[0] | ~bcd[8])) | (~bcd[0] & bcd[4] & bcd[9]) | (bcd[4] & bcd[8]);
|
||||
dpd[4] = bcd[6] | (~bcd[0] & bcd[4] & bcd[10]) | (bcd[0] & bcd[8]);
|
||||
dpd[5] = bcd[7];
|
||||
dpd[6] = bcd[0] | bcd[4] | bcd[8];
|
||||
dpd[7] = bcd[0] | (bcd[4] & bcd[8]) | (~bcd[4] & bcd[9]);
|
||||
dpd[8] = bcd[4] | (bcd[0] & bcd[8]) | (~bcd[0] & bcd[10]);
|
||||
dpd[9] = bcd[11];
|
||||
|
||||
return boolarr2int(dpd, 10);
|
||||
}
|
||||
|
||||
uint32_t dpd2bcd(uint32_t idpd) {
|
||||
bool dpd[10];
|
||||
int2boolarr(idpd, dpd, 10);
|
||||
|
||||
bool bcd[12];
|
||||
bcd[0] = (dpd[6] & dpd[7]) & (~dpd[3] | dpd[4] | ~dpd[8]);
|
||||
bcd[1] = dpd[0] & (~dpd[6] | ~dpd[7] | (dpd[3] & ~dpd[4] & dpd[8]));
|
||||
bcd[2] = dpd[1] & (~dpd[6] | ~dpd[7] | (dpd[3] & ~dpd[4] & dpd[8]));
|
||||
bcd[3] = dpd[2];
|
||||
bcd[4] = dpd[6] & ((~dpd[7] & dpd[8]) | (~dpd[4] & dpd[8]) | (dpd[3] & dpd[8]));
|
||||
bcd[5] = (dpd[3] & (~dpd[6] | ~dpd[8])) | (dpd[0] & ~dpd[3] & dpd[4] & dpd[6] & dpd[7] & dpd[8]);
|
||||
bcd[6] = (dpd[4] & (~dpd[6] | ~dpd[8])) | (dpd[1] & ~dpd[3] & dpd[4] & dpd[7]);
|
||||
bcd[7] = dpd[5];
|
||||
bcd[8] = dpd[6] & ((~dpd[7] & ~dpd[8]) | (dpd[7] & dpd[8] & (dpd[3] | dpd[4])));
|
||||
bcd[9] = (~dpd[6] & dpd[7]) | (dpd[3] & dpd[6] & ~dpd[7] & dpd[8]) | (dpd[0] & dpd[7] & (~dpd[8] | (~dpd[3] & ~dpd[4])));
|
||||
bcd[10] = (~dpd[6] & dpd[8]) | (dpd[4] & ~dpd[7] & dpd[8]) | (dpd[1] & dpd[6] & dpd[7] & (~dpd[8] | (~dpd[3] & ~dpd[4])));
|
||||
bcd[11] = dpd[9];
|
||||
|
||||
return boolarr2int(bcd, 12);
|
||||
}
|
||||
|
||||
uint8_t get_cntrl_char(uint8_t num) {
|
||||
if (num == 0) {
|
||||
return 0;
|
||||
} else if (num < 10) {
|
||||
return 1;
|
||||
} else if (num < 100) {
|
||||
return 2;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
void bin2char(uint8_t num, uint32_t str[4]) {
|
||||
str[0] = get_cntrl_char(num);
|
||||
str[1] = num / 100 + '0';
|
||||
str[2] = (num % 100) / 10 + '0';
|
||||
str[3] = num % 10 + '0';
|
||||
}
|
||||
|
||||
void bin2bcd8(uint8_t num, char digit[4], uint32_t arr[4]) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
arr[i] = digit[i] - '0';
|
||||
}
|
||||
arr[3] = get_cntrl_char(num);
|
||||
}
|
||||
|
||||
#define TABLES_COUNT 9
|
||||
|
||||
int main(void) {
|
||||
uint32_t BCD2DPD[2458] = {0};
|
||||
uint32_t BIN2DPD[1000] = {0};
|
||||
uint32_t BIN2BCD8[4000];
|
||||
uint32_t BIN2CHAR[4001];
|
||||
uint32_t DPD2BCD[1024] = {0};
|
||||
uint32_t DPD2BIN[1024] = {0};
|
||||
uint32_t DPD2BINK[1024] = {0};
|
||||
uint32_t DPD2BINM[1024] = {0};
|
||||
uint32_t DPD2BCD8[4096];
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
char digit[4];
|
||||
snprintf(digit, 4, "%03d", i);
|
||||
uint32_t bcd = 0;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
bcd |= (digit[j] - '0') << (4 * (2 - j));
|
||||
}
|
||||
|
||||
uint32_t dpd = bcd2dpd(bcd);
|
||||
BCD2DPD[bcd] = dpd;
|
||||
DPD2BCD[dpd] = bcd;
|
||||
BIN2DPD[i] = dpd;
|
||||
DPD2BIN[dpd] = i;
|
||||
DPD2BINK[dpd] = i * 1000;
|
||||
DPD2BINM[dpd] = i * 1E+6;
|
||||
|
||||
bin2char(i, BIN2CHAR + (4 * i));
|
||||
bin2bcd8(i, digit, BIN2BCD8 + (4 * i));
|
||||
bin2bcd8(i, digit, DPD2BCD8 + (4 * dpd));
|
||||
}
|
||||
BIN2CHAR[4000] = '\0';
|
||||
|
||||
char *names[] = {
|
||||
"BCD2DPD", "BIN2DPD", "BIN2CHAR", "BIN2BCD8", "DPD2BCD", "DPD2BIN",
|
||||
"DPD2BINK", "DPD2BINM", "DPD2BCD8",
|
||||
};
|
||||
char *types[] = {
|
||||
"uint16_t", "uint16_t", "uint8_t", "uint8_t", "uint16_t", "uint16_t",
|
||||
"uint32_t", "uint32_t", "uint8_t",
|
||||
};
|
||||
uint32_t *data[] = {
|
||||
BCD2DPD, BIN2DPD, BIN2CHAR, BIN2BCD8, DPD2BCD, DPD2BIN,
|
||||
DPD2BINK, DPD2BINM, DPD2BCD8,
|
||||
};
|
||||
int lengths[] = {2458, 1000, 4001, 4000, 1024, 1024, 1024, 1024, 4096};
|
||||
|
||||
for (int i = 0; i < TABLES_COUNT; i++) {
|
||||
printf("#if defined(DEC_%s) && DEC_%s==1 && !defined(DEC%s)\n", names[i], names[i], names[i]);
|
||||
printf("#define DEC%s\n", names[i]);
|
||||
printf("const %s %s[%d] = {\n", types[i], names[i], lengths[i]);
|
||||
for (int j = 0; j < lengths[i] / 16; j++) {
|
||||
for (int k = j * 16; k < (j + 1) * 16 && k < lengths[i]; k++) {
|
||||
printf("%s%d,", k == j * 16 ? "" : " ", data[i][k]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("};\n");
|
||||
printf("#endif\n\n");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue