From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 208A03858D1E; Mon, 19 Dec 2022 14:00:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 208A03858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671458425; bh=iSZ2VEDNvw3JFT6Iw7DX47auMPOBVqwGjdGLt4CPz7s=; h=From:To:Subject:Date:From; b=SNaN+7q1G/CJXJlaFCxc1LnG17wB7ucdlmBEFAk4WSKUk8d578ng9yMJ5zlckyNBA 6IxWlyPssjYUlQVVA9qpchuH01X9KVU08XzZtGNsxxhW4P1yEhxkxzqWDQiJZrboC9 KPZtZU7OC37gAVaEAlUTkt4G7V5bLevy4n8faXVo= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4781] modula2: Fix up bootstrap on powerpc64le-linux [PR108147] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: a9f6a2b7f579b684037eaddab97db35096c10c3b X-Git-Newrev: 158b18ffa510105b239bd2f4a253ed33e21fcebc Message-Id: <20221219140025.208A03858D1E@sourceware.org> Date: Mon, 19 Dec 2022 14:00:25 +0000 (GMT) List-Id: https://gcc.gnu.org/g:158b18ffa510105b239bd2f4a253ed33e21fcebc commit r13-4781-g158b18ffa510105b239bd2f4a253ed33e21fcebc Author: Jakub Jelinek Date: Mon Dec 19 14:20:36 2022 +0100 modula2: Fix up bootstrap on powerpc64le-linux [PR108147] 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). 2022-12-19 Jakub Jelinek PR modula2/108147 * gm2-gcc/m2linemap.def (ErrorAtf, WarningAtf, NoteAtf): Comment out prototypes with varargs. * gm2-gcc/m2linemap.h (m2linemap_ErrorAtf, m2linemap_WarningAtf, m2linemap_NoteAtf): No longer varargs. * 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. Diff: --- gcc/m2/gm2-gcc/m2linemap.cc | 30 ++++++++++++++++++++++++------ gcc/m2/gm2-gcc/m2linemap.def | 5 ----- gcc/m2/gm2-gcc/m2linemap.h | 6 +++--- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gcc/m2/gm2-gcc/m2linemap.cc b/gcc/m2/gm2-gcc/m2linemap.cc index c1c6e2b58a6..c6189b7f1ab 100644 --- a/gcc/m2/gm2-gcc/m2linemap.cc +++ b/gcc/m2/gm2-gcc/m2linemap.cc @@ -182,8 +182,8 @@ m2linemap_ErrorAt (location_t location, char *message) /* 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, const char *message, ...) 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 location, const char *message, ...) 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, const char *message, ...) 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 diff --git a/gcc/m2/gm2-gcc/m2linemap.def b/gcc/m2/gm2-gcc/m2linemap.def index 2c5d11d1b01..689dcb4b4e1 100644 --- a/gcc/m2/gm2-gcc/m2linemap.def +++ b/gcc/m2/gm2-gcc/m2linemap.def @@ -47,11 +47,6 @@ PROCEDURE GetLineNoFromLocation (location: location_t) : INTEGER ; 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) ; diff --git a/gcc/m2/gm2-gcc/m2linemap.h b/gcc/m2/gm2-gcc/m2linemap.h index 5de5c2665c9..6941983284f 100644 --- a/gcc/m2/gm2-gcc/m2linemap.h +++ b/gcc/m2/gm2-gcc/m2linemap.h @@ -55,9 +55,9 @@ EXTERN int m2linemap_GetLineNoFromLocation (location_t location); 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);