From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeffrey A Law To: Marc Lehmann Cc: egcs@cygnus.com Subject: Re: [EGCS] Re: double alignment patch for x86 Date: Mon, 09 Feb 1998 02:10:00 -0000 Message-id: <5765.887019104@hurl.cygnus.com> References: X-SW-Source: 1998-02/msg00347.html In message you write: > One thing that bugs me for months now (need advice): > > gcc currently ignores the alignment set by FUNCTION_ARG_BOUNDARY > on machines that use push instructions to store arguments. This > results in incorrect code (caller forgets the necessary padding) > with the proposed -marg-align-double. Right. > I'd like to fix this... so... where would be the place to do that? > Should store_one_arg add padding, or should this be done in expand_call? Have the caller push dummy word(s) before any of the normal args iff the sum total of the stack area to be pushed is not a multiple of FUNCTION_ARG_BOUNDARY. The callee then moves any unaligned args out of the stack into either a register (if that't the final "home" for the arg) or into an aligned stack slot. However, this only works if nobody ever mis-aligns the stack -- which is hard to guarantee on the x86 because of the existance of old compilers which do not maintain proper stack alignment. > We could make the switch dependent on the OS (Linux -> do, solaris -> > ignore). That's somewhat ugly, but it doesn't break any programs. You can't even do it on linux by default because of existing libraries which may perform callbacks (qsort) or the need to be able to mix and match .o files from different versions of gcc. jeff