]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
strub: sparc: omit frame in strub_leave [PR112917]
authorAlexandre Oliva <oliva@adacore.com>
Thu, 14 Dec 2023 06:21:37 +0000 (03:21 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Wed, 20 Dec 2023 08:18:17 +0000 (05:18 -0300)
If we allow __strub_leave to allocate a frame on sparc, it will
overlap with a lot of the stack range we're supposed to scrub, because
of the large fixed-size outgoing args and register save area.
Unfortunately, setting up the PIC register seems to prevent the frame
pointer from being omitted.

Since the strub runtime doesn't issue calls or use global variables,
at least on sparc, disabling PIC to compile strub.c seems to do the
right thing.

for  libgcc/ChangeLog

PR middle-end/112917
* config.host (sparc, sparc64): Enable...
* config/sparc/t-sparc: ... this new fragment.

libgcc/config.host
libgcc/config/sparc/t-sparc [new file with mode: 0644]

index 694e3e9f54cade313e5a5fc31b95cd81407e231d..54d06978a5d2cf73f9ff593731891db16e7bbdca 100644 (file)
@@ -199,9 +199,11 @@ riscv*-*-*)
        ;;
 sparc64*-*-*)
        cpu_type=sparc
+       tmake_file="${tmake_file} sparc/t-sparc"
        ;;
 sparc*-*-*)
        cpu_type=sparc
+       tmake_file="${tmake_file} sparc/t-sparc"
        ;;
 s390*-*-*)
        cpu_type=s390
diff --git a/libgcc/config/sparc/t-sparc b/libgcc/config/sparc/t-sparc
new file mode 100644 (file)
index 0000000..fb1bf1f
--- /dev/null
@@ -0,0 +1,4 @@
+# This is needed for __strub_leave to omit the frame pointer, without
+# which it will allocate a register save area on the stack and leave
+# it unscrubbed and most likely unused, because it's a leaf function.
+CFLAGS-strub.c += -fno-PIC -fomit-frame-pointer