Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase revyos gcc10.4 thead wip #5

Open
wants to merge 28 commits into
base: revyos-gcc10.4-thead-wip
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f2af42d
RISC-V: jal cannot refer to a default visibility symbol for shared ob…
Nov 29, 2021
437ca3b
Update RVV extension supports with 0.7&1.0.
pz9115 Jun 28, 2023
0ea890b
Remove ARCH_SPEC for thead toolchains
RevySR Apr 22, 2023
3b2be4a
Update xthead instruction format with 'th.' prefix.
pz9115 Jul 3, 2023
30a5529
Add -fzero-call-used-regs option and zero_call_used_regs function att…
Oct 30, 2020
45d2015
targhooks.c: Fix -fzero-call-used-regs 'sorry' typo
tob2 Nov 4, 2020
c61bf0a
middle-end: updating the reg use in exit block for -fzero-call-used-r…
qingzhao69 Feb 10, 2022
c8014f0
Improve sorry message for -fzero-call-used-regs
Torbjorn-Svensson Sep 15, 2022
6792a1d
Add -Wuse-after-free [PR80532].
Jan 15, 2022
3128173
RISC-V: Fix use-after-free error in `parse_multiletter_ext'
maciej-w-rozycki Jan 18, 2022
8fb1452
debug: Fix __int128 handling in dwarf2out [PR99562]
jakubjelinek Mar 22, 2021
7629244
[T-HEAD][RISCV] dsext pass: fix bug and refine dump file.
Jul 13, 2023
244e602
[T-HEAD][RISCV] dsext pass: Fix handling post_modify lbu insn.
Aug 16, 2023
60b1040
builtins: Add DFP signaling NaN built-in functions
jsm28 Nov 6, 2020
b69f7cc
c++: Replace "C++2a" with "C++20".
jicama May 13, 2020
aeb2cf1
c++: Add support for -std=c++23
pfee Jan 25, 2021
8822ea0
c++: Implement P1467R9 - Extended floating-point types and standard n…
jakubjelinek Jun 14, 2023
c5c193e
Support -fexcess-precision=16 which will enable FLT_EVAL_METHOD_PROMO…
algebra84 Aug 2, 2021
74b4563
Practical improvement to libgcc complex divide
patrickmcgehearty Apr 28, 2021
208d5e3
middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic …
jakubjelinek Jun 14, 2023
a31813c
c++, v3: Emit fundamental tinfos for _Float16/decltype(0.0bf16) types…
jakubjelinek Jun 15, 2023
8cb10ad
Revert "c, c++, c-family: -Wshift-negative-value and -Wshift-overflow…
majin2020 Jun 21, 2023
b07a4f2
c, c++, c-family: -Wshift-negative-value and -Wshift-overflow* tweaks…
jakubjelinek Mar 9, 2022
381924d
Avoid FROM being overwritten in expand_fix.
algebra84 Sep 6, 2021
ffea38a
libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf [PR107703]
jakubjelinek Mar 10, 2023
73d19df
aarch64: Add bfloat16_t support for aarch64
jakubjelinek Jun 21, 2023
2f7dc0e
fixinc: don't "fix" machine names in __has_include(...) [PR91085]
xry111 Jun 28, 2021
93ee244
Update to V2.8.0
Cooper-Qu Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 43 additions & 2 deletions fixincludes/fixfixes.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,39 @@ FIX_PROC_HEAD( char_macro_def_fix )
fputs (text, stdout);
}

/* Check if the pattern at pos is actually in a "__has_include(...)"
directive. Return the pointer to the ')' of this
"__has_include(...)" if it is, NULL otherwise. */
static const char *
check_has_inc (const char *begin, const char *pos, const char *end)
{
static const char has_inc[] = "__has_include";
const size_t has_inc_len = sizeof (has_inc) - 1;
const char *p;

for (p = memmem (begin, pos - begin, has_inc, has_inc_len);
p != NULL;
p = memmem (p, pos - p, has_inc, has_inc_len))
{
p += has_inc_len;
while (p < end && ISSPACE (*p))
p++;

/* "__has_include" may appear as "defined(__has_include)",
search for the next appearance then. */
if (*p != '(')
continue;

/* To avoid too much complexity, just hope there is never a
')' in a header name. */
p = memchr (p, ')', end - p);
if (p == NULL || p > pos)
return p;
}

return NULL;
}

/* Fix for machine name #ifdefs that are not in the namespace reserved
by the C standard. They won't be defined if compiling with -ansi,
and the headers will break. We go to some trouble to only change
Expand Down Expand Up @@ -524,7 +557,7 @@ FIX_PROC_HEAD( machine_name_fix )
/* If the 'name_pat' matches in between base and limit, we have
a bogon. It is not worth the hassle of excluding comments
because comments on #if/#ifdef lines are rare, and strings on
such lines are illegal.
such lines are only legal in a "__has_include" directive.

REG_NOTBOL means 'base' is not at the beginning of a line, which
shouldn't matter since the name_re has no ^ anchor, but let's
Expand All @@ -544,8 +577,16 @@ FIX_PROC_HEAD( machine_name_fix )
break;

p = base + match[0].rm_so;
base += match[0].rm_eo;

/* Check if the match is in __has_include(...) (PR 91085). */
q = check_has_inc (base, p, limit);
if (q)
{
base = q + 1;
goto again;
}

base += match[0].rm_eo;
/* One more test: if on the same line we have the same string
with the appropriate underscores, then leave it alone.
We want exactly two leading and trailing underscores. */
Expand Down
148 changes: 146 additions & 2 deletions fixincludes/fixincl.x
Original file line number Diff line number Diff line change
Expand Up @@ -3984,6 +3984,132 @@ static const char* apzGlibc_C99_Inline_4Patch[] = {
"%0 __attribute__ ((__gnu_inline__))",
(char*)NULL };

/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Glibc_Cxx_Floatn_1 fix
*/
tSCC zGlibc_Cxx_Floatn_1Name[] =
"glibc_cxx_floatn_1";

/*
* File name selection pattern
*/
tSCC zGlibc_Cxx_Floatn_1List[] =
"bits/floatn.h\0bits/floatn-common.h\0";
/*
* Machine/OS name selection pattern
*/
#define apzGlibc_Cxx_Floatn_1Machs (const char**)NULL

/*
* content selection pattern - do fix if pattern found
*/
tSCC zGlibc_Cxx_Floatn_1Select0[] =
"^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
(([ \t]*/\\*[^\n\
]*\\*/\n\
)?([ \t]*#[ \t]*if[^\n\
]*\n\
)?[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";

#define GLIBC_CXX_FLOATN_1_TEST_CT 1
static tTestDesc aGlibc_Cxx_Floatn_1Tests[] = {
{ TT_EGREP, zGlibc_Cxx_Floatn_1Select0, (regex_t*)NULL }, };

/*
* Fix Command Arguments for Glibc_Cxx_Floatn_1
*/
static const char* apzGlibc_Cxx_Floatn_1Patch[] = {
"format",
"%1(defined __cplusplus && !__GNUC_PREREQ (10, 4))\n\
%2",
(char*)NULL };

/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Glibc_Cxx_Floatn_2 fix
*/
tSCC zGlibc_Cxx_Floatn_2Name[] =
"glibc_cxx_floatn_2";

/*
* File name selection pattern
*/
tSCC zGlibc_Cxx_Floatn_2List[] =
"bits/floatn.h\0bits/floatn-common.h\0";
/*
* Machine/OS name selection pattern
*/
#define apzGlibc_Cxx_Floatn_2Machs (const char**)NULL

/*
* content selection pattern - do fix if pattern found
*/
tSCC zGlibc_Cxx_Floatn_2Select0[] =
"^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
(([ \t]*/\\*[^\n\
]*\\*/\n\
)?[ \t]*typedef[ \t]+[^\n\
]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";

#define GLIBC_CXX_FLOATN_2_TEST_CT 1
static tTestDesc aGlibc_Cxx_Floatn_2Tests[] = {
{ TT_EGREP, zGlibc_Cxx_Floatn_2Select0, (regex_t*)NULL }, };

/*
* Fix Command Arguments for Glibc_Cxx_Floatn_2
*/
static const char* apzGlibc_Cxx_Floatn_2Patch[] = {
"format",
"%1(defined __cplusplus && !__GNUC_PREREQ (10, 4))\n\
%2",
(char*)NULL };

/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Glibc_Cxx_Floatn_3 fix
*/
tSCC zGlibc_Cxx_Floatn_3Name[] =
"glibc_cxx_floatn_3";

/*
* File name selection pattern
*/
tSCC zGlibc_Cxx_Floatn_3List[] =
"bits/floatn.h\0bits/floatn-common.h\0";
/*
* Machine/OS name selection pattern
*/
#define apzGlibc_Cxx_Floatn_3Machs (const char**)NULL

/*
* content selection pattern - do fix if pattern found
*/
tSCC zGlibc_Cxx_Floatn_3Select0[] =
"^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
(([ \t]*/\\*[^\n\
]*\n\
?[^\n\
]*\\*/\n\
)?([ \t]*#[ \t]*if[^\n\
]*\n\
)?([ \t]*typedef[ \t]+[^\n\
]*;\n\
)?[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";

#define GLIBC_CXX_FLOATN_3_TEST_CT 1
static tTestDesc aGlibc_Cxx_Floatn_3Tests[] = {
{ TT_EGREP, zGlibc_Cxx_Floatn_3Select0, (regex_t*)NULL }, };

/*
* Fix Command Arguments for Glibc_Cxx_Floatn_3
*/
static const char* apzGlibc_Cxx_Floatn_3Patch[] = {
"format",
"%1(defined __cplusplus && !__GNUC_PREREQ (10, 4))\n\
%2",
(char*)NULL };

/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of Glibc_Mutex_Init fix
Expand Down Expand Up @@ -10476,9 +10602,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
#define REGEX_COUNT 296
#define REGEX_COUNT 299
#define MACH_LIST_SIZE_LIMIT 187
#define FIX_COUNT 258
#define FIX_COUNT 261

/*
* Enumerate the fixes
Expand Down Expand Up @@ -10578,6 +10704,9 @@ typedef enum {
GLIBC_C99_INLINE_2_FIXIDX,
GLIBC_C99_INLINE_3_FIXIDX,
GLIBC_C99_INLINE_4_FIXIDX,
GLIBC_CXX_FLOATN_1_FIXIDX,
GLIBC_CXX_FLOATN_2_FIXIDX,
GLIBC_CXX_FLOATN_3_FIXIDX,
GLIBC_MUTEX_INIT_FIXIDX,
GLIBC_STDINT_FIXIDX,
GLIBC_STRNCPY_FIXIDX,
Expand Down Expand Up @@ -11215,6 +11344,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
GLIBC_C99_INLINE_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aGlibc_C99_Inline_4Tests, apzGlibc_C99_Inline_4Patch, 0 },

{ zGlibc_Cxx_Floatn_1Name, zGlibc_Cxx_Floatn_1List,
apzGlibc_Cxx_Floatn_1Machs,
GLIBC_CXX_FLOATN_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aGlibc_Cxx_Floatn_1Tests, apzGlibc_Cxx_Floatn_1Patch, 0 },

{ zGlibc_Cxx_Floatn_2Name, zGlibc_Cxx_Floatn_2List,
apzGlibc_Cxx_Floatn_2Machs,
GLIBC_CXX_FLOATN_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aGlibc_Cxx_Floatn_2Tests, apzGlibc_Cxx_Floatn_2Patch, 0 },

{ zGlibc_Cxx_Floatn_3Name, zGlibc_Cxx_Floatn_3List,
apzGlibc_Cxx_Floatn_3Machs,
GLIBC_CXX_FLOATN_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aGlibc_Cxx_Floatn_3Tests, apzGlibc_Cxx_Floatn_3Patch, 0 },

{ zGlibc_Mutex_InitName, zGlibc_Mutex_InitList,
apzGlibc_Mutex_InitMachs,
GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
Expand Down
99 changes: 98 additions & 1 deletion fixincludes/inclhack.def
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,102 @@ fix = {
EOT;
};

/* glibc-2.27 to 2.36 assume GCC 7 or later supports some or all
* of _Float{16,32,64,128} and _Float{32,64,128}x keywords for C,
* but doesn't for C++.
*/
fix = {
hackname = glibc_cxx_floatn_1;
files = bits/floatn.h, bits/floatn-common.h;
select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
"(([ \t]*/\\*[^\n]*\\*/\n)?"
"([ \t]*#[ \t]*if[^\n]*\n)?"
"[ \t]*#[ \t]*define __f(16|32|64|128)x?\\()";
c_fix = format;
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (10, 4))\n%2";
test_text = <<-EOT
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
/* The literal suffix f128 exists only since GCC 7.0. */
# define __f128(x) x##l
# else
# define __f128(x) x##f128
# endif
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
/* The literal suffix (f128) exist for powerpc only since GCC 7.0. */
# if __LDBL_MANT_DIG__ == 113
# define __f128(x) x##l
# else
# define __f128(x) x##q
# endif
# else
# define __f128(x) x##f128
# endif
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
# ifdef __NO_LONG_DOUBLE_MATH
# define __f64(x) x##l
# else
# define __f64(x) x
# endif
# else
# define __f64(x) x##f64
# endif
EOT;
};

fix = {
hackname = glibc_cxx_floatn_2;
files = bits/floatn.h, bits/floatn-common.h;
select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
"(([ \t]*/\\*[^\n]*\\*/\n)?"
"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
c_fix = format;
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (10, 4))\n%2";
test_text = <<-EOT
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
# endif
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
typedef __float128 _Float128;
# endif
EOT;
};

fix = {
hackname = glibc_cxx_floatn_3;
files = bits/floatn.h, bits/floatn-common.h;
select = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
"(([ \t]*/\\*[^\n]*\n?[^\n]*\\*/\n)?"
"([ \t]*#[ \t]*if[^\n]*\n)?"
"([ \t]*typedef[ \t]+[^\n]*;\n)?"
"[ \t]*#[ \t]*define __CFLOAT(16|32|64|128)X?[ \t]+)";
c_fix = format;
c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (10, 4))\n%2";
test_text = <<-EOT
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
# define __CFLOAT128 _Complex long double
# else
# define __CFLOAT128 _Complex _Float128
# endif
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
/* Add a typedef for older GCC compilers which don't natively support
_Complex _Float128. */
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
# define __CFLOAT128 __cfloat128
# else
# define __CFLOAT128 _Complex _Float128
# endif
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
# ifdef __NO_LONG_DOUBLE_MATH
# define __CFLOAT64 _Complex long double
# else
# define __CFLOAT64 _Complex double
# endif
# else
# define __CFLOAT64 _Complex _Float64
# endif
EOT;
};

/* glibc-2.3.5 defines pthread mutex initializers incorrectly,
* so we replace them with versions that correspond to the
* definition.
Expand Down Expand Up @@ -3114,7 +3210,8 @@ fix = {
c_fix = machine_name;

test_text = "/* MACH_DIFF: */\n"
"#if defined( i386 ) || defined( sparc ) || defined( vax )"
"#if defined( i386 ) || defined( sparc ) || defined( vax ) || "
"defined( linux ) || __has_include ( <linux.h> )"
"\n/* no uniform test, so be careful :-) */";
};

Expand Down
Loading