]> git.ipfire.org Git - thirdparty/gcc.git/commit
modula2: Fix up bootstrap on powerpc64le-linux [PR108147]
authorJakub Jelinek <jakub@redhat.com>
Mon, 19 Dec 2022 13:20:36 +0000 (14:20 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 19 Dec 2022 14:00:08 +0000 (15:00 +0100)
commit158b18ffa510105b239bd2f4a253ed33e21fcebc
treed8dd3dbd311c57cace1ee868efa6207c03f0d03d
parenta9f6a2b7f579b684037eaddab97db35096c10c3b
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  <jakub@redhat.com>

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.
gcc/m2/gm2-gcc/m2linemap.cc
gcc/m2/gm2-gcc/m2linemap.def
gcc/m2/gm2-gcc/m2linemap.h