public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Minor C2X-induced ABI issue on powerpc64le
@ 2022-03-02 15:03 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2022-03-02 15:03 UTC (permalink / raw)
  To: gcc

I've been following

  [RFC] Enabling -Wstrict-prototypes by default in C
  <https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c/60521/25>

and I've just realized that treating

  extern int foo();

as a prototype declaration (with the same ABI as extern "C" int foo();
in C++) introduces a minor ABI break if the caller is compiled in C2X
mode, but the definition is not.  Without the prototype (C18 mode and
earlier), the caller needs to create a parameter save area per the
powerpc64le ABI.  With the prototype (C2X mode), I would expect the
compiler to omit the parameter save area.  Unfortunately, this creates
an ABI quirk if the C2X status doesn't match between caller and function
implementation.

I believe GCC uses the parameter save area for general-purpose spilling,
so it's still used in a prototype-less function definition without any
parameters.  That's why this is a minor ABI break.

It's probably not much to worry about, but I'd like to point it out
nevertheless.

Thanks,
Florian


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-02 15:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 15:03 Minor C2X-induced ABI issue on powerpc64le Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).