From patchwork Mon Dec 19 11:11:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 34475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2339366wrn; Mon, 19 Dec 2022 03:51:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4k6l6m2lcHGN5nRhnJekdnlzrnNHWRRJlN4W0Qxx4sqyqyu+OdJ2A18Od21MysSGQN5L0N X-Received: by 2002:a17:906:1484:b0:78d:f455:3118 with SMTP id x4-20020a170906148400b0078df4553118mr35928600ejc.64.1671450716563; Mon, 19 Dec 2022 03:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671450716; cv=none; d=google.com; s=arc-20160816; b=joVpRB0dz4D370s2JMTKL7eu42Z9crRB8Zk/eo4CXi6INtXWrqBGRBLj6vjFWo8KZv bitF6qTeUXFXTPG0T+IO9peYZDq7h7fI0Jt9NXi45wHJapyeLXA9bNwX+ZJLh/kFPikH YdFNxPfKOxbZ2/BI3N13Lj0WswcPE+YttQfdFabOIoduivE1NDMdYGUQryEsJ0H/ka3r qtql5bwEM/gnD13frbzNa3HQPoS9v/6DoEjwQVWqjbj7I+bF1X7Cb9GUiL2+xmuPWy9c HCvk8X0YdB7qkw8T0Dv4ksRpDzY01uwCu8dtgJW+LUXvKUhYwVuYWCEOUdP8YzmH4iMm Q5eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=CYQdPhUcCUpsBboxVS/sqt72szEGPissMqyZvuectVo=; b=TvCv4BBJhYyQe/nfc7Is2/BLW23GYdYUfx75lD3Km5f/ku23uuoPB2A/nz6GAtfsBZ 8bIb/ZN4ckefy5F+0I49OHm1YkQIWFITWAiWj1Icu1kvpAjlHN1XCD9Ps8ameQ5GFmv5 Fe3A8bAvJf7HUZTSNenpAwFZVLqyyEnyCBJ22yNG5SJo01JuUX/lBX72kAepIz7tQ0pQ 8hLKsL62U1WEam0zELyhKjBX/hC7eu3i9a52RGdl8v1vk+i8yUTcBcJwnHMkhYY1JIKR aBXkIfDxgTyy5Y29FoogTY639GlfbHeWgdO7ILL5EmVvKKbIO61xtuMrB9iX/ORoLxT1 37oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=UJVGEpMW; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id vj14-20020a170907d48e00b007c4fd0f9b38si8310001ejc.715.2022.12.19.03.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 03:51:56 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=UJVGEpMW; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 185D538BDBB2 for ; Mon, 19 Dec 2022 11:12:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 185D538BDBB2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671448350; bh=CYQdPhUcCUpsBboxVS/sqt72szEGPissMqyZvuectVo=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=UJVGEpMWJxF0hUSgiXx/8/aQp9FGO+WAtjH26/wmBlDxR81XKgjdJE0vKaUWDiSnF olDQZ/UOV2mQfgVIxbRmBkrcaS9ViR8kn04PEt3OIldeVsz8MA9Xf8RI/wJ4Hzb85r q2G2RpS1M1oMAQy6eOBr9YHiad0nBuKIDQm4fkog= 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 967AC383554F for ; Mon, 19 Dec 2022 11:11:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 967AC383554F Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-544-C2WCgpnuP_26KLb-t7v7Ug-1; Mon, 19 Dec 2022 06:11:20 -0500 X-MC-Unique: C2WCgpnuP_26KLb-t7v7Ug-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A44FB858F09; Mon, 19 Dec 2022 11:11:20 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 400002166B26; Mon, 19 Dec 2022 11:11:20 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2BJBBHFA776726 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 12:11:18 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2BJBBH11776725; Mon, 19 Dec 2022 12:11:17 +0100 Date: Mon, 19 Dec 2022 12:11:16 +0100 To: Gaius Mulley Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] modula2: Fix up bootstrap on powerpc64le-linux [PR108147] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752643106607745288?= X-GMAIL-MSGID: =?utf-8?q?1752643106607745288?= Hi! As mentioned in the PR, bootstrap with m2 enabled currently fails on powerpc64le-linux, we get weird ICE after printing some diagnostics. The problem is that mc creates from *.def prototypes like extern void m2linemap_WarningAtf (m2linemap_location_t location, void * message); but the actual function definitions use void m2linemap_WarningAtf (m2linemap_location_t location, void * message, ...) { code } and on powerpc64le-linux such lying about the prototype results in wrong-code, on the caller side we assume the function isn't varargs and so don't reserve 64 bytes in the frame for it, while the callee relies on the area being reserved and stores into it. Fixed by adding non-stdarg wrappers around stdarg functions (because we want va_list and pass it to diagnostics functions). Bootstrapped/regtested on {x86_64,i686,powerpc64le,s390x,aarch64}-linux, ok for trunk? 2022-12-19 Jakub Jelinek PR modula2/108147 * m2/gm2-gcc/m2linemap.def (ErrorAtf, WarningAtf, NoteAtf): Comment out prototypes with varargs. * m2/gm2-gcc/m2linemap.h (m2linemap_ErrorAtf, m2linemap_WarningAtf, m2linemap_NoteAtf): No longer varargs. * m2/gm2-gcc/m2linemap.cc (m2linemap_ErrorAtf): Turned into a non-varargs wrapper around ... (m2linemap_ErrorAtf_1): ... this. New static function. (m2linemap_WarningAtf): Turned into a non-varargs wrapper around ... (m2linemap_WarningAtf_1): ... this. New static function. (m2linemap_NoteAtf): Turned into a non-varargs wrapper around ... (m2linemap_NoteAtf_1): ... this. New static function. Jakub --- gcc/m2/gm2-gcc/m2linemap.def.jj 2022-12-14 20:30:41.110303552 +0100 +++ gcc/m2/gm2-gcc/m2linemap.def 2022-12-16 18:44:04.029951259 +0100 @@ -47,11 +47,6 @@ PROCEDURE GetLineNoFromLocation (locatio PROCEDURE GetColumnNoFromLocation (location: location_t) : INTEGER ; PROCEDURE GetFilenameFromLocation (location: location_t) : ADDRESS ; PROCEDURE ErrorAt (location: location_t; message: ADDRESS) ; -(* -PROCEDURE ErrorAtf (location: location_t; message: ADDRESS; ...) ; -PROCEDURE WarningAtf (location: location_t; message: ADDRESS; ...) ; -PROCEDURE NoteAtf (location: location_t; message: ADDRESS; ...) ; -*) PROCEDURE ErrorAtf (location: location_t; message: ADDRESS) ; PROCEDURE WarningAtf (location: location_t; message: ADDRESS) ; PROCEDURE NoteAtf (location: location_t; message: ADDRESS) ; --- gcc/m2/gm2-gcc/m2linemap.h.jj 2022-12-14 20:30:41.111303537 +0100 +++ gcc/m2/gm2-gcc/m2linemap.h 2022-12-16 18:44:19.443727288 +0100 @@ -55,9 +55,9 @@ EXTERN int m2linemap_GetLineNoFromLocati EXTERN int m2linemap_GetColumnNoFromLocation (location_t location); EXTERN const char *m2linemap_GetFilenameFromLocation (location_t location); EXTERN void m2linemap_ErrorAt (location_t location, char *message); -EXTERN void m2linemap_ErrorAtf (location_t location, const char *message, ...); -EXTERN void m2linemap_WarningAtf (location_t location, const char *message, ...); -EXTERN void m2linemap_NoteAtf (location_t location, const char *message, ...); +EXTERN void m2linemap_ErrorAtf (location_t location, const char *message); +EXTERN void m2linemap_WarningAtf (location_t location, const char *message); +EXTERN void m2linemap_NoteAtf (location_t location, const char *message); EXTERN void m2linemap_internal_error (const char *message); --- gcc/m2/gm2-gcc/m2linemap.cc.jj 2022-12-14 20:30:41.110303552 +0100 +++ gcc/m2/gm2-gcc/m2linemap.cc 2022-12-16 18:50:00.763767826 +0100 @@ -182,8 +182,8 @@ m2linemap_ErrorAt (location_t location, /* m2linemap_ErrorAtf - wraps up an error message. */ -void -m2linemap_ErrorAtf (location_t location, const char *message, ...) +static void +m2linemap_ErrorAtf_1 (location_t location, const char *message, ...) { diagnostic_info diagnostic; va_list ap; @@ -195,10 +195,16 @@ m2linemap_ErrorAtf (location_t location, va_end (ap); } +void +m2linemap_ErrorAtf (location_t location, const char *message) +{ + m2linemap_ErrorAtf_1 (location, message); +} + /* m2linemap_WarningAtf - wraps up a warning message. */ -void -m2linemap_WarningAtf (location_t location, const char *message, ...) +static void +m2linemap_WarningAtf_1 (location_t location, const char *message, ...) { diagnostic_info diagnostic; va_list ap; @@ -210,10 +216,16 @@ m2linemap_WarningAtf (location_t locatio va_end (ap); } +void +m2linemap_WarningAtf (location_t location, const char *message) +{ + m2linemap_WarningAtf_1 (location, message); +} + /* m2linemap_NoteAtf - wraps up a note message. */ -void -m2linemap_NoteAtf (location_t location, const char *message, ...) +static void +m2linemap_NoteAtf_1 (location_t location, const char *message, ...) { diagnostic_info diagnostic; va_list ap; @@ -225,6 +237,12 @@ m2linemap_NoteAtf (location_t location, va_end (ap); } +void +m2linemap_NoteAtf (location_t location, const char *message) +{ + m2linemap_NoteAtf_1 (location, message); +} + /* m2linemap_internal_error - allow Modula-2 to use the GCC internal error. */ void