On Thu, 2015-07-23 at 12:31 +0200, Laszlo Ersek wrote:
> > I'm slightly confused. Why does it *only* matter for varargs functions?
> > I thought that on some platforms, the difference between the ELF ABI
> > and the MS ABI extended to putting arguments in *completely* different
> > registers? Why doesn't that bite us?
> 
> It does not bite us because the calling convention is part of the
> function's prototype (the declaration in the header file),

Right, thanks. Sorry, I'd actually worked this out before I sent my
email but forgot to remove the question.

The problem is *solely* about choosing the right conventions for
va_list handling, according to the ABI. It's *all* about GCC PR#50818.

> 
> > > Any particular reason for disliking these hunks of
> > > "EDKII_openssl-1.0.2d.patch" (over the other hunks)?
> > 
> > Oh, I dislike lots of other bits of that too. I'm just working through
> > them all separately. Are you on the openssl-dev mailing list? :)
> 
> Nope. :)

Lucky you :)

> In any case, if there was such a gcc PR, we'd still have to stick with
> the compatibility cruft in edk2, for old gcc versions' sake.

Right. So what are the options?

 1. Push a patch into OpenSSL upstream that marks ERR_add_error_data() 
    and any other varargs functions with EFIAPI. (Ick, no. I can't
    imagine them accepting that requirement.)

 2. Maintain the same patch for ourselves in perpetuity. (Ick, we
    really don't *want* to be carrying patches, especially like that
    one.)

 3. Switch to -mabi=ms across the board (can we ditch GCC 4.4?)

 4. Fix PR#50818. (Doesn't help until we can require a fixed GCC, in 
    which case we might as well just go with option #3).

 5. Add -UNO_BUILTIN_VA_FUNCS to OpenSSL build flags or otherwise 
    tweak OpenSslSupport.h to avoid tripping up on it. (As with option
    #1 and #2, this might work for OpenSSL but I'd rather have a fix 
    for the *general* case of non-explicitly-EFIAPI varargs functions.
    Those are currently broken on x86_64 ELF builds *anywhere* in 
    Tianocore, right? Like in the PrintString function in 
    DuetPkg/DxeIpl/Debug.c, found with a very quick grep...)

Anything I missed?

I'm leaning towards a combination of #3 and #5. Switch to -mabi=ms
where we can, so the whole mess can go away in time. And the minimal
tweak to fix it for OpenSSL builds, although there *are* still issues
elsewhere in the tree.

-- 
David Woodhouse                            Open Source Technology Centre
david.woodho...@intel.com                              Intel Corporation

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to