From patchwork Fri Jan 14 23:04:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 50054 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 163913858417 for ; Fri, 14 Jan 2022 23:04:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 163913858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1642201488; bh=ZHiBQNp1xtOf9ZKto55UyHuRxygUK/tmPt+kaZBqYbM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WDNmtq6grLv7gpA+BoTc3ka4PombxOEPc2Ff8Sfxne3ltXr7KOTn5TP48cunLRNQg WL8+GuPHnuPwZAKxYCm0M6ViqjPDOfgheWLPm4EOMUHkXzwX3w/a4fVAS5qo/z6ra5 UQA49qI24ztTOUGDISlIy7bPPihOulrZETqLQ/cM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 43F963858C39 for ; Fri, 14 Jan 2022 23:04:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 43F963858C39 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-22-uQqZ7C1lMUy9ccoVV9DF_w-1; Fri, 14 Jan 2022 18:04:14 -0500 X-MC-Unique: uQqZ7C1lMUy9ccoVV9DF_w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F54A1006AA5 for ; Fri, 14 Jan 2022 23:04:13 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.246]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 294D5108AD for ; Fri, 14 Jan 2022 23:04:12 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 20EN4AvR2074266 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Sat, 15 Jan 2022 00:04:10 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 20EN4AVh2074265 for gcc-patches@gcc.gnu.org; Sat, 15 Jan 2022 00:04:10 +0100 Date: Sat, 15 Jan 2022 00:04:10 +0100 To: gcc-patches@gcc.gnu.org Subject: [committed] ada: Fix up handling of ghost units [PR104027] Message-ID: <20220114230410.GQ2646553@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! As reported, libgnat-12.so gets PT_GNU_STACK RWE, which means it doesn't work in some SELinux configurations. This is caused by the a-nbnbig.o file, which is a ghost unit and since r12-5670 the FE emits an object file for it, but exits before compile_file has a chance to finalize it e.g. with targetm.asm_out.file_end () that emits the .note.GNU-stack section on various linux targets. Fixed by not existing but instead returning early to the caller. Bootstrapped/regtested on x86_64-linux, preapproved in the PR, committed to trunk. 2022-01-14 Andrew Pinski PR ada/104027 * gnat1drv.adb (Gnat1drv): After Back_End.Gen_Or_Update_Object_File goto End_Of_Program. Jakub --- gcc/ada/gnat1drv.adb +++ gcc/ada/gnat1drv.adb @@ -1429,6 +1429,11 @@ begin Ecode := E_Success; Back_End.Gen_Or_Update_Object_File; + -- Use a goto instead of calling Exit_Program so that finalization + -- occurs normally. + + goto End_Of_Program; + -- Otherwise the unit is missing a crucial piece that prevents code -- generation.