public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: edk2-devel-groups-io <devel@edk2.groups.io>, kraxel@redhat.com
Subject: Re: [edk2-devel] [PATCH 00/24] CryptoPkg/openssl: update openssl submodule to v3.0
Date: Fri, 28 Jan 2022 16:00:26 +0000	[thread overview]
Message-ID: <CAKbZUD2ZaR7gqRhdhuvwWQnyXqY8BYDGCHM3xjL=UMc-fX1dHQ@mail.gmail.com> (raw)
In-Reply-To: <20220128140723.isljt6lz6the7k5y@sirius.home.kraxel.org>

[-- Attachment #1: Type: text/plain, Size: 5426 bytes --]

Also, quick note: I've seen linking blowing up because the ABIs being used
in the bare metal code and in libgcc were different; this was in riscv64. I
know x86 doesn't do such checks but a few others do, including RISCV (they
tag object files with the ABI). This makes libgcc unusable in such
architectures.

If we want to provide intrinsics, then possibly shipping our own
compiler-rt would be the only solid option.

On Fri, 28 Jan 2022, 14:07 Gerd Hoffmann, <kraxel@redhat.com> wrote:

>   Hi,
>
> Oops, dropped the list by mistake, forwarding ...
>
> ----- Forwarded message from "kraxel@redhat.com" <kraxel@redhat.com> -----
>
> Date: Fri, 28 Jan 2022 10:35:10 +0100
> Subject: Re: [edk2-devel] [PATCH 00/24] CryptoPkg/openssl: update openssl
>  submodule to v3.0
> From: "kraxel@redhat.com" <kraxel@redhat.com>
> To: Kilian Kegel <kilian_kegel@outlook.com>
> Message-ID: <20220128093510.atupc4ly6bvwinlk@sirius.home.kraxel.org>
> Content-Type: text/plain; charset=utf-8
>
>   Hi,
>
> > On my 32Bit Ubuntu standard installation I ran
> >
> >   1.  cc - Xlinker -Map=static.map hello.c -static
> >   2.  cc  -Xlinker -Map=shared.map hello.c
> >
> > The first .OBJ file mentioned in the .MAP file is in both cases:
> > /usr/lib/gcc/i686-linux-gnu/6/libgcc.a(_udivdi3.o)
>
> Yes, you are correct.  gcc provides both shared and static intrinsics.
> There is a command line switch to pick which one you want
> (-static-libgcc, -shared-libgcc).
>
> > It seems to me that GNU holds the intrinsic functions in a separate
> library
> > that can be used without any change, and is always correct by definition.
>
> >   1.  add libgcc.a as a search library, adjust the conf\tools_def.txt
> like:
> >
> > DEBUG_GCCxx_IA32_DLINK_FLAGS   = …predefined parameter …
> /usr/lib/gcc/i686-linux-gnu/6/libgcc.a
>
> gcc documentation suggests to use just '-lgcc' (should pick the correct
> library no matter what the compiler version and architecture is), so I
> tried this:
>
> -DEFINE GCC_DLINK2_FLAGS_COMMON     =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
> +DEFINE GCC_DLINK2_FLAGS_COMMON     =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds -lgcc
>
> Build doesn't come very far.  Looks like the gcc intrinsics are not
> free-standing but want call into libc:
>
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_absvsi2.o): in
> function `__absvdi2':
> (.text+0x18): undefined reference to `abort'
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_absvsi2.o): in
> function `__absvsi2':
> (.text+0x32): undefined reference to `abort'
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_absvdi2.o): in
> function `__absvti2.cold':
> (.text.unlikely+0x2): undefined reference to `abort'
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_addvsi3.o): in
> function `__addvdi3':
> (.text+0xf): undefined reference to `abort'
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_addvsi3.o): in
> function `__addvsi3':
> (.text+0x2d): undefined reference to `abort'
> /usr/bin/ld:
> /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_addvdi3.o):(.text.unlikely+0x2):
> more undefined references to `abort' follow
> /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_eprintf.o): in
> function `__eprintf':
> (.text+0x8): undefined reference to `stderr'
> /usr/bin/ld: (.text+0x1d): undefined reference to `fprintf'
> /usr/bin/ld: (.text+0x25): undefined reference to `fflush'
> /usr/bin/ld: (.text+0x2a): undefined reference to `abort'
> /usr/bin/ld:
> /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(generic-morestack.o): in
> function `__morestack_fail':
> (.text+0xbc): undefined reference to `writev'
> [ ... more errors snipped ... ]
>
> The generic-morestack.o issues should be solvable, that shouldn't be
> something which tianocore actually needs.  Not sure why the linker tries
> to resolve symbols for object files which should not be needed in the
> first place.  Possibly something else is fishy here, any hints are
> welcome.  Something in the linker script maybe?
>
> But the math intrinsics apparently having error paths which print a
> message and abort doesn't look very promising to me.
>
> Also: When trying arm cross-builds I run into the ABI problem already
> mentioned elsewhere in this thread:
>
> /usr/bin/arm-linux-gnu-ld: error:
> /usr/lib/gcc/arm-linux-gnueabi/11/libgcc.a(_muldi3.o) uses VFP register
> arguments,
> /home/kraxel/projects/edk2/Build/ArmVirtQemu-ARM/DEBUG_GCC5/ARM/OvmfPkg/VirtioBlkDxe/VirtioBlk/DEBUG/VirtioBlkDxe.dll
> does not
>
> Patches are here:
>   https://github.com/kraxel/edk2/commits/intrinsics-playground
>
> > >* I have my doubts that compiler's builtin libraries are optimized for
> > >   size, so I'd suspect we would see a noticeable size grow from that.
> > Please check the size of __udivdi3() and whether the tianocore
> reimplementation is smaller or not
>
> I'll rather check the size of the final binaries, but I can only do that
> once the build works ...
>
> > The intrinsic library belongs to the compiler not to the build system.
>
> I'm open to explore that path, but apparently we have a number of road
> blocks along the way.  Seems neither gcc nor xcode (see other reply)
> provide a usable free-standing intrinsic library ...
>
> take care,
>   Gerd
>
>
>
> 
>
>
>

[-- Attachment #2: Type: text/html, Size: 6733 bytes --]

  parent reply	other threads:[~2022-01-28 16:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 14:07 [edk2-devel] [PATCH 00/24] CryptoPkg/openssl: update openssl submodule to v3.0 Gerd Hoffmann
2022-01-28 14:14 ` Gerd Hoffmann
2022-01-28 15:54 ` Pedro Falcato
2022-02-01  9:39   ` Gerd Hoffmann
2022-01-28 16:00 ` Pedro Falcato [this message]
2022-01-28 16:12   ` Kilian Kegel
2022-02-01  9:50   ` Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2021-12-03 16:07 Gerd Hoffmann
2021-12-03 16:32 ` [edk2-devel] " Michael D Kinney
2021-12-03 16:42   ` Yao, Jiewen
2022-01-17 11:46     ` Gerd Hoffmann
2022-01-18 11:12       ` Yao, Jiewen
2022-01-18 16:12         ` Michael D Kinney
2022-01-21  8:33           ` Gerd Hoffmann
2022-01-21 16:34             ` Michael D Kinney
2022-01-21  8:30         ` Gerd Hoffmann
2022-01-21 16:38           ` Michael D Kinney
2022-01-24 16:24             ` Kilian Kegel
2022-01-24 17:28               ` Michael D Kinney
2022-01-24 19:58                 ` Pedro Falcato
2022-01-26 11:02                   ` Gerd Hoffmann
2022-01-27 22:26                     ` Kilian Kegel
2022-01-28  0:55                       ` Andrew Fish
2022-01-28  9:06                         ` Pedro Falcato
2022-01-28 10:14                           ` Gerd Hoffmann
2022-01-28 11:23                             ` Pedro Falcato
2022-01-28  9:51                         ` Gerd Hoffmann
2022-01-30 20:17                         ` Kilian Kegel
2022-02-01  9:55                           ` Gerd Hoffmann
2022-02-02 12:07                             ` Kilian Kegel
2022-01-25 20:05                 ` Kilian Kegel
2022-01-23  8:41           ` Yao, Jiewen
2021-12-06  8:05   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKbZUD2ZaR7gqRhdhuvwWQnyXqY8BYDGCHM3xjL=UMc-fX1dHQ@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox