[gcc(refs/vendors/ARM/heads/morello)] Override -finhibit-size-directive when building crtstuff

Matthew Malcomson matmal01@gcc.gnu.org
Tue Sep 21 09:13:34 GMT 2021


https://gcc.gnu.org/g:bf2146886b94651a4eec149e6bbe38ea8cdaa3ec

commit bf2146886b94651a4eec149e6bbe38ea8cdaa3ec
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date:   Mon Aug 9 10:52:41 2021 +0100

    Override -finhibit-size-directive when building crtstuff
    
    This is a bit of a dangerous change since we don't know why this flag is
    used.  Without using the .size directives the linker doesn't know the
    size of functions and hence can't satisfy the MORELLO_CAPINIT
    relocation.
    
    From manual inspection it doesn't look like there's any particular
    reason to use this flag, but hopefully the testing it receives in use
    will be enough to trigger any problem.

Diff:
---
 libgcc/config/aarch64/t-aarch64 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libgcc/config/aarch64/t-aarch64 b/libgcc/config/aarch64/t-aarch64
index fce36be7480..b0527da512e 100644
--- a/libgcc/config/aarch64/t-aarch64
+++ b/libgcc/config/aarch64/t-aarch64
@@ -19,3 +19,20 @@
 # <http://www.gnu.org/licenses/>.
 
 LIB2ADD += $(srcdir)/config/aarch64/sync-cache.c
+
+# TODO lots of testing ;-)
+# crtbegin.o and crtend.o are compiled including -finhibit-size-directive.
+# As the name implies, this means we don't emit the .size directive.
+# For morello that's a problem, since the CAPINIT relocation should be made
+# against a symbol that has a size (otherwise the linker does not know what
+# bounds to put on the capability) and there are a few functions we need the
+# CAPINIT relocation against.
+#
+# I've looked at the emitted assembly for crtbegin.o, and AFAICS there are no
+# problems that the .size directive would cause (though this kind of manual
+# inspection is very error-prone).  So we're overriding that command line flag
+# for now.
+#
+# TODO It would be nice to only use this flag when building purecap crtstuff.c
+# Doesn't seem worth the effort to look into right now.
+CRTSTUFF_T_CFLAGS = -fno-inhibit-size-directive


More information about the Gcc-cvs mailing list