From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id E4356385840E; Tue, 21 Sep 2021 09:13:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4356385840E Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] Override -finhibit-size-directive when building crtstuff X-Act-Checkin: gcc X-Git-Author: Matthew Malcomson X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 1f949c3d085a8994cd7579250b77197c23db435a X-Git-Newrev: bf2146886b94651a4eec149e6bbe38ea8cdaa3ec Message-Id: <20210921091334.E4356385840E@sourceware.org> Date: Tue, 21 Sep 2021 09:13:34 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 09:13:35 -0000 https://gcc.gnu.org/g:bf2146886b94651a4eec149e6bbe38ea8cdaa3ec commit bf2146886b94651a4eec149e6bbe38ea8cdaa3ec Author: Matthew Malcomson 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 @@ # . 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