Compare commits

...

51 Commits

Author SHA1 Message Date
rofl0r
6f3701d081 gcc-5.3.0: fix new build error with recent host gcc
newer gccs default to -std=c++17 which no longer allows
operator++ to be used on 'bool's.
this patch changes the type to unsigned char, just like
newer gcc versions have it.
2025-02-17 19:21:12 -05:00
rofl0r
465ad1b108 gcc-5.3.0: fix cowpatch splitting on libcc1
fixes github issue #194 - failure of cowpatch causes 0001-musl.diff
to be applied to a shadow copy of the tree, instead of where gcc
looks for the files.

fix analoguous to 91bdb320f1
2025-02-17 19:21:12 -05:00
rofl0r
f2d370bcd3 replace GCC 11.4.0 with 11.5.0
closes github issue #189 (gcc 11.4.0 fails to build)
and #190 with a backported fix that's now integrated.
fixes build with a host gcc14's more restrictive default
settings.
2025-02-17 18:01:32 -05:00
rofl0r
c1f8654e67 gcc 5-7: fix build error for x86 targets
building any of i?86, x86_64, and x32 targets on a *musl* host with a
recent gcc host version (in my testing gcc 11), fails due to attempt
to convert a pointer type (nullptr_t) implicitly to bool.

the issue affects the 3 supported gcc versions 5.3.0, 6.5.0 and 7.5.0.
2025-02-17 17:53:26 -05:00
Rich Felker
7b4c7b3152 add patches for CVE-2025-26519 to all supported musl versions 2025-02-13 16:19:00 -05:00
J. Neuschäfer
82d6c2a683 add gcc 14.2 hash and patches
The patches have been copied from 12.4.
2024-10-25 15:36:48 -04:00
J. Neuschäfer
b9789271ac add gcc 13.3 hash and patches
The patches have been copied from 12.4.
2024-10-25 15:36:48 -04:00
J. Neuschäfer
ec190b7196 add gcc 12.4 hash and patches
The patches have been copied from 11.4 and slightly adjusted to account
for renamed files (.c -> .cc).
2024-10-25 15:36:48 -04:00
rofl0r
fd6be58297 bump linux-headers to 4.19.88-2
this adds support for riscv and fixes a bug in swab.h, allowing
to build newer kernels - the objtool component is built using
host kernel headers, not the ones available in-tree.
2024-05-07 01:14:37 +00:00
Rich Felker
3d8bba9a6d add gcc 11.4.0 hash and patches, copied from 11.2.0 2024-05-06 12:36:18 -04:00
Rich Felker
d6a6d80eb2 add patch for binutils sh/fdpic bug 31619 2024-05-06 12:09:19 -04:00
Rich Felker
6486b2b2a2 add patch for gcc sh/fdpic bug 114641 2024-05-06 12:05:08 -04:00
Rich Felker
8f42acc89f remove support for non-latest gcc 9 series 2024-05-06 12:00:20 -04:00
Rich Felker
678797f062 fix fdpic regressions in gcc 10 and later
these were added when arm fdpic support was upstreamed in gcc. one patch
was just entirely wrong (broke arm init/fini arrays, gcc pr#114158) and
the other put arm-specific unwind logic in place for all fdpic targets
and broke building of the unwinder code.
2024-03-13 18:13:07 -04:00
Rich Felker
91bdb320f1 fix cowpatch issue with libstdc++-v3 directory in gcc
this directory uses relative pathnames to access libgcc unwind
headers, but with cowpatch, those are relative to the libstdc++-v3
directory in the unpatched tree unless libstdc++-v3 has been
cow-split.

this calls for a general solution at some point, but for now, just add
an explicit dummy patch to trigger cow splitting.
2024-03-13 18:13:07 -04:00
Rich Felker
e149c31c48 bump default musl version to 1.2.5 2024-02-29 21:22:15 -05:00
Rich Felker
faba06df14 add hash for musl 1.2.5 2024-02-29 21:22:08 -05:00
Viktor Szakats
26bb551045 use HTTPS when retrieving code from the internet 2024-02-22 10:27:12 -05:00
Kevin Bortis
1f5f342295 Update ISL upstream download location
http://isl.gforge.inria.fr was deprecated for some time and is now
down. This patch updates the download location to the new sourceforge
upstream location of the ISL project.
2024-02-22 10:23:52 -05:00
Rich Felker
e55fcd2d1d bump default musl version to 1.2.4 2024-02-22 10:13:22 -05:00
Rich Felker
2519caabc0 add hash for musl 1.2.4 2024-02-22 10:12:25 -05:00
rofl0r
fe915821b6 bump gcc 11.1.0 to 11.2.0 2022-04-15 15:56:08 -04:00
Szabolcs Nagy
64649ce72d add gcc-11.1.0 hash and patches 2022-04-15 15:56:08 -04:00
Rich Felker
d06727c1c4 update musl version to 1.2.3 2022-04-15 15:51:21 -04:00
fanquake
0c9116aaa7
Add hash for musl 1.2.3 2022-04-09 22:31:59 +01:00
rofl0r
0f22991b8d update linux-headers to 4.19.88-1
the new release adds support for m68k and s390x archs.
2021-09-11 21:05:46 -04:00
Szabolcs Nagy
620d5d1564 add gcc-10.3.0 hash and patches 2021-09-08 20:59:41 +00:00
Rich Felker
3398364d6e litecross: force gcc to use init/fini arrays
I overlooked that GCC was not doing this by default for musl, since
binutils ld automatically converts the .ctors/.dtors GCC emits to
init/fini arrays at link time. unfortunately lld does not do the same,
so without --enable-initfini-array, GCC produces object files that lld
will mislink unless it was configured with support for legacy GCC
ctors.
2021-07-09 12:33:39 -04:00
Rich Felker
5b405688ee add gcc patches for powerpc-spe musl dynamic linker name
spe uses -sf abi
2021-07-05 14:49:24 -04:00
Rich Felker
7600764f17 add gcc 8.x patch for powerpc-spe support
gcc 8 split this out into a separate config dir, but the files there
are old bitrotted ones without musl support.
2021-06-25 17:48:30 -04:00
Rich Felker
30454c5887 add big-hammer patch for GCC bug 95189
this is a critical wrong-codegen bug in gcc 9 and 10 that can have
security impact, and oddly the fix still does not seem to have been
backported, so just disable builtin memcmp expansion entirely until
there's a known-good fix.
2021-06-23 21:53:57 -04:00
Rich Felker
0ce03e0f46 bump default gcc version to 9.4.0 2021-06-23 21:53:57 -04:00
rofl0r
aec25e57eb add GCC 9.4.0
0017-pr93402.diff was dropped, as it was merged upstream.
2021-06-23 21:53:57 -04:00
rofl0r
c4c5b49efa update GCC 8.3.0 to 8.5.0
0017-pr93402.diff was removed, as it was merged upstream.
2021-06-23 21:53:57 -04:00
IceCodeNew
52858e01e5 Use GNU Mirror 2021-06-23 21:53:48 -04:00
IceCodeNew
ad8387d91f Update MUSL_SITE 2021-06-23 20:25:16 -04:00
rofl0r
f442c9178b replace GCC 7.3.0 with 7.5.0 2021-06-23 20:19:07 -04:00
Rich Felker
7d4c0c0dd0 update default musl version to 1.2.2 2021-06-23 16:27:00 -04:00
Rich Felker
f04af98d77 add hash for musl 1.2.2 2021-06-23 16:26:33 -04:00
Rich Felker
b12ded5078 add linux-5.8.5 headers support 2020-10-01 15:15:30 -04:00
Rich Felker
b29ed1829e update gcc futex time64 patch for compat with riscv32
riscv32 will define both syscalls but with equal value, and long will
not be the right timespec member type.
2020-09-23 17:56:47 -04:00
Rich Felker
87157fa4b4 add pattern for linux 5.x sources to makefile 2020-08-28 18:56:20 -04:00
Rich Felker
5171ee8724 update default musl version to 1.2.1 2020-08-04 12:05:32 -04:00
Rich Felker
af5993a561 add hash for musl 1.2.1 2020-08-04 12:05:04 -04:00
Rich Felker
531af98526 improve m68k sqrt patch not to suppress insn on archs where it works
the 60840 fpu and later, and coldfire fpus, have precision-specific
sqrt instructions that get used and do the right thing. only when
targeting baseline (or near-baseline) ISA does the ld80-only
instruction get used, and that's all that needs to be suppressed.
2020-07-02 12:22:13 -04:00
Rich Felker
d04fb4943f add patch fixing broken m68k sqrt
gcc pr 95921. the m68k sqrt rtl handles excess precision wrong. I
couldn't figure out how to make gcc generate the insn only for long
double, but since long double usage is rare anyway, just remove it.
this can be replaced with a proper fix later if there's ever one
upstream.
2020-06-30 16:35:55 -04:00
Rich Felker
b0820cc501 don't replace config.sub in gmp
gmp has its own wrapper version of this file and calls the real one
configfsf.sub. within the gcc build, replacing the wrong one is
harmless, but it breaks independent use of the patched gmp tree and
it's logically wrong.

patch by Laurent Bercot.
2020-06-27 01:35:13 -04:00
Rich Felker
d6ded50dd7 add patch to disable arm vdso in musl 1.2.0
reportedly the vdso version of clock_gettime64 produces erratic
results on arm with linux 5.6, and earlier versions did not have the
vdso function at all. it's not clear what the eventual upstream
solution will be, but something needs to be done so as not to be
producing binaries that seem to work now but will break fantastically
when moving to newer kernels.
2020-04-26 14:05:29 -04:00
Peter Jin
5086175f29 allow sha1 hash checking command to be configured 2020-03-07 20:55:08 -05:00
Filippo Valsorda
a54eb56f33 Use CURDIR instead of PWD
PWD is set by the shell, not make, and might not match.

For example, this broke the build through Homebrew, because
PWD stays at the directory where brew is ran.
2020-03-07 20:53:13 -05:00
Rich Felker
aacd84ed2c update cowpatch from upstream to fix regression on bash
upstream commit 1db812b0ca94d07ede9891883484f2a76dae8e23
2020-02-24 21:57:15 -05:00
197 changed files with 5244 additions and 112 deletions

View File

@ -3,30 +3,31 @@ SOURCES = sources
CONFIG_SUB_REV = 3d5db9ebe860
BINUTILS_VER = 2.33.1
GCC_VER = 9.2.0
MUSL_VER = 1.2.0
GCC_VER = 9.4.0
MUSL_VER = 1.2.5
GMP_VER = 6.1.2
MPC_VER = 1.1.0
MPFR_VER = 4.0.2
LINUX_VER = headers-4.19.88
LINUX_VER = headers-4.19.88-2
GNU_SITE = https://ftp.gnu.org/pub/gnu
GNU_SITE = https://ftpmirror.gnu.org/gnu
GCC_SITE = $(GNU_SITE)/gcc
BINUTILS_SITE = $(GNU_SITE)/binutils
GMP_SITE = $(GNU_SITE)/gmp
MPC_SITE = $(GNU_SITE)/mpc
MPFR_SITE = $(GNU_SITE)/mpfr
ISL_SITE = http://isl.gforge.inria.fr/
ISL_SITE = https://downloads.sourceforge.net/project/libisl/
MUSL_SITE = https://www.musl-libc.org/releases
MUSL_REPO = git://git.musl-libc.org/musl
MUSL_SITE = https://musl.libc.org/releases
MUSL_REPO = https://git.musl-libc.org/git/musl
LINUX_SITE = https://cdn.kernel.org/pub/linux/kernel
LINUX_HEADERS_SITE = http://ftp.barfooze.de/pub/sabotage/tarballs/
LINUX_HEADERS_SITE = https://ftp.barfooze.de/pub/sabotage/tarballs/
DL_CMD = wget -c -O
SHA1_CMD = sha1sum -c
COWPATCH = $(PWD)/cowpatch.sh
COWPATCH = $(CURDIR)/cowpatch.sh
HOST = $(if $(NATIVE),$(TARGET))
BUILD_DIR = build/$(if $(HOST),$(HOST),local)/$(TARGET)
@ -64,6 +65,7 @@ $(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/isl*)): SITE = $(ISL_SIT
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/binutils*)): SITE = $(BINUTILS_SITE)
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/gcc*)): SITE = $(GCC_SITE)/$(basename $(basename $(notdir $@)))
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/musl*)): SITE = $(MUSL_SITE)
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-5*)): SITE = $(LINUX_SITE)/v5.x
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-4*)): SITE = $(LINUX_SITE)/v4.x
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-3*)): SITE = $(LINUX_SITE)/v3.x
$(patsubst hashes/%.sha1,$(SOURCES)/%,$(wildcard hashes/linux-2.6*)): SITE = $(LINUX_SITE)/v2.6
@ -74,9 +76,9 @@ $(SOURCES):
$(SOURCES)/config.sub: | $(SOURCES)
mkdir -p $@.tmp
cd $@.tmp && $(DL_CMD) $(notdir $@) "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=$(CONFIG_SUB_REV)"
cd $@.tmp && $(DL_CMD) $(notdir $@) "https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=$(CONFIG_SUB_REV)"
cd $@.tmp && touch $(notdir $@)
cd $@.tmp && sha1sum -c $(CURDIR)/hashes/$(notdir $@).$(CONFIG_SUB_REV).sha1
cd $@.tmp && $(SHA1_CMD) $(CURDIR)/hashes/$(notdir $@).$(CONFIG_SUB_REV).sha1
mv $@.tmp/$(notdir $@) $@
rm -rf $@.tmp
@ -84,7 +86,7 @@ $(SOURCES)/%: hashes/%.sha1 | $(SOURCES)
mkdir -p $@.tmp
cd $@.tmp && $(DL_CMD) $(notdir $@) $(SITE)/$(notdir $@)
cd $@.tmp && touch $(notdir $@)
cd $@.tmp && sha1sum -c $(CURDIR)/hashes/$(notdir $@).sha1
cd $@.tmp && $(SHA1_CMD) $(CURDIR)/hashes/$(notdir $@).sha1
mv $@.tmp/$(notdir $@) $@
rm -rf $@.tmp
@ -135,7 +137,7 @@ musl-git-%:
mkdir $@.tmp
( cd $@.tmp && $(COWPATCH) -I ../$< )
test ! -d patches/$@ || cat patches/$@/* | ( cd $@.tmp && $(COWPATCH) -p1 )
test ! -f $</config.sub || ( rm -f $@.tmp/config.sub && cp -f $(SOURCES)/config.sub $@.tmp/ && chmod +x $@.tmp/config.sub )
if test -f $</configfsf.sub ; then cs=configfsf.sub ; elif test -f $</config.sub ; then cs=config.sub ; else exit 0 ; fi ; rm -f $@.tmp/$$cs && cp -f $(SOURCES)/config.sub $@.tmp/$$cs && chmod +x $@.tmp/$$cs
rm -rf $@
mv $@.tmp $@

View File

@ -46,6 +46,13 @@
# DL_CMD = wget -c -O
# DL_CMD = curl -C - -L -o
# Check sha-1 hashes of downloaded source archives. On gnu systems this is
# usually done with sha1sum.
# SHA1_CMD = sha1sum -c
# SHA1_CMD = sha1 -c
# SHA1_CMD = shasum -a 1 -c
# Something like the following can be used to produce a static-linked
# toolchain that's deployable to any system with matching arch, using
# an existing musl-targeted cross compiler. This only works if the

View File

@ -54,6 +54,7 @@ done
cowpatch () {
plev=0
OPTIND=1
while getopts ":p:i:RNE" opt ; do
test "$opt" = p && plev="$OPTARG"
done

View File

@ -0,0 +1 @@
fb51ed1660c065898c75951fb38e1ebad7d49feb gcc-10.3.0.tar.xz

View File

@ -0,0 +1 @@
f902ccacecf8949978d6261e9f1d034cff73ffdb gcc-11.2.0.tar.xz

View File

@ -0,0 +1 @@
a65b357c583e4ad8f95111d442ae51002c990f29 gcc-11.5.0.tar.xz

View File

@ -0,0 +1 @@
b373d4ac29bb06ca64d288621906cbf63ab5a1f5 gcc-12.4.0.tar.xz

View File

@ -0,0 +1 @@
6501872415823c95d48be28853ce3ebd6c1040c4 gcc-13.3.0.tar.xz

View File

@ -0,0 +1 @@
d91ecc3d20ce6298bd95f9b09cc51dc6d3c73ae3 gcc-14.2.0.tar.xz

View File

@ -1 +0,0 @@
9689b9cae7b2886fdaa08449a26701f095c04e48 gcc-7.3.0.tar.xz

View File

@ -0,0 +1 @@
9153345fa05adfa58b4759ccb9f37d09662dd101 gcc-7.5.0.tar.xz

View File

@ -1 +0,0 @@
c27f4499dd263fe4fb01bcc5565917f3698583b2 gcc-8.3.0.tar.xz

View File

@ -0,0 +1 @@
2e93f85672f57023d45c20fef9572b72f8a3e7f1 gcc-8.5.0.tar.xz

View File

@ -1 +0,0 @@
306d27c3465fa36862c206738d06d65fff5c3645 gcc-9.2.0.tar.xz

View File

@ -0,0 +1 @@
bf6d6480fb32e5a28dac849449f533a84d4e6547 gcc-9.4.0.tar.xz

View File

@ -0,0 +1 @@
6faa91e98a8cd36901cbc3c29ca67e519de9e33b linux-5.8.5.tar.xz

View File

@ -0,0 +1 @@
b35ef708c60381a566f6310a5abcb7a8f149db0d linux-headers-4.19.88-1.tar.xz

View File

@ -0,0 +1 @@
9794861f8ec91398d07694fe8a5651f9a466b967 linux-headers-4.19.88-2.tar.xz

View File

@ -0,0 +1 @@
031062cf1a3c3e81e3dbae5ad2edbeff02ca198f musl-1.2.1.tar.gz

View File

@ -0,0 +1 @@
e7ba5f0a5f89c13843b955e916f1d9a9d4b6ab9a musl-1.2.2.tar.gz

View File

@ -0,0 +1 @@
3b6b673196c2dc96b24c5d6028c5fa922457dd26 musl-1.2.3.tar.gz

View File

@ -0,0 +1 @@
78eb982244b857dbacb2ead25cc0f631ce44204d musl-1.2.4.tar.gz

View File

@ -0,0 +1 @@
36210d3423172a40ddcf83c762207c5f760b60a6 musl-1.2.5.tar.gz

View File

@ -78,6 +78,7 @@ FULL_GCC_CONFIG = --enable-languages=c,c++ \
--disable-libmudflap --disable-libsanitizer \
--disable-gnu-indirect-function \
--disable-libmpx \
--enable-initfini-array \
--enable-libstdcxx-time=rt
FULL_MUSL_CONFIG = $(MUSL_CONFIG) \

View File

@ -0,0 +1,33 @@
--- binutils-2.33.1/bfd/elf32-sh.c.orig 2024-04-04 23:11:28.739136261 +0900
+++ binutils-2.33.1/bfd/elf32-sh.c 2024-04-08 23:14:24.496915074 +0900
@@ -61,7 +61,7 @@
not. If the symbol is protected, we want the local address, but
its function descriptor must be assigned by the dynamic linker. */
#define SYMBOL_FUNCDESC_LOCAL(INFO, H) \
- (SYMBOL_REFERENCES_LOCAL (INFO, H) \
+ (!(H) || (H)->dynindx < 0 || (H)->forced_local \
|| ! elf_hash_table (INFO)->dynamic_sections_created)
#define SH_PARTIAL32 TRUE
@@ -4405,20 +4405,6 @@
/* Undefined weak symbol which will not be dynamically
resolved later; leave it at zero. */
goto funcdesc_leave_zero;
- else if (SYMBOL_CALLS_LOCAL (info, h)
- && ! SYMBOL_FUNCDESC_LOCAL (info, h))
- {
- /* If the symbol needs a non-local function descriptor
- but binds locally (i.e., its visibility is
- protected), emit a dynamic relocation decayed to
- section+offset. This is an optimization; the dynamic
- linker would resolve our function descriptor request
- to our copy of the function anyway. */
- dynindx = elf_section_data (h->root.u.def.section
- ->output_section)->dynindx;
- relocation += h->root.u.def.section->output_offset
- + h->root.u.def.value;
- }
else if (! SYMBOL_FUNCDESC_LOCAL (info, h))
{
/* If the symbol is dynamic and there will be dynamic

View File

@ -0,0 +1,33 @@
--- binutils-2.33.1/bfd/elf32-sh.c.orig 2024-04-04 23:11:28.739136261 +0900
+++ binutils-2.33.1/bfd/elf32-sh.c 2024-04-08 23:14:24.496915074 +0900
@@ -61,7 +61,7 @@
not. If the symbol is protected, we want the local address, but
its function descriptor must be assigned by the dynamic linker. */
#define SYMBOL_FUNCDESC_LOCAL(INFO, H) \
- (SYMBOL_REFERENCES_LOCAL (INFO, H) \
+ (!(H) || (H)->dynindx < 0 || (H)->forced_local \
|| ! elf_hash_table (INFO)->dynamic_sections_created)
#define SH_PARTIAL32 TRUE
@@ -4405,20 +4405,6 @@
/* Undefined weak symbol which will not be dynamically
resolved later; leave it at zero. */
goto funcdesc_leave_zero;
- else if (SYMBOL_CALLS_LOCAL (info, h)
- && ! SYMBOL_FUNCDESC_LOCAL (info, h))
- {
- /* If the symbol needs a non-local function descriptor
- but binds locally (i.e., its visibility is
- protected), emit a dynamic relocation decayed to
- section+offset. This is an optimization; the dynamic
- linker would resolve our function descriptor request
- to our copy of the function anyway. */
- dynindx = elf_section_data (h->root.u.def.section
- ->output_section)->dynindx;
- relocation += h->root.u.def.section->output_offset
- + h->root.u.def.value;
- }
else if (! SYMBOL_FUNCDESC_LOCAL (info, h))
{
/* If the symbol is dynamic and there will be dynamic

View File

@ -0,0 +1,33 @@
--- binutils-2.33.1/bfd/elf32-sh.c.orig 2024-04-04 23:11:28.739136261 +0900
+++ binutils-2.33.1/bfd/elf32-sh.c 2024-04-08 23:14:24.496915074 +0900
@@ -61,7 +61,7 @@
not. If the symbol is protected, we want the local address, but
its function descriptor must be assigned by the dynamic linker. */
#define SYMBOL_FUNCDESC_LOCAL(INFO, H) \
- (SYMBOL_REFERENCES_LOCAL (INFO, H) \
+ (!(H) || (H)->dynindx < 0 || (H)->forced_local \
|| ! elf_hash_table (INFO)->dynamic_sections_created)
#define SH_PARTIAL32 TRUE
@@ -4405,20 +4405,6 @@
/* Undefined weak symbol which will not be dynamically
resolved later; leave it at zero. */
goto funcdesc_leave_zero;
- else if (SYMBOL_CALLS_LOCAL (info, h)
- && ! SYMBOL_FUNCDESC_LOCAL (info, h))
- {
- /* If the symbol needs a non-local function descriptor
- but binds locally (i.e., its visibility is
- protected), emit a dynamic relocation decayed to
- section+offset. This is an optimization; the dynamic
- linker would resolve our function descriptor request
- to our copy of the function anyway. */
- dynindx = elf_section_data (h->root.u.def.section
- ->output_section)->dynindx;
- relocation += h->root.u.def.section->output_offset
- + h->root.u.def.value;
- }
else if (! SYMBOL_FUNCDESC_LOCAL (info, h))
{
/* If the symbol is dynamic and there will be dynamic

View File

@ -0,0 +1,33 @@
--- binutils-2.33.1/bfd/elf32-sh.c.orig 2024-04-04 23:11:28.739136261 +0900
+++ binutils-2.33.1/bfd/elf32-sh.c 2024-04-08 23:14:24.496915074 +0900
@@ -61,7 +61,7 @@
not. If the symbol is protected, we want the local address, but
its function descriptor must be assigned by the dynamic linker. */
#define SYMBOL_FUNCDESC_LOCAL(INFO, H) \
- (SYMBOL_REFERENCES_LOCAL (INFO, H) \
+ (!(H) || (H)->dynindx < 0 || (H)->forced_local \
|| ! elf_hash_table (INFO)->dynamic_sections_created)
#define SH_PARTIAL32 TRUE
@@ -4405,20 +4405,6 @@
/* Undefined weak symbol which will not be dynamically
resolved later; leave it at zero. */
goto funcdesc_leave_zero;
- else if (SYMBOL_CALLS_LOCAL (info, h)
- && ! SYMBOL_FUNCDESC_LOCAL (info, h))
- {
- /* If the symbol needs a non-local function descriptor
- but binds locally (i.e., its visibility is
- protected), emit a dynamic relocation decayed to
- section+offset. This is an optimization; the dynamic
- linker would resolve our function descriptor request
- to our copy of the function anyway. */
- dynindx = elf_section_data (h->root.u.def.section
- ->output_section)->dynindx;
- relocation += h->root.u.def.section->output_offset
- + h->root.u.def.value;
- }
else if (! SYMBOL_FUNCDESC_LOCAL (info, h))
{
/* If the symbol is dynamic and there will be dynamic

View File

@ -0,0 +1,14 @@
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 9f790db0daf..e6887590ae2 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -877,7 +877,8 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index 87344d9383f..ece428df487 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;

View File

@ -0,0 +1,346 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6fcdd771d4c..839a60d866e 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -547,7 +547,7 @@ s390*-*-*)
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
-sh[123456789lbe]*-*-* | sh-*-*)
+sh[123456789lbej]*-*-* | sh-*-*)
cpu_type=sh
extra_options="${extra_options} fused-madd.opt"
extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
@@ -3149,18 +3149,18 @@ s390x-ibm-tpf*)
extra_options="${extra_options} s390/tpf.opt"
tmake_file="${tmake_file} s390/t-s390"
;;
-sh-*-elf* | sh[12346l]*-*-elf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+sh-*-elf* | sh[12346lj]*-*-elf* | \
+ sh-*-linux* | sh[2346lbej]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
- sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
+ sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
shbe-*-* | sheb-*-*) with_endian=big,little ;;
sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;;
shl* | sh*-*-linux* | \
sh-superh-elf) with_endian=little,big ;;
- sh[1234]*-*-*) with_endian=big ;;
+ sh[j1234]*-*-*) with_endian=big ;;
*) with_endian=big,little ;;
esac
fi
@@ -3227,6 +3227,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;;
sh2a*) sh_cpu_target=sh2a ;;
sh2e*) sh_cpu_target=sh2e ;;
+ shj2*) sh_cpu_target=shj2;;
sh2*) sh_cpu_target=sh2 ;;
*) sh_cpu_target=sh1 ;;
esac
@@ -3248,7 +3249,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
- sh3e | sh3 | sh2e | sh2 | sh1) ;;
+ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
"") sh_cpu_default=${sh_cpu_target} ;;
*) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
esac
@@ -3257,9 +3258,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
+ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
esac
if test x$with_fp = xno; then
sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
@@ -3274,7 +3275,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
m1 | m2 | m2e | m3 | m3e | \
m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
- m2a | m2a-single | m2a-single-only | m2a-nofpu)
+ m2a | m2a-single | m2a-single-only | m2a-nofpu | \
+ mj2)
# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
# It is passed to MULTIILIB_OPTIONS verbatim.
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
@@ -3291,7 +3293,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
if test x${enable_incomplete_targets} = xyes ; then
- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1"
fi
tm_file="$tm_file ./sysroot-suffix.h"
tmake_file="$tmake_file t-sysroot-suffix"
@@ -5105,6 +5107,8 @@ case "${target}" in
;;
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
;;
+ mj2)
+ ;;
*)
echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
@@ -5315,7 +5319,7 @@ case ${target} in
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
;;
- sh[123456ble]*-*-* | sh-*-*)
+ sh[123456blej]*-*-* | sh-*-*)
c_target_objs="${c_target_objs} sh-c.o"
cxx_target_objs="${cxx_target_objs} sh-c.o"
;;
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 84c0ea025b4..f15552af011 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -686,6 +686,7 @@ parse_validate_atomic_model_option (const char* str)
model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
model_names[sh_atomic_model::soft_imask] = "soft-imask";
+ model_names[sh_atomic_model::hard_cas] = "hard-cas";
const char* model_cdef_names[sh_atomic_model::num_models];
model_cdef_names[sh_atomic_model::none] = "NONE";
@@ -693,6 +694,7 @@ parse_validate_atomic_model_option (const char* str)
model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
+ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
sh_atomic_model ret;
ret.type = sh_atomic_model::none;
@@ -771,6 +773,9 @@ got_mode_name:;
if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
err_ret ("cannot use atomic model %s in user mode", ret.name);
+ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
+ err_ret ("atomic model %s is only available J2 targets", ret.name);
+
return ret;
#undef err_ret
@@ -827,6 +832,8 @@ sh_option_override (void)
sh_cpu = PROCESSOR_SH2E;
if (TARGET_SH2A)
sh_cpu = PROCESSOR_SH2A;
+ if (TARGET_SHJ2)
+ sh_cpu = PROCESSOR_SHJ2;
if (TARGET_SH3)
sh_cpu = PROCESSOR_SH3;
if (TARGET_SH3E)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 8ab5455505c..6ffed6da403 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratch;
#define SUPPORT_SH4_SINGLE 1
#define SUPPORT_SH2A 1
#define SUPPORT_SH2A_SINGLE 1
+#define SUPPORT_SHJ2 1
#endif
#define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
#define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
#define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
#define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
#if SUPPORT_SH1
#define SUPPORT_SH2 1
@@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratch;
#if SUPPORT_SH2
#define SUPPORT_SH3 1
#define SUPPORT_SH2A_NOFPU 1
+#define SUPPORT_SHJ2 1
#endif
#if SUPPORT_SH3
#define SUPPORT_SH4_NOFPU 1
@@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratch;
#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
| MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
| MASK_HARD_SH4 | MASK_FPU_SINGLE \
- | MASK_FPU_SINGLE_ONLY)
+ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
/* This defaults us to big-endian. */
#ifndef TARGET_ENDIAN_DEFAULT
@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
%{m2a-single:--isa=sh2a} \
%{m2a-single-only:--isa=sh2a} \
%{m2a-nofpu:--isa=sh2a-nofpu} \
-%{m4al:-dsp}"
+%{m4al:-dsp} \
+%{mj2:-isa=j2}"
#define ASM_SPEC SH_ASM_SPEC
@@ -347,6 +351,7 @@ struct sh_atomic_model
hard_llcs,
soft_tcb,
soft_imask,
+ hard_cas,
num_models
};
@@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
#define TARGET_ATOMIC_SOFT_IMASK \
(selected_atomic_model ().type == sh_atomic_model::soft_imask)
+#define TARGET_ATOMIC_HARD_CAS \
+ (selected_atomic_model ().type == sh_atomic_model::hard_cas)
+
#endif // __cplusplus
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
/* Nonzero if the target supports dynamic shift instructions
like shad and shld. */
-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
+#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
/* The cost of using the dynamic shift insns (shad, shld) are the same
if they are available. If they are not available a library function will
@@ -1747,6 +1755,7 @@ enum processor_type {
PROCESSOR_SH2,
PROCESSOR_SH2E,
PROCESSOR_SH2A,
+ PROCESSOR_SHJ2,
PROCESSOR_SH3,
PROCESSOR_SH3E,
PROCESSOR_SH4,
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index 908603b92e1..e6108dabbc6 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -65,6 +65,10 @@ m2e
Target RejectNegative Condition(SUPPORT_SH2E)
Generate SH2e code.
+mj2
+Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
+Generate J2 code.
+
m3
Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
Generate SH3 code.
diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
index 25f3b695d2f..55119386a18 100644
--- a/gcc/config/sh/sync.md
+++ b/gcc/config/sh/sync.md
@@ -240,6 +240,9 @@
|| (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
exp_val, new_val);
+ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
+ exp_val, new_val);
else if (TARGET_ATOMIC_SOFT_GUSA)
atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
exp_val, new_val);
@@ -306,6 +309,57 @@
}
[(set_attr "length" "14")])
+(define_expand "atomic_compare_and_swapsi_cas"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "r")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{
+ rtx mem = gen_rtx_REG (SImode, 0);
+ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
+ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
+ DONE;
+})
+
+(define_insn "shj2_cas"
+ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "=r")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "0")]
+ UNSPECV_CMPXCHG_1))
+ (set (reg:SI T_REG)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
+ "TARGET_ATOMIC_HARD_CAS"
+ "cas.l %2,%0,@%1"
+ [(set_attr "length" "2")]
+)
+
+(define_expand "atomic_compare_and_swapqi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
+(define_expand "atomic_compare_and_swaphi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
;; The QIHImode llcs patterns modify the address register of the memory
;; operand. In order to express that, we have to open code the memory
;; operand. Initially the insn is expanded like every other atomic insn
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index a402359be72..dbd0bf992bf 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
m2a-single,m2a-single-only \
m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
- m4,m4-100,m4-200,m4-300,m4a; do \
+ m4,m4-100,m4-200,m4-300,m4a \
+ mj2; do \
subst= ; \
for lib in `echo $$abi|tr , ' '` ; do \
if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
@@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
# SH1 and SH2A support big endian only.
ifeq ($(DEFAULT_ENDIAN),ml)
-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
else
-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
endif
MULTILIB_OSDIRNAMES = \
@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
+ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
+ mj2=!j2
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true

View File

@ -0,0 +1,92 @@
diff --git a/gcc/common.opt b/gcc/common.opt
index ec5235c3a41..dcee05500ba 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3401,11 +3401,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index ff2e880b1fa..bafde149202 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/gcc/gcc.c b/gcc/gcc.c
index e6887590ae2..df6e3965f13 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -907,7 +907,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -931,12 +931,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC

View File

@ -0,0 +1,30 @@
diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index 698737d9b21..230d32574c6 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -46,13 +46,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace
{
+#if defined(SYS_futex_time64) && SYS_futex_time64 != SYS_futex
+ typedef struct
+ {
+ long tv_sec;
+ long tv_nsec;
+ } sys_timespec;
+#else
+ typedef struct timespec sys_timespec;
+#endif
+
// Return the relative duration from (now_s + now_ns) to (abs_s + abs_ns)
// as a timespec.
- struct timespec
+ sys_timespec
relative_timespec(chrono::seconds abs_s, chrono::nanoseconds abs_ns,
time_t now_s, long now_ns)
{
- struct timespec rt;
+ sys_timespec rt;
// Did we already time out?
if (now_s > abs_s.count())

View File

@ -0,0 +1,20 @@
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 8e35357ea23..65c8b10b3eb 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4174,13 +4174,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,11 @@
--- a/libgcc/unwind-pe.h 2024-03-14 05:59:53.754073149 +0900
+++ b/libgcc/unwind-pe.h 2024-03-14 06:00:41.226074492 +0900
@@ -262,7 +262,7 @@
if (result != 0)
{
-#if __FDPIC__
+#if __FDPIC__ && __arm__
/* FDPIC relative addresses imply taking the GOT address
into account. */
if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))

View File

@ -0,0 +1,38 @@
--- a/libgcc/crtstuff.c 2023-05-29 17:46:32.000000000 +0900
+++ b/libgcc/crtstuff.c 2024-03-14 06:03:42.398079615 +0900
@@ -441,17 +441,9 @@
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
-extern char __do_global_dtors_aux_alias;
-static void *__do_global_dtors_aux_fini_array_entry[]
-__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
- = { &__do_global_dtors_aux_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
-#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -494,17 +486,9 @@
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
-extern char __frame_dummy_alias;
-static void *__frame_dummy_init_array_entry[]
-__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
- = { &__frame_dummy_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
-#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.c.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.c 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,14 @@
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7837553958b..3c81c5798d8 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -980,7 +980,8 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index 1b0bfe37852..d7b2b19bb3c 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;

View File

@ -0,0 +1,346 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 357b0bed067..528add999f2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -556,7 +556,7 @@ s390*-*-*)
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
-sh[123456789lbe]*-*-* | sh-*-*)
+sh[123456789lbej]*-*-* | sh-*-*)
cpu_type=sh
extra_options="${extra_options} fused-madd.opt"
extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
@@ -3202,18 +3202,18 @@ s390x-ibm-tpf*)
extra_options="${extra_options} s390/tpf.opt"
tmake_file="${tmake_file} s390/t-s390"
;;
-sh-*-elf* | sh[12346l]*-*-elf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+sh-*-elf* | sh[12346lj]*-*-elf* | \
+ sh-*-linux* | sh[2346lbej]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
- sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
+ sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
shbe-*-* | sheb-*-*) with_endian=big,little ;;
sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;;
shl* | sh*-*-linux* | \
sh-superh-elf) with_endian=little,big ;;
- sh[1234]*-*-*) with_endian=big ;;
+ sh[j1234]*-*-*) with_endian=big ;;
*) with_endian=big,little ;;
esac
fi
@@ -3280,6 +3280,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;;
sh2a*) sh_cpu_target=sh2a ;;
sh2e*) sh_cpu_target=sh2e ;;
+ shj2*) sh_cpu_target=shj2;;
sh2*) sh_cpu_target=sh2 ;;
*) sh_cpu_target=sh1 ;;
esac
@@ -3301,7 +3302,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
- sh3e | sh3 | sh2e | sh2 | sh1) ;;
+ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
"") sh_cpu_default=${sh_cpu_target} ;;
*) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
esac
@@ -3310,9 +3311,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
+ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
esac
if test x$with_fp = xno; then
sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
@@ -3327,7 +3328,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
m1 | m2 | m2e | m3 | m3e | \
m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
- m2a | m2a-single | m2a-single-only | m2a-nofpu)
+ m2a | m2a-single | m2a-single-only | m2a-nofpu | \
+ mj2)
# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
# It is passed to MULTIILIB_OPTIONS verbatim.
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
@@ -3344,7 +3346,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
if test x${enable_incomplete_targets} = xyes ; then
- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1"
fi
tm_file="$tm_file ./sysroot-suffix.h"
tmake_file="$tmake_file t-sysroot-suffix"
@@ -5175,6 +5177,8 @@ case "${target}" in
;;
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
;;
+ mj2)
+ ;;
*)
echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
@@ -5385,7 +5389,7 @@ case ${target} in
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
;;
- sh[123456ble]*-*-* | sh-*-*)
+ sh[123456blej]*-*-* | sh-*-*)
c_target_objs="${c_target_objs} sh-c.o"
cxx_target_objs="${cxx_target_objs} sh-c.o"
;;
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 1564109c942..798c1c1c1a3 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -686,6 +686,7 @@ parse_validate_atomic_model_option (const char* str)
model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
model_names[sh_atomic_model::soft_imask] = "soft-imask";
+ model_names[sh_atomic_model::hard_cas] = "hard-cas";
const char* model_cdef_names[sh_atomic_model::num_models];
model_cdef_names[sh_atomic_model::none] = "NONE";
@@ -693,6 +694,7 @@ parse_validate_atomic_model_option (const char* str)
model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
+ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
sh_atomic_model ret;
ret.type = sh_atomic_model::none;
@@ -771,6 +773,9 @@ got_mode_name:;
if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
err_ret ("cannot use atomic model %s in user mode", ret.name);
+ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
+ err_ret ("atomic model %s is only available J2 targets", ret.name);
+
return ret;
#undef err_ret
@@ -827,6 +832,8 @@ sh_option_override (void)
sh_cpu = PROCESSOR_SH2E;
if (TARGET_SH2A)
sh_cpu = PROCESSOR_SH2A;
+ if (TARGET_SHJ2)
+ sh_cpu = PROCESSOR_SHJ2;
if (TARGET_SH3)
sh_cpu = PROCESSOR_SH3;
if (TARGET_SH3E)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index d2280e2ffe6..3a54a896721 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratch;
#define SUPPORT_SH4_SINGLE 1
#define SUPPORT_SH2A 1
#define SUPPORT_SH2A_SINGLE 1
+#define SUPPORT_SHJ2 1
#endif
#define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
#define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
#define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
#define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
#if SUPPORT_SH1
#define SUPPORT_SH2 1
@@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratch;
#if SUPPORT_SH2
#define SUPPORT_SH3 1
#define SUPPORT_SH2A_NOFPU 1
+#define SUPPORT_SHJ2 1
#endif
#if SUPPORT_SH3
#define SUPPORT_SH4_NOFPU 1
@@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratch;
#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
| MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
| MASK_HARD_SH4 | MASK_FPU_SINGLE \
- | MASK_FPU_SINGLE_ONLY)
+ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
/* This defaults us to big-endian. */
#ifndef TARGET_ENDIAN_DEFAULT
@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
%{m2a-single:--isa=sh2a} \
%{m2a-single-only:--isa=sh2a} \
%{m2a-nofpu:--isa=sh2a-nofpu} \
-%{m4al:-dsp}"
+%{m4al:-dsp} \
+%{mj2:-isa=j2}"
#define ASM_SPEC SH_ASM_SPEC
@@ -347,6 +351,7 @@ struct sh_atomic_model
hard_llcs,
soft_tcb,
soft_imask,
+ hard_cas,
num_models
};
@@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
#define TARGET_ATOMIC_SOFT_IMASK \
(selected_atomic_model ().type == sh_atomic_model::soft_imask)
+#define TARGET_ATOMIC_HARD_CAS \
+ (selected_atomic_model ().type == sh_atomic_model::hard_cas)
+
#endif // __cplusplus
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
/* Nonzero if the target supports dynamic shift instructions
like shad and shld. */
-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
+#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
/* The cost of using the dynamic shift insns (shad, shld) are the same
if they are available. If they are not available a library function will
@@ -1747,6 +1755,7 @@ enum processor_type {
PROCESSOR_SH2,
PROCESSOR_SH2E,
PROCESSOR_SH2A,
+ PROCESSOR_SHJ2,
PROCESSOR_SH3,
PROCESSOR_SH3E,
PROCESSOR_SH4,
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index b4755a812f3..0989a1c18da 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -65,6 +65,10 @@ m2e
Target RejectNegative Condition(SUPPORT_SH2E)
Generate SH2e code.
+mj2
+Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
+Generate J2 code.
+
m3
Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
Generate SH3 code.
diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
index 2b43f8edb86..118fc5d06db 100644
--- a/gcc/config/sh/sync.md
+++ b/gcc/config/sh/sync.md
@@ -240,6 +240,9 @@
|| (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
exp_val, new_val);
+ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
+ exp_val, new_val);
else if (TARGET_ATOMIC_SOFT_GUSA)
atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
exp_val, new_val);
@@ -306,6 +309,57 @@
}
[(set_attr "length" "14")])
+(define_expand "atomic_compare_and_swapsi_cas"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "r")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{
+ rtx mem = gen_rtx_REG (SImode, 0);
+ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
+ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
+ DONE;
+})
+
+(define_insn "shj2_cas"
+ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "=r")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "0")]
+ UNSPECV_CMPXCHG_1))
+ (set (reg:SI T_REG)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
+ "TARGET_ATOMIC_HARD_CAS"
+ "cas.l %2,%0,@%1"
+ [(set_attr "length" "2")]
+)
+
+(define_expand "atomic_compare_and_swapqi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
+(define_expand "atomic_compare_and_swaphi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
;; The QIHImode llcs patterns modify the address register of the memory
;; operand. In order to express that, we have to open code the memory
;; operand. Initially the insn is expanded like every other atomic insn
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index 888f8ff7f25..29fd6ae45fd 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
m2a-single,m2a-single-only \
m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
- m4,m4-100,m4-200,m4-300,m4a; do \
+ m4,m4-100,m4-200,m4-300,m4a \
+ mj2; do \
subst= ; \
for lib in `echo $$abi|tr , ' '` ; do \
if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
@@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
# SH1 and SH2A support big endian only.
ifeq ($(DEFAULT_ENDIAN),ml)
-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
else
-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
endif
MULTILIB_OSDIRNAMES = \
@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
+ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
+ mj2=!j2
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true

View File

@ -0,0 +1,92 @@
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 3c81c5798d8..cd96eac5d12 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC

View File

@ -0,0 +1,20 @@
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 59a456cd496..dbfddea41bd 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4174,13 +4174,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,8 @@
--- a/libstdc++-v3/ChangeLog 2024-03-13 18:04:21.050801063 -0400
+++ b/libstdc++-v3/ChangeLog 2024-03-13 18:04:25.665836804 -0400
@@ -4068,4 +4068,4 @@
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.
+notice and this notice are preserved.

View File

@ -0,0 +1,11 @@
--- a/libgcc/unwind-pe.h 2024-03-14 05:59:53.754073149 +0900
+++ b/libgcc/unwind-pe.h 2024-03-14 06:00:41.226074492 +0900
@@ -262,7 +262,7 @@
if (result != 0)
{
-#if __FDPIC__
+#if __FDPIC__ && __arm__
/* FDPIC relative addresses imply taking the GOT address
into account. */
if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))

View File

@ -0,0 +1,38 @@
--- a/libgcc/crtstuff.c 2023-05-29 17:46:32.000000000 +0900
+++ b/libgcc/crtstuff.c 2024-03-14 06:03:42.398079615 +0900
@@ -441,17 +441,9 @@
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
-extern char __do_global_dtors_aux_alias;
-static void *__do_global_dtors_aux_fini_array_entry[]
-__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
- = { &__do_global_dtors_aux_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
-#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -494,17 +486,9 @@
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
-extern char __frame_dummy_alias;
-static void *__frame_dummy_init_array_entry[]
-__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
- = { &__frame_dummy_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
-#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.c.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.c 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,14 @@
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7837553958b..3c81c5798d8 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -980,7 +980,8 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index 1b0bfe37852..d7b2b19bb3c 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;

View File

@ -0,0 +1,346 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 357b0bed067..528add999f2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -556,7 +556,7 @@ s390*-*-*)
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
-sh[123456789lbe]*-*-* | sh-*-*)
+sh[123456789lbej]*-*-* | sh-*-*)
cpu_type=sh
extra_options="${extra_options} fused-madd.opt"
extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
@@ -3202,18 +3202,18 @@ s390x-ibm-tpf*)
extra_options="${extra_options} s390/tpf.opt"
tmake_file="${tmake_file} s390/t-s390"
;;
-sh-*-elf* | sh[12346l]*-*-elf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+sh-*-elf* | sh[12346lj]*-*-elf* | \
+ sh-*-linux* | sh[2346lbej]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
- sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
+ sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
shbe-*-* | sheb-*-*) with_endian=big,little ;;
sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;;
shl* | sh*-*-linux* | \
sh-superh-elf) with_endian=little,big ;;
- sh[1234]*-*-*) with_endian=big ;;
+ sh[j1234]*-*-*) with_endian=big ;;
*) with_endian=big,little ;;
esac
fi
@@ -3280,6 +3280,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;;
sh2a*) sh_cpu_target=sh2a ;;
sh2e*) sh_cpu_target=sh2e ;;
+ shj2*) sh_cpu_target=shj2;;
sh2*) sh_cpu_target=sh2 ;;
*) sh_cpu_target=sh1 ;;
esac
@@ -3301,7 +3302,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
- sh3e | sh3 | sh2e | sh2 | sh1) ;;
+ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
"") sh_cpu_default=${sh_cpu_target} ;;
*) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
esac
@@ -3310,9 +3311,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
+ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
esac
if test x$with_fp = xno; then
sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
@@ -3327,7 +3328,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
m1 | m2 | m2e | m3 | m3e | \
m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
- m2a | m2a-single | m2a-single-only | m2a-nofpu)
+ m2a | m2a-single | m2a-single-only | m2a-nofpu | \
+ mj2)
# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
# It is passed to MULTIILIB_OPTIONS verbatim.
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
@@ -3344,7 +3346,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
if test x${enable_incomplete_targets} = xyes ; then
- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1"
fi
tm_file="$tm_file ./sysroot-suffix.h"
tmake_file="$tmake_file t-sysroot-suffix"
@@ -5175,6 +5177,8 @@ case "${target}" in
;;
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
;;
+ mj2)
+ ;;
*)
echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
@@ -5385,7 +5389,7 @@ case ${target} in
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
;;
- sh[123456ble]*-*-* | sh-*-*)
+ sh[123456blej]*-*-* | sh-*-*)
c_target_objs="${c_target_objs} sh-c.o"
cxx_target_objs="${cxx_target_objs} sh-c.o"
;;
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 1564109c942..798c1c1c1a3 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -686,6 +686,7 @@ parse_validate_atomic_model_option (const char* str)
model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
model_names[sh_atomic_model::soft_imask] = "soft-imask";
+ model_names[sh_atomic_model::hard_cas] = "hard-cas";
const char* model_cdef_names[sh_atomic_model::num_models];
model_cdef_names[sh_atomic_model::none] = "NONE";
@@ -693,6 +694,7 @@ parse_validate_atomic_model_option (const char* str)
model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
+ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
sh_atomic_model ret;
ret.type = sh_atomic_model::none;
@@ -771,6 +773,9 @@ got_mode_name:;
if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
err_ret ("cannot use atomic model %s in user mode", ret.name);
+ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
+ err_ret ("atomic model %s is only available J2 targets", ret.name);
+
return ret;
#undef err_ret
@@ -827,6 +832,8 @@ sh_option_override (void)
sh_cpu = PROCESSOR_SH2E;
if (TARGET_SH2A)
sh_cpu = PROCESSOR_SH2A;
+ if (TARGET_SHJ2)
+ sh_cpu = PROCESSOR_SHJ2;
if (TARGET_SH3)
sh_cpu = PROCESSOR_SH3;
if (TARGET_SH3E)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index d2280e2ffe6..3a54a896721 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratch;
#define SUPPORT_SH4_SINGLE 1
#define SUPPORT_SH2A 1
#define SUPPORT_SH2A_SINGLE 1
+#define SUPPORT_SHJ2 1
#endif
#define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
#define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
#define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
#define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
#if SUPPORT_SH1
#define SUPPORT_SH2 1
@@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratch;
#if SUPPORT_SH2
#define SUPPORT_SH3 1
#define SUPPORT_SH2A_NOFPU 1
+#define SUPPORT_SHJ2 1
#endif
#if SUPPORT_SH3
#define SUPPORT_SH4_NOFPU 1
@@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratch;
#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
| MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
| MASK_HARD_SH4 | MASK_FPU_SINGLE \
- | MASK_FPU_SINGLE_ONLY)
+ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
/* This defaults us to big-endian. */
#ifndef TARGET_ENDIAN_DEFAULT
@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
%{m2a-single:--isa=sh2a} \
%{m2a-single-only:--isa=sh2a} \
%{m2a-nofpu:--isa=sh2a-nofpu} \
-%{m4al:-dsp}"
+%{m4al:-dsp} \
+%{mj2:-isa=j2}"
#define ASM_SPEC SH_ASM_SPEC
@@ -347,6 +351,7 @@ struct sh_atomic_model
hard_llcs,
soft_tcb,
soft_imask,
+ hard_cas,
num_models
};
@@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
#define TARGET_ATOMIC_SOFT_IMASK \
(selected_atomic_model ().type == sh_atomic_model::soft_imask)
+#define TARGET_ATOMIC_HARD_CAS \
+ (selected_atomic_model ().type == sh_atomic_model::hard_cas)
+
#endif // __cplusplus
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
/* Nonzero if the target supports dynamic shift instructions
like shad and shld. */
-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
+#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
/* The cost of using the dynamic shift insns (shad, shld) are the same
if they are available. If they are not available a library function will
@@ -1747,6 +1755,7 @@ enum processor_type {
PROCESSOR_SH2,
PROCESSOR_SH2E,
PROCESSOR_SH2A,
+ PROCESSOR_SHJ2,
PROCESSOR_SH3,
PROCESSOR_SH3E,
PROCESSOR_SH4,
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index b4755a812f3..0989a1c18da 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -65,6 +65,10 @@ m2e
Target RejectNegative Condition(SUPPORT_SH2E)
Generate SH2e code.
+mj2
+Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
+Generate J2 code.
+
m3
Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
Generate SH3 code.
diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
index 2b43f8edb86..118fc5d06db 100644
--- a/gcc/config/sh/sync.md
+++ b/gcc/config/sh/sync.md
@@ -240,6 +240,9 @@
|| (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
exp_val, new_val);
+ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
+ exp_val, new_val);
else if (TARGET_ATOMIC_SOFT_GUSA)
atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
exp_val, new_val);
@@ -306,6 +309,57 @@
}
[(set_attr "length" "14")])
+(define_expand "atomic_compare_and_swapsi_cas"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "r")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{
+ rtx mem = gen_rtx_REG (SImode, 0);
+ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
+ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
+ DONE;
+})
+
+(define_insn "shj2_cas"
+ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "=r")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "0")]
+ UNSPECV_CMPXCHG_1))
+ (set (reg:SI T_REG)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
+ "TARGET_ATOMIC_HARD_CAS"
+ "cas.l %2,%0,@%1"
+ [(set_attr "length" "2")]
+)
+
+(define_expand "atomic_compare_and_swapqi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
+(define_expand "atomic_compare_and_swaphi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
;; The QIHImode llcs patterns modify the address register of the memory
;; operand. In order to express that, we have to open code the memory
;; operand. Initially the insn is expanded like every other atomic insn
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index 888f8ff7f25..29fd6ae45fd 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
m2a-single,m2a-single-only \
m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
- m4,m4-100,m4-200,m4-300,m4a; do \
+ m4,m4-100,m4-200,m4-300,m4a \
+ mj2; do \
subst= ; \
for lib in `echo $$abi|tr , ' '` ; do \
if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
@@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
# SH1 and SH2A support big endian only.
ifeq ($(DEFAULT_ENDIAN),ml)
-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
else
-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
endif
MULTILIB_OSDIRNAMES = \
@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
+ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
+ mj2=!j2
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true

View File

@ -0,0 +1,92 @@
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 3c81c5798d8..cd96eac5d12 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC

View File

@ -0,0 +1,20 @@
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 59a456cd496..dbfddea41bd 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4174,13 +4174,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,8 @@
--- a/libstdc++-v3/ChangeLog 2024-03-13 18:04:21.050801063 -0400
+++ b/libstdc++-v3/ChangeLog 2024-03-13 18:04:25.665836804 -0400
@@ -4068,4 +4068,4 @@
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.
+notice and this notice are preserved.

View File

@ -0,0 +1,11 @@
--- a/libgcc/unwind-pe.h 2024-03-14 05:59:53.754073149 +0900
+++ b/libgcc/unwind-pe.h 2024-03-14 06:00:41.226074492 +0900
@@ -262,7 +262,7 @@
if (result != 0)
{
-#if __FDPIC__
+#if __FDPIC__ && __arm__
/* FDPIC relative addresses imply taking the GOT address
into account. */
if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))

View File

@ -0,0 +1,38 @@
--- a/libgcc/crtstuff.c 2023-05-29 17:46:32.000000000 +0900
+++ b/libgcc/crtstuff.c 2024-03-14 06:03:42.398079615 +0900
@@ -441,17 +441,9 @@
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
-extern char __do_global_dtors_aux_alias;
-static void *__do_global_dtors_aux_fini_array_entry[]
-__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
- = { &__do_global_dtors_aux_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
-#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -494,17 +486,9 @@
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
-extern char __frame_dummy_alias;
-static void *__frame_dummy_init_array_entry[]
-__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
- = { &__frame_dummy_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
-#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.c.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.c 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,14 @@
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 7837553958b..3c81c5798d8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -980,7 +980,8 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index 1b0bfe37852..d7b2b19bb3c 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;

View File

@ -0,0 +1,346 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 357b0bed067..528add999f2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -556,7 +556,7 @@ s390*-*-*)
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
-sh[123456789lbe]*-*-* | sh-*-*)
+sh[123456789lbej]*-*-* | sh-*-*)
cpu_type=sh
extra_options="${extra_options} fused-madd.opt"
extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
@@ -3202,18 +3202,18 @@ s390x-ibm-tpf*)
extra_options="${extra_options} s390/tpf.opt"
tmake_file="${tmake_file} s390/t-s390"
;;
-sh-*-elf* | sh[12346l]*-*-elf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+sh-*-elf* | sh[12346lj]*-*-elf* | \
+ sh-*-linux* | sh[2346lbej]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
- sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
+ sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
shbe-*-* | sheb-*-*) with_endian=big,little ;;
sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;;
shl* | sh*-*-linux* | \
sh-superh-elf) with_endian=little,big ;;
- sh[1234]*-*-*) with_endian=big ;;
+ sh[j1234]*-*-*) with_endian=big ;;
*) with_endian=big,little ;;
esac
fi
@@ -3280,6 +3280,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;;
sh2a*) sh_cpu_target=sh2a ;;
sh2e*) sh_cpu_target=sh2e ;;
+ shj2*) sh_cpu_target=shj2;;
sh2*) sh_cpu_target=sh2 ;;
*) sh_cpu_target=sh1 ;;
esac
@@ -3301,7 +3302,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
- sh3e | sh3 | sh2e | sh2 | sh1) ;;
+ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
"") sh_cpu_default=${sh_cpu_target} ;;
*) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
esac
@@ -3310,9 +3311,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
+ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
esac
if test x$with_fp = xno; then
sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
@@ -3327,7 +3328,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
m1 | m2 | m2e | m3 | m3e | \
m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
- m2a | m2a-single | m2a-single-only | m2a-nofpu)
+ m2a | m2a-single | m2a-single-only | m2a-nofpu | \
+ mj2)
# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
# It is passed to MULTIILIB_OPTIONS verbatim.
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
@@ -3344,7 +3346,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
if test x${enable_incomplete_targets} = xyes ; then
- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1"
fi
tm_file="$tm_file ./sysroot-suffix.h"
tmake_file="$tmake_file t-sysroot-suffix"
@@ -5175,6 +5177,8 @@ case "${target}" in
;;
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
;;
+ mj2)
+ ;;
*)
echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
@@ -5385,7 +5389,7 @@ case ${target} in
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
;;
- sh[123456ble]*-*-* | sh-*-*)
+ sh[123456blej]*-*-* | sh-*-*)
c_target_objs="${c_target_objs} sh-c.o"
cxx_target_objs="${cxx_target_objs} sh-c.o"
;;
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index 1564109c942..798c1c1c1a3 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -686,6 +686,7 @@ parse_validate_atomic_model_option (const char* str)
model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
model_names[sh_atomic_model::soft_imask] = "soft-imask";
+ model_names[sh_atomic_model::hard_cas] = "hard-cas";
const char* model_cdef_names[sh_atomic_model::num_models];
model_cdef_names[sh_atomic_model::none] = "NONE";
@@ -693,6 +694,7 @@ parse_validate_atomic_model_option (const char* str)
model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
+ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
sh_atomic_model ret;
ret.type = sh_atomic_model::none;
@@ -771,6 +773,9 @@ got_mode_name:;
if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
err_ret ("cannot use atomic model %s in user mode", ret.name);
+ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
+ err_ret ("atomic model %s is only available J2 targets", ret.name);
+
return ret;
#undef err_ret
@@ -827,6 +832,8 @@ sh_option_override (void)
sh_cpu = PROCESSOR_SH2E;
if (TARGET_SH2A)
sh_cpu = PROCESSOR_SH2A;
+ if (TARGET_SHJ2)
+ sh_cpu = PROCESSOR_SHJ2;
if (TARGET_SH3)
sh_cpu = PROCESSOR_SH3;
if (TARGET_SH3E)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index d2280e2ffe6..3a54a896721 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratch;
#define SUPPORT_SH4_SINGLE 1
#define SUPPORT_SH2A 1
#define SUPPORT_SH2A_SINGLE 1
+#define SUPPORT_SHJ2 1
#endif
#define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
#define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
#define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
#define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
#if SUPPORT_SH1
#define SUPPORT_SH2 1
@@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratch;
#if SUPPORT_SH2
#define SUPPORT_SH3 1
#define SUPPORT_SH2A_NOFPU 1
+#define SUPPORT_SHJ2 1
#endif
#if SUPPORT_SH3
#define SUPPORT_SH4_NOFPU 1
@@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratch;
#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
| MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
| MASK_HARD_SH4 | MASK_FPU_SINGLE \
- | MASK_FPU_SINGLE_ONLY)
+ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
/* This defaults us to big-endian. */
#ifndef TARGET_ENDIAN_DEFAULT
@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
%{m2a-single:--isa=sh2a} \
%{m2a-single-only:--isa=sh2a} \
%{m2a-nofpu:--isa=sh2a-nofpu} \
-%{m4al:-dsp}"
+%{m4al:-dsp} \
+%{mj2:-isa=j2}"
#define ASM_SPEC SH_ASM_SPEC
@@ -347,6 +351,7 @@ struct sh_atomic_model
hard_llcs,
soft_tcb,
soft_imask,
+ hard_cas,
num_models
};
@@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
#define TARGET_ATOMIC_SOFT_IMASK \
(selected_atomic_model ().type == sh_atomic_model::soft_imask)
+#define TARGET_ATOMIC_HARD_CAS \
+ (selected_atomic_model ().type == sh_atomic_model::hard_cas)
+
#endif // __cplusplus
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
/* Nonzero if the target supports dynamic shift instructions
like shad and shld. */
-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
+#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
/* The cost of using the dynamic shift insns (shad, shld) are the same
if they are available. If they are not available a library function will
@@ -1747,6 +1755,7 @@ enum processor_type {
PROCESSOR_SH2,
PROCESSOR_SH2E,
PROCESSOR_SH2A,
+ PROCESSOR_SHJ2,
PROCESSOR_SH3,
PROCESSOR_SH3E,
PROCESSOR_SH4,
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index b4755a812f3..0989a1c18da 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -65,6 +65,10 @@ m2e
Target RejectNegative Condition(SUPPORT_SH2E)
Generate SH2e code.
+mj2
+Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
+Generate J2 code.
+
m3
Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
Generate SH3 code.
diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
index 2b43f8edb86..118fc5d06db 100644
--- a/gcc/config/sh/sync.md
+++ b/gcc/config/sh/sync.md
@@ -240,6 +240,9 @@
|| (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
exp_val, new_val);
+ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
+ exp_val, new_val);
else if (TARGET_ATOMIC_SOFT_GUSA)
atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
exp_val, new_val);
@@ -306,6 +309,57 @@
}
[(set_attr "length" "14")])
+(define_expand "atomic_compare_and_swapsi_cas"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "r")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{
+ rtx mem = gen_rtx_REG (SImode, 0);
+ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
+ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
+ DONE;
+})
+
+(define_insn "shj2_cas"
+ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "=r")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "0")]
+ UNSPECV_CMPXCHG_1))
+ (set (reg:SI T_REG)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
+ "TARGET_ATOMIC_HARD_CAS"
+ "cas.l %2,%0,@%1"
+ [(set_attr "length" "2")]
+)
+
+(define_expand "atomic_compare_and_swapqi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
+(define_expand "atomic_compare_and_swaphi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
;; The QIHImode llcs patterns modify the address register of the memory
;; operand. In order to express that, we have to open code the memory
;; operand. Initially the insn is expanded like every other atomic insn
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index 888f8ff7f25..29fd6ae45fd 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
m2a-single,m2a-single-only \
m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
- m4,m4-100,m4-200,m4-300,m4a; do \
+ m4,m4-100,m4-200,m4-300,m4a \
+ mj2; do \
subst= ; \
for lib in `echo $$abi|tr , ' '` ; do \
if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
@@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
# SH1 and SH2A support big endian only.
ifeq ($(DEFAULT_ENDIAN),ml)
-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
else
-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
endif
MULTILIB_OSDIRNAMES = \
@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
+ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
+ mj2=!j2
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true

View File

@ -0,0 +1,92 @@
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 3c81c5798d8..cd96eac5d12 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC

View File

@ -0,0 +1,20 @@
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 59a456cd496..dbfddea41bd 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4174,13 +4174,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,8 @@
--- a/libstdc++-v3/ChangeLog 2024-03-13 18:04:21.050801063 -0400
+++ b/libstdc++-v3/ChangeLog 2024-03-13 18:04:25.665836804 -0400
@@ -4068,4 +4068,4 @@
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.
+notice and this notice are preserved.

View File

@ -0,0 +1,11 @@
--- a/libgcc/unwind-pe.h 2024-03-14 05:59:53.754073149 +0900
+++ b/libgcc/unwind-pe.h 2024-03-14 06:00:41.226074492 +0900
@@ -262,7 +262,7 @@
if (result != 0)
{
-#if __FDPIC__
+#if __FDPIC__ && __arm__
/* FDPIC relative addresses imply taking the GOT address
into account. */
if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))

View File

@ -0,0 +1,38 @@
--- a/libgcc/crtstuff.c 2023-05-29 17:46:32.000000000 +0900
+++ b/libgcc/crtstuff.c 2024-03-14 06:03:42.398079615 +0900
@@ -441,17 +441,9 @@
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
-extern char __do_global_dtors_aux_alias;
-static void *__do_global_dtors_aux_fini_array_entry[]
-__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
- = { &__do_global_dtors_aux_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
-#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -494,17 +486,9 @@
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
-extern char __frame_dummy_alias;
-static void *__frame_dummy_init_array_entry[]
-__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
- = { &__frame_dummy_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
-#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.cc.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.cc 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,14 @@
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 7837553958b..3c81c5798d8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -980,7 +980,8 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index 1b0bfe37852..d7b2b19bb3c 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;

View File

@ -0,0 +1,346 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 357b0bed067..528add999f2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -556,7 +556,7 @@ s390*-*-*)
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
-sh[123456789lbe]*-*-* | sh-*-*)
+sh[123456789lbej]*-*-* | sh-*-*)
cpu_type=sh
extra_options="${extra_options} fused-madd.opt"
extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
@@ -3202,18 +3202,18 @@ s390x-ibm-tpf*)
extra_options="${extra_options} s390/tpf.opt"
tmake_file="${tmake_file} s390/t-s390"
;;
-sh-*-elf* | sh[12346l]*-*-elf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+sh-*-elf* | sh[12346lj]*-*-elf* | \
+ sh-*-linux* | sh[2346lbej]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
- sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
+ sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
shbe-*-* | sheb-*-*) with_endian=big,little ;;
sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;;
shl* | sh*-*-linux* | \
sh-superh-elf) with_endian=little,big ;;
- sh[1234]*-*-*) with_endian=big ;;
+ sh[j1234]*-*-*) with_endian=big ;;
*) with_endian=big,little ;;
esac
fi
@@ -3280,6 +3280,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;;
sh2a*) sh_cpu_target=sh2a ;;
sh2e*) sh_cpu_target=sh2e ;;
+ shj2*) sh_cpu_target=shj2;;
sh2*) sh_cpu_target=sh2 ;;
*) sh_cpu_target=sh1 ;;
esac
@@ -3301,7 +3302,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
- sh3e | sh3 | sh2e | sh2 | sh1) ;;
+ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
"") sh_cpu_default=${sh_cpu_target} ;;
*) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
esac
@@ -3310,9 +3311,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
+ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
esac
if test x$with_fp = xno; then
sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
@@ -3327,7 +3328,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
m1 | m2 | m2e | m3 | m3e | \
m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
- m2a | m2a-single | m2a-single-only | m2a-nofpu)
+ m2a | m2a-single | m2a-single-only | m2a-nofpu | \
+ mj2)
# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
# It is passed to MULTIILIB_OPTIONS verbatim.
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
@@ -3344,7 +3346,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
if test x${enable_incomplete_targets} = xyes ; then
- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1"
fi
tm_file="$tm_file ./sysroot-suffix.h"
tmake_file="$tmake_file t-sysroot-suffix"
@@ -5175,6 +5177,8 @@ case "${target}" in
;;
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
;;
+ mj2)
+ ;;
*)
echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
@@ -5385,7 +5389,7 @@ case ${target} in
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
;;
- sh[123456ble]*-*-* | sh-*-*)
+ sh[123456blej]*-*-* | sh-*-*)
c_target_objs="${c_target_objs} sh-c.o"
cxx_target_objs="${cxx_target_objs} sh-c.o"
;;
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index 1564109c942..798c1c1c1a3 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -686,6 +686,7 @@ parse_validate_atomic_model_option (const char* str)
model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
model_names[sh_atomic_model::soft_imask] = "soft-imask";
+ model_names[sh_atomic_model::hard_cas] = "hard-cas";
const char* model_cdef_names[sh_atomic_model::num_models];
model_cdef_names[sh_atomic_model::none] = "NONE";
@@ -693,6 +694,7 @@ parse_validate_atomic_model_option (const char* str)
model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
+ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
sh_atomic_model ret;
ret.type = sh_atomic_model::none;
@@ -771,6 +773,9 @@ got_mode_name:;
if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
err_ret ("cannot use atomic model %s in user mode", ret.name);
+ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
+ err_ret ("atomic model %s is only available J2 targets", ret.name);
+
return ret;
#undef err_ret
@@ -827,6 +832,8 @@ sh_option_override (void)
sh_cpu = PROCESSOR_SH2E;
if (TARGET_SH2A)
sh_cpu = PROCESSOR_SH2A;
+ if (TARGET_SHJ2)
+ sh_cpu = PROCESSOR_SHJ2;
if (TARGET_SH3)
sh_cpu = PROCESSOR_SH3;
if (TARGET_SH3E)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index d2280e2ffe6..3a54a896721 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratch;
#define SUPPORT_SH4_SINGLE 1
#define SUPPORT_SH2A 1
#define SUPPORT_SH2A_SINGLE 1
+#define SUPPORT_SHJ2 1
#endif
#define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
#define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
#define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
#define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
#if SUPPORT_SH1
#define SUPPORT_SH2 1
@@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratch;
#if SUPPORT_SH2
#define SUPPORT_SH3 1
#define SUPPORT_SH2A_NOFPU 1
+#define SUPPORT_SHJ2 1
#endif
#if SUPPORT_SH3
#define SUPPORT_SH4_NOFPU 1
@@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratch;
#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
| MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
| MASK_HARD_SH4 | MASK_FPU_SINGLE \
- | MASK_FPU_SINGLE_ONLY)
+ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
/* This defaults us to big-endian. */
#ifndef TARGET_ENDIAN_DEFAULT
@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
%{m2a-single:--isa=sh2a} \
%{m2a-single-only:--isa=sh2a} \
%{m2a-nofpu:--isa=sh2a-nofpu} \
-%{m4al:-dsp}"
+%{m4al:-dsp} \
+%{mj2:-isa=j2}"
#define ASM_SPEC SH_ASM_SPEC
@@ -347,6 +351,7 @@ struct sh_atomic_model
hard_llcs,
soft_tcb,
soft_imask,
+ hard_cas,
num_models
};
@@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
#define TARGET_ATOMIC_SOFT_IMASK \
(selected_atomic_model ().type == sh_atomic_model::soft_imask)
+#define TARGET_ATOMIC_HARD_CAS \
+ (selected_atomic_model ().type == sh_atomic_model::hard_cas)
+
#endif // __cplusplus
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
/* Nonzero if the target supports dynamic shift instructions
like shad and shld. */
-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
+#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
/* The cost of using the dynamic shift insns (shad, shld) are the same
if they are available. If they are not available a library function will
@@ -1747,6 +1755,7 @@ enum processor_type {
PROCESSOR_SH2,
PROCESSOR_SH2E,
PROCESSOR_SH2A,
+ PROCESSOR_SHJ2,
PROCESSOR_SH3,
PROCESSOR_SH3E,
PROCESSOR_SH4,
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index b4755a812f3..0989a1c18da 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -65,6 +65,10 @@ m2e
Target RejectNegative Condition(SUPPORT_SH2E)
Generate SH2e code.
+mj2
+Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
+Generate J2 code.
+
m3
Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
Generate SH3 code.
diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
index 2b43f8edb86..118fc5d06db 100644
--- a/gcc/config/sh/sync.md
+++ b/gcc/config/sh/sync.md
@@ -240,6 +240,9 @@
|| (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
exp_val, new_val);
+ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
+ exp_val, new_val);
else if (TARGET_ATOMIC_SOFT_GUSA)
atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
exp_val, new_val);
@@ -306,6 +309,57 @@
}
[(set_attr "length" "14")])
+(define_expand "atomic_compare_and_swapsi_cas"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "r")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{
+ rtx mem = gen_rtx_REG (SImode, 0);
+ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
+ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
+ DONE;
+})
+
+(define_insn "shj2_cas"
+ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "=r")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "0")]
+ UNSPECV_CMPXCHG_1))
+ (set (reg:SI T_REG)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
+ "TARGET_ATOMIC_HARD_CAS"
+ "cas.l %2,%0,@%1"
+ [(set_attr "length" "2")]
+)
+
+(define_expand "atomic_compare_and_swapqi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
+(define_expand "atomic_compare_and_swaphi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
;; The QIHImode llcs patterns modify the address register of the memory
;; operand. In order to express that, we have to open code the memory
;; operand. Initially the insn is expanded like every other atomic insn
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index 888f8ff7f25..29fd6ae45fd 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
m2a-single,m2a-single-only \
m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
- m4,m4-100,m4-200,m4-300,m4a; do \
+ m4,m4-100,m4-200,m4-300,m4a \
+ mj2; do \
subst= ; \
for lib in `echo $$abi|tr , ' '` ; do \
if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
@@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
# SH1 and SH2A support big endian only.
ifeq ($(DEFAULT_ENDIAN),ml)
-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
else
-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
endif
MULTILIB_OSDIRNAMES = \
@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
+ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
+ mj2=!j2
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true

View File

@ -0,0 +1,92 @@
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 3c81c5798d8..cd96eac5d12 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC

View File

@ -0,0 +1,20 @@
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 59a456cd496..dbfddea41bd 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4174,13 +4174,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,8 @@
--- a/libstdc++-v3/ChangeLog 2024-03-13 18:04:21.050801063 -0400
+++ b/libstdc++-v3/ChangeLog 2024-03-13 18:04:25.665836804 -0400
@@ -4068,4 +4068,4 @@
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.
+notice and this notice are preserved.

View File

@ -0,0 +1,11 @@
--- a/libgcc/unwind-pe.h 2024-03-14 05:59:53.754073149 +0900
+++ b/libgcc/unwind-pe.h 2024-03-14 06:00:41.226074492 +0900
@@ -262,7 +262,7 @@
if (result != 0)
{
-#if __FDPIC__
+#if __FDPIC__ && __arm__
/* FDPIC relative addresses imply taking the GOT address
into account. */
if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))

View File

@ -0,0 +1,38 @@
--- a/libgcc/crtstuff.c 2023-05-29 17:46:32.000000000 +0900
+++ b/libgcc/crtstuff.c 2024-03-14 06:03:42.398079615 +0900
@@ -441,17 +441,9 @@
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
-extern char __do_global_dtors_aux_alias;
-static void *__do_global_dtors_aux_fini_array_entry[]
-__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
- = { &__do_global_dtors_aux_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
-#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -494,17 +486,9 @@
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
-extern char __frame_dummy_alias;
-static void *__frame_dummy_init_array_entry[]
-__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
- = { &__frame_dummy_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
-#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.cc.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.cc 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,14 @@
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 7837553958b..3c81c5798d8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -980,7 +980,8 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index 1b0bfe37852..d7b2b19bb3c 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;

View File

@ -0,0 +1,346 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 357b0bed067..528add999f2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -556,7 +556,7 @@ s390*-*-*)
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
-sh[123456789lbe]*-*-* | sh-*-*)
+sh[123456789lbej]*-*-* | sh-*-*)
cpu_type=sh
extra_options="${extra_options} fused-madd.opt"
extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
@@ -3202,18 +3202,18 @@ s390x-ibm-tpf*)
extra_options="${extra_options} s390/tpf.opt"
tmake_file="${tmake_file} s390/t-s390"
;;
-sh-*-elf* | sh[12346l]*-*-elf* | \
- sh-*-linux* | sh[2346lbe]*-*-linux* | \
+sh-*-elf* | sh[12346lj]*-*-elf* | \
+ sh-*-linux* | sh[2346lbej]*-*-linux* | \
sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
if test x${with_endian} = x; then
case ${target} in
- sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
+ sh[j1234]*be-*-* | sh[j1234]*eb-*-*) with_endian=big ;;
shbe-*-* | sheb-*-*) with_endian=big,little ;;
sh[1234]l* | sh[34]*-*-linux*) with_endian=little ;;
shl* | sh*-*-linux* | \
sh-superh-elf) with_endian=little,big ;;
- sh[1234]*-*-*) with_endian=big ;;
+ sh[j1234]*-*-*) with_endian=big ;;
*) with_endian=big,little ;;
esac
fi
@@ -3280,6 +3280,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a_nofpu*) sh_cpu_target=sh2a-nofpu ;;
sh2a*) sh_cpu_target=sh2a ;;
sh2e*) sh_cpu_target=sh2e ;;
+ shj2*) sh_cpu_target=shj2;;
sh2*) sh_cpu_target=sh2 ;;
*) sh_cpu_target=sh1 ;;
esac
@@ -3301,7 +3302,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
- sh3e | sh3 | sh2e | sh2 | sh1) ;;
+ sh3e | sh3 | sh2e | sh2 | sh1 | shj2) ;;
"") sh_cpu_default=${sh_cpu_target} ;;
*) echo "with_cpu=$with_cpu not supported"; exit 1 ;;
esac
@@ -3310,9 +3311,9 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
case ${target} in
sh[1234]*) sh_multilibs=${sh_cpu_target} ;;
sh-superh-*) sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
- sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4 ;;
+ sh*-*-linux*) sh_multilibs=m1,m2,m2a,m3e,m4,mj2 ;;
sh*-*-netbsd*) sh_multilibs=m3,m3e,m4 ;;
- *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
+ *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,mj2 ;;
esac
if test x$with_fp = xno; then
sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
@@ -3327,7 +3328,8 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
m1 | m2 | m2e | m3 | m3e | \
m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
- m2a | m2a-single | m2a-single-only | m2a-nofpu)
+ m2a | m2a-single | m2a-single-only | m2a-nofpu | \
+ mj2)
# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
# It is passed to MULTIILIB_OPTIONS verbatim.
TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
@@ -3344,7 +3346,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
if test x${enable_incomplete_targets} = xyes ; then
- tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
+ tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SHJ2=1"
fi
tm_file="$tm_file ./sysroot-suffix.h"
tmake_file="$tmake_file t-sysroot-suffix"
@@ -5175,6 +5177,8 @@ case "${target}" in
;;
m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
;;
+ mj2)
+ ;;
*)
echo "Unknown CPU used in --with-cpu=$with_cpu, known values:" 1>&2
echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
@@ -5385,7 +5389,7 @@ case ${target} in
tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
;;
- sh[123456ble]*-*-* | sh-*-*)
+ sh[123456blej]*-*-* | sh-*-*)
c_target_objs="${c_target_objs} sh-c.o"
cxx_target_objs="${cxx_target_objs} sh-c.o"
;;
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index 1564109c942..798c1c1c1a3 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -686,6 +686,7 @@ parse_validate_atomic_model_option (const char* str)
model_names[sh_atomic_model::hard_llcs] = "hard-llcs";
model_names[sh_atomic_model::soft_tcb] = "soft-tcb";
model_names[sh_atomic_model::soft_imask] = "soft-imask";
+ model_names[sh_atomic_model::hard_cas] = "hard-cas";
const char* model_cdef_names[sh_atomic_model::num_models];
model_cdef_names[sh_atomic_model::none] = "NONE";
@@ -693,6 +694,7 @@ parse_validate_atomic_model_option (const char* str)
model_cdef_names[sh_atomic_model::hard_llcs] = "HARD_LLCS";
model_cdef_names[sh_atomic_model::soft_tcb] = "SOFT_TCB";
model_cdef_names[sh_atomic_model::soft_imask] = "SOFT_IMASK";
+ model_cdef_names[sh_atomic_model::hard_cas] = "HARD_CAS";
sh_atomic_model ret;
ret.type = sh_atomic_model::none;
@@ -771,6 +773,9 @@ got_mode_name:;
if (ret.type == sh_atomic_model::soft_imask && TARGET_USERMODE)
err_ret ("cannot use atomic model %s in user mode", ret.name);
+ if (ret.type == sh_atomic_model::hard_cas && !TARGET_SHJ2)
+ err_ret ("atomic model %s is only available J2 targets", ret.name);
+
return ret;
#undef err_ret
@@ -827,6 +832,8 @@ sh_option_override (void)
sh_cpu = PROCESSOR_SH2E;
if (TARGET_SH2A)
sh_cpu = PROCESSOR_SH2A;
+ if (TARGET_SHJ2)
+ sh_cpu = PROCESSOR_SHJ2;
if (TARGET_SH3)
sh_cpu = PROCESSOR_SH3;
if (TARGET_SH3E)
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index d2280e2ffe6..3a54a896721 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -85,6 +85,7 @@ extern int code_for_indirect_jump_scratch;
#define SUPPORT_SH4_SINGLE 1
#define SUPPORT_SH2A 1
#define SUPPORT_SH2A_SINGLE 1
+#define SUPPORT_SHJ2 1
#endif
#define TARGET_DIVIDE_CALL_DIV1 (sh_div_strategy == SH_DIV_CALL_DIV1)
@@ -117,6 +118,7 @@ extern int code_for_indirect_jump_scratch;
#define SELECT_SH4A_SINGLE_ONLY (MASK_SH4A | SELECT_SH4_SINGLE_ONLY)
#define SELECT_SH4A (MASK_SH4A | SELECT_SH4)
#define SELECT_SH4A_SINGLE (MASK_SH4A | SELECT_SH4_SINGLE)
+#define SELECT_SHJ2 (MASK_SHJ2 | SELECT_SH2)
#if SUPPORT_SH1
#define SUPPORT_SH2 1
@@ -124,6 +126,7 @@ extern int code_for_indirect_jump_scratch;
#if SUPPORT_SH2
#define SUPPORT_SH3 1
#define SUPPORT_SH2A_NOFPU 1
+#define SUPPORT_SHJ2 1
#endif
#if SUPPORT_SH3
#define SUPPORT_SH4_NOFPU 1
@@ -156,7 +159,7 @@ extern int code_for_indirect_jump_scratch;
#define MASK_ARCH (MASK_SH1 | MASK_SH2 | MASK_SH3 | MASK_SH_E | MASK_SH4 \
| MASK_HARD_SH2A | MASK_HARD_SH2A_DOUBLE | MASK_SH4A \
| MASK_HARD_SH4 | MASK_FPU_SINGLE \
- | MASK_FPU_SINGLE_ONLY)
+ | MASK_FPU_SINGLE_ONLY | MASK_SHJ2)
/* This defaults us to big-endian. */
#ifndef TARGET_ENDIAN_DEFAULT
@@ -231,7 +234,8 @@ extern int code_for_indirect_jump_scratch;
%{m2a-single:--isa=sh2a} \
%{m2a-single-only:--isa=sh2a} \
%{m2a-nofpu:--isa=sh2a-nofpu} \
-%{m4al:-dsp}"
+%{m4al:-dsp} \
+%{mj2:-isa=j2}"
#define ASM_SPEC SH_ASM_SPEC
@@ -347,6 +351,7 @@ struct sh_atomic_model
hard_llcs,
soft_tcb,
soft_imask,
+ hard_cas,
num_models
};
@@ -390,6 +395,9 @@ extern const sh_atomic_model& selected_atomic_model (void);
#define TARGET_ATOMIC_SOFT_IMASK \
(selected_atomic_model ().type == sh_atomic_model::soft_imask)
+#define TARGET_ATOMIC_HARD_CAS \
+ (selected_atomic_model ().type == sh_atomic_model::hard_cas)
+
#endif // __cplusplus
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
@@ -1484,7 +1492,7 @@ extern bool current_function_interrupt;
/* Nonzero if the target supports dynamic shift instructions
like shad and shld. */
-#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A)
+#define TARGET_DYNSHIFT (TARGET_SH3 || TARGET_SH2A || TARGET_SHJ2)
/* The cost of using the dynamic shift insns (shad, shld) are the same
if they are available. If they are not available a library function will
@@ -1747,6 +1755,7 @@ enum processor_type {
PROCESSOR_SH2,
PROCESSOR_SH2E,
PROCESSOR_SH2A,
+ PROCESSOR_SHJ2,
PROCESSOR_SH3,
PROCESSOR_SH3E,
PROCESSOR_SH4,
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index b4755a812f3..0989a1c18da 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -65,6 +65,10 @@ m2e
Target RejectNegative Condition(SUPPORT_SH2E)
Generate SH2e code.
+mj2
+Target RejectNegative Mask(SHJ2) Condition(SUPPORT_SHJ2)
+Generate J2 code.
+
m3
Target RejectNegative Mask(SH3) Condition(SUPPORT_SH3)
Generate SH3 code.
diff --git a/gcc/config/sh/sync.md b/gcc/config/sh/sync.md
index 2b43f8edb86..118fc5d06db 100644
--- a/gcc/config/sh/sync.md
+++ b/gcc/config/sh/sync.md
@@ -240,6 +240,9 @@
|| (TARGET_SH4A && <MODE>mode == SImode && !TARGET_ATOMIC_STRICT))
atomic_insn = gen_atomic_compare_and_swap<mode>_hard (old_val, mem,
exp_val, new_val);
+ else if (TARGET_ATOMIC_HARD_CAS && <MODE>mode == SImode)
+ atomic_insn = gen_atomic_compare_and_swap<mode>_cas (old_val, mem,
+ exp_val, new_val);
else if (TARGET_ATOMIC_SOFT_GUSA)
atomic_insn = gen_atomic_compare_and_swap<mode>_soft_gusa (old_val, mem,
exp_val, new_val);
@@ -306,6 +309,57 @@
}
[(set_attr "length" "14")])
+(define_expand "atomic_compare_and_swapsi_cas"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "r")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{
+ rtx mem = gen_rtx_REG (SImode, 0);
+ emit_move_insn (mem, force_reg (SImode, XEXP (operands[1], 0)));
+ emit_insn (gen_shj2_cas (operands[0], mem, operands[2], operands[3]));
+ DONE;
+})
+
+(define_insn "shj2_cas"
+ [(set (match_operand:SI 0 "register_operand" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "=r")
+ (match_operand:SI 2 "register_operand" "r")
+ (match_operand:SI 3 "register_operand" "0")]
+ UNSPECV_CMPXCHG_1))
+ (set (reg:SI T_REG)
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_CMPXCHG_3))]
+ "TARGET_ATOMIC_HARD_CAS"
+ "cas.l %2,%0,@%1"
+ [(set_attr "length" "2")]
+)
+
+(define_expand "atomic_compare_and_swapqi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
+(define_expand "atomic_compare_and_swaphi_cas"
+ [(set (match_operand:SI 0 "arith_reg_dest" "=&r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "atomic_mem_operand_0" "=Sra")
+ (match_operand:SI 2 "arith_operand" "rI08")
+ (match_operand:SI 3 "arith_operand" "rI08")]
+ UNSPECV_CMPXCHG_1))]
+ "TARGET_ATOMIC_HARD_CAS"
+{FAIL;}
+)
+
;; The QIHImode llcs patterns modify the address register of the memory
;; operand. In order to express that, we have to open code the memory
;; operand. Initially the insn is expanded like every other atomic insn
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
index 888f8ff7f25..29fd6ae45fd 100644
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -50,7 +50,8 @@ MULTILIB_MATCHES = $(shell \
m2e,m3e,m4-single-only,m4-100-single-only,m4-200-single-only,m4-300-single-only,m4a-single-only \
m2a-single,m2a-single-only \
m4-single,m4-100-single,m4-200-single,m4-300-single,m4a-single \
- m4,m4-100,m4-200,m4-300,m4a; do \
+ m4,m4-100,m4-200,m4-300,m4a \
+ mj2; do \
subst= ; \
for lib in `echo $$abi|tr , ' '` ; do \
if test "`echo $$multilibs|sed s/$$lib//`" != "$$multilibs"; then \
@@ -63,9 +64,9 @@ MULTILIB_MATCHES = $(shell \
# SH1 and SH2A support big endian only.
ifeq ($(DEFAULT_ENDIAN),ml)
-MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = m1 ml/m1 m2a* ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
else
-MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* $(TM_MULTILIB_EXCEPTIONS_CONFIG)
+MULTILIB_EXCEPTIONS = ml/m1 ml/m2a* ml/mj2 $(TM_MULTILIB_EXCEPTIONS_CONFIG)
endif
MULTILIB_OSDIRNAMES = \
@@ -87,7 +88,8 @@ MULTILIB_OSDIRNAMES = \
m4a-single-only=!m4a-single-only $(OTHER_ENDIAN)/m4a-single-only=!$(OTHER_ENDIAN)/m4a-single-only \
m4a-single=!m4a-single $(OTHER_ENDIAN)/m4a-single=!$(OTHER_ENDIAN)/m4a-single \
m4a=!m4a $(OTHER_ENDIAN)/m4a=!$(OTHER_ENDIAN)/m4a \
- m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al
+ m4al=!m4al $(OTHER_ENDIAN)/m4al=!$(OTHER_ENDIAN)/m4al \
+ mj2=!j2
$(out_object_file): gt-sh.h
gt-sh.h : s-gtype ; @true

View File

@ -0,0 +1,92 @@
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GNU userspace "finalizer" file, `crtn.o'. */
#define GNU_USER_TARGET_ENDFILE_SPEC \
- "%{!static:%{fvtable-verify=none:%s; \
+ "%{static|static-pie:; \
+ fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
- fvtable-verify=std:vtv_end.o%s}} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ fvtable-verify=std:vtv_end.o%s} \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 3c81c5798d8..cd96eac5d12 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC

View File

@ -0,0 +1,20 @@
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 59a456cd496..dbfddea41bd 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4174,13 +4174,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,8 @@
--- a/libstdc++-v3/ChangeLog 2024-03-13 18:04:21.050801063 -0400
+++ b/libstdc++-v3/ChangeLog 2024-03-13 18:04:25.665836804 -0400
@@ -4068,4 +4068,4 @@
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.
+notice and this notice are preserved.

View File

@ -0,0 +1,11 @@
--- a/libgcc/unwind-pe.h 2024-03-14 05:59:53.754073149 +0900
+++ b/libgcc/unwind-pe.h 2024-03-14 06:00:41.226074492 +0900
@@ -262,7 +262,7 @@
if (result != 0)
{
-#if __FDPIC__
+#if __FDPIC__ && __arm__
/* FDPIC relative addresses imply taking the GOT address
into account. */
if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect))

View File

@ -0,0 +1,38 @@
--- a/libgcc/crtstuff.c 2023-05-29 17:46:32.000000000 +0900
+++ b/libgcc/crtstuff.c 2024-03-14 06:03:42.398079615 +0900
@@ -441,17 +441,9 @@
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
-extern char __do_global_dtors_aux_alias;
-static void *__do_global_dtors_aux_fini_array_entry[]
-__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
- = { &__do_global_dtors_aux_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
-#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -494,17 +486,9 @@
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
-#if defined(__FDPIC__)
-__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
-extern char __frame_dummy_alias;
-static void *__frame_dummy_init_array_entry[]
-__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
- = { &__frame_dummy_alias };
-#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
-#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.cc.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.cc 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -4,7 +4,7 @@
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
+#if defined(SYS_futex_time64)
+#if defined(SYS_futex_time64) && SYS_futex_time64 != SYS_futex
+ struct
+ {
+ long tv_sec;

View File

@ -0,0 +1,18 @@
--- gcc-9.2.0.orig/gcc/config/m68k/m68k.md 2019-01-01 07:31:55.000000000 -0500
+++ gcc-9.2.0/gcc/config/m68k/m68k.md 2020-07-01 15:57:20.528408009 -0400
@@ -4126,13 +4126,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,22 @@
--- gcc-8.5.0/gcc/config/rs6000/sysv4.h.orig 2021-07-05 12:56:18.398813835 -0400
+++ gcc-8.5.0/gcc/config/rs6000/sysv4.h 2021-06-23 21:49:57.592408186 -0400
@@ -793,7 +793,7 @@
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float|mcpu=854*|mspe:-sf}.so.1"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
"%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
--- gcc-8.5.0/gcc/config/rs6000/linux64.h.orig 2021-07-05 12:54:24.704854044 -0400
+++ gcc-8.5.0/gcc/config/rs6000/linux64.h 2021-07-05 12:56:50.010806923 -0400
@@ -426,7 +426,7 @@
#endif
#define MUSL_DYNAMIC_LINKER32 \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float|mcpu=854*|mspe:-sf}.so.1"
#define MUSL_DYNAMIC_LINKER64 \
"/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.c.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.c 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,11 @@
--- gcc-6.5.0.orig/gcc/config/i386/i386.c
+++ gcc-6.5.0/gcc/config/i386/i386.c
@@ -8747,7 +8747,7 @@
HOST_WIDE_INT words)
{
int res = 0;
- bool error_p = NULL;
+ bool error_p = 0;
if (TARGET_IAMCU)
{

View File

@ -0,0 +1,7 @@
--- gcc-5.3.0.orig/libcc1/ChangeLog
+++ gcc-5.3.0/libcc1/ChangeLog
@@ -98,3 +98,4 @@
* plugin.cc: New file.
* rpc.hh: New file.
* status.hh: New file.
+

View File

@ -0,0 +1,11 @@
--- gcc-5.3.0/gcc/reload.h
+++ gcc-5.3.0.orig/gcc/reload.h
@@ -168,7 +168,7 @@
value indicates the level of indirect addressing supported, e.g., two
means that (MEM (MEM (REG n))) is also valid if (REG n) does not get
a hard register. */
- bool x_spill_indirect_levels;
+ unsigned char x_spill_indirect_levels;
/* True if caller-save has been reinitialized. */
bool x_caller_save_initialized_p;

View File

@ -4,7 +4,7 @@
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
+#if defined(SYS_futex_time64)
+#if defined(SYS_futex_time64) && SYS_futex_time64 != SYS_futex
+ struct
+ {
+ long tv_sec;

View File

@ -0,0 +1,18 @@
--- gcc-9.2.0.orig/gcc/config/m68k/m68k.md 2019-01-01 07:31:55.000000000 -0500
+++ gcc-9.2.0/gcc/config/m68k/m68k.md 2020-07-01 15:57:20.528408009 -0400
@@ -4126,13 +4126,13 @@
(define_expand "sqrt<mode>2"
[(set (match_operand:FP 0 "nonimmediate_operand" "")
(sqrt:FP (match_operand:FP 1 "general_operand" "")))]
- "TARGET_HARD_FLOAT"
+ "(TARGET_68881 && TARGET_68040) || TARGET_COLDFIRE_FPU"
"")
(define_insn "sqrt<mode>2_68881"
[(set (match_operand:FP 0 "nonimmediate_operand" "=f")
(sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
- "TARGET_68881"
+ "TARGET_68881 && TARGET_68040"
{
if (FP_REG_P (operands[1]))
return "f<FP:round>sqrt%.x %1,%0";

View File

@ -0,0 +1,22 @@
--- gcc-8.5.0/gcc/config/rs6000/sysv4.h.orig 2021-07-05 12:56:18.398813835 -0400
+++ gcc-8.5.0/gcc/config/rs6000/sysv4.h 2021-06-23 21:49:57.592408186 -0400
@@ -793,7 +793,7 @@
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float|mcpu=854*|mspe:-sf}.so.1"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
"%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
--- gcc-8.5.0/gcc/config/rs6000/linux64.h.orig 2021-07-05 12:54:24.704854044 -0400
+++ gcc-8.5.0/gcc/config/rs6000/linux64.h 2021-07-05 12:56:50.010806923 -0400
@@ -426,7 +426,7 @@
#endif
#define MUSL_DYNAMIC_LINKER32 \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float|mcpu=854*|mspe:-sf}.so.1"
#define MUSL_DYNAMIC_LINKER64 \
"/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"

View File

@ -0,0 +1,12 @@
--- gcc-11.4.0/gcc/config/sh/sh.c.orig 2024-04-04 05:52:42.125373614 +0900
+++ gcc-11.4.0/gcc/config/sh/sh.c 2024-04-04 22:54:01.875106654 +0900
@@ -9147,7 +9147,7 @@
{
/* Weak functions may be NULL which doesn't work with
GOTOFFFUNCDESC because the runtime offset is not known. */
- if (SYMBOL_REF_WEAK (orig))
+ if (SYMBOL_REF_WEAK (orig) || (TREE_PUBLIC(SYMBOL_REF_DECL(orig)) && DECL_VISIBILITY (SYMBOL_REF_DECL(orig)) != VISIBILITY_HIDDEN))
emit_insn (gen_symGOTFUNCDESC2reg (reg, orig));
else
emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));

View File

@ -0,0 +1,11 @@
--- gcc-6.5.0.orig/gcc/config/i386/i386.c
+++ gcc-6.5.0/gcc/config/i386/i386.c
@@ -8747,7 +8747,7 @@
HOST_WIDE_INT words)
{
int res = 0;
- bool error_p = NULL;
+ bool error_p = 0;
if (TARGET_IAMCU)
{

Some files were not shown because too many files have changed in this diff Show More