All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] ELFUTILS - only build for the target architecture...
@ 2020-10-12 23:06 Maurice Smulders
  2020-10-13 11:47 ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Maurice Smulders @ 2020-10-12 23:06 UTC (permalink / raw)
  To: buildroot

Currently, ELFUTILS gets built for all architectures it looks like.

safe:/usr/lib/elfutils> ls
libebl_aarch64-0.177.so  libebl_i386.so           libebl_s390-0.177.so
libebl_aarch64.so        libebl_ia64-0.177.so     libebl_s390.so
libebl_alpha-0.177.so    libebl_ia64.so           libebl_sh-0.177.so
libebl_alpha.so          libebl_m68k-0.177.so     libebl_sh.so
libebl_arm-0.177.so      libebl_m68k.so           libebl_sparc-0.177.so
libebl_arm.so            libebl_ppc-0.177.so      libebl_sparc.so
libebl_bpf-0.177.so      libebl_ppc.so            libebl_tilegx-0.177.so
libebl_bpf.so            libebl_ppc64-0.177.so    libebl_tilegx.so
libebl_csky-0.177.so     libebl_ppc64.so          libebl_x86_64-0.177.so
libebl_csky.so           libebl_riscv-0.177.so    libebl_x86_64.so
libebl_i386-0.177.so     libebl_riscv.so

Is there a way to get it built just for the target architecture - in
our case PowerPC (ppc)? I have added minicoredumper to the
customization packages, and it requires elfutils....

This is a lot of extra stuff needed just to support this one architecture...
I can obviously clean it up in the cleanup script, or create a patch
for backends/Makefile.in and or Makefile.am - but this might make
stuff dependent on the actual elfutils release...

-- 
Maurice Smulders

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] ELFUTILS - only build for the target architecture...
  2020-10-12 23:06 [Buildroot] ELFUTILS - only build for the target architecture Maurice Smulders
@ 2020-10-13 11:47 ` Thomas Petazzoni
  2020-10-13 15:25   ` Maurice Smulders
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2020-10-13 11:47 UTC (permalink / raw)
  To: buildroot

Hello Maurice,

On Mon, 12 Oct 2020 17:06:26 -0600
Maurice Smulders via buildroot <buildroot@busybox.net> wrote:

> Currently, ELFUTILS gets built for all architectures it looks like.
> 
> safe:/usr/lib/elfutils> ls  
> libebl_aarch64-0.177.so  libebl_i386.so           libebl_s390-0.177.so
> libebl_aarch64.so        libebl_ia64-0.177.so     libebl_s390.so
> libebl_alpha-0.177.so    libebl_ia64.so           libebl_sh-0.177.so
> libebl_alpha.so          libebl_m68k-0.177.so     libebl_sh.so
> libebl_arm-0.177.so      libebl_m68k.so           libebl_sparc-0.177.so
> libebl_arm.so            libebl_ppc-0.177.so      libebl_sparc.so
> libebl_bpf-0.177.so      libebl_ppc.so            libebl_tilegx-0.177.so
> libebl_bpf.so            libebl_ppc64-0.177.so    libebl_tilegx.so
> libebl_csky-0.177.so     libebl_ppc64.so          libebl_x86_64-0.177.so
> libebl_csky.so           libebl_riscv-0.177.so    libebl_x86_64.so
> libebl_i386-0.177.so     libebl_riscv.so

I don't see these shared libraries when building elfutils with the
current Buildroot. Could you give more details about your Buildroot
version and configuration ?

> Is there a way to get it built just for the target architecture - in
> our case PowerPC (ppc)? I have added minicoredumper to the
> customization packages, and it requires elfutils....

I think these files are all probably built for your target
architecture, but have support for inspecting ELF files from other CPU
architectures? For example, even if you're on PPC system, you may want
to inspect x86 or ARM binaries. But I'm really just guessing here since
I don't have those shared libraries installed when I build elfutils.

And I see in the libebl/Makefile.am that it's a noinst library, so
libebl should not even be installed. That being said, I admit I'm
building with the latest Buildroot, which has elfutils 0.181 and you're
using elfutils 0.177.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] ELFUTILS - only build for the target architecture...
  2020-10-13 11:47 ` Thomas Petazzoni
@ 2020-10-13 15:25   ` Maurice Smulders
  2020-10-13 15:56     ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Maurice Smulders @ 2020-10-13 15:25 UTC (permalink / raw)
  To: buildroot

Thomas,

I am using a (slightly) modified version of 2020.02. It is a hybrid
form of a custom tree and a few patches.

I patched the crosstool section to allow GLIBC to be used for our PPC
e500v2 architecture - isn't that hard, but it requires an older
version of GLIBC (2.29.1) - as the newest version doesn't support PPC
e500 anymore - just like GCC 7.5 is the end of the line for it too
and I made a patch to support compiling cborruby - as the ruby
developers haven't thought at all about cross compiling for other than
Windows on Linux...

I can likely upgrade buildroot to the latest LTS and apply these
patches to be at the same state...

[~/build/buildroot-top/buildroot-customization/package/minicoredumper]$
cat Config.in
              *[master]
config BR2_PACKAGE_MINICOREDUMPER
        bool "MiniCoreDumper"
        select BR2_PACKAGE_ELFUTILS
        help
          MiniCoredumper handler to create limited size core dumps.

          https://www.linutronix.de/minicoredumper

[~/build/buildroot-top/buildroot-customization/package/minicoredumper]$
cat minicoredumper.mk
              *[master]
################################################################################
#
# minicoredumper
#
################################################################################

MINICOREDUMPER_VERSION = 2.0.1
MINICOREDUMPER_SITE = https://www.linutronix.de/minicoredumper/files
MINICOREDUMPER_SOURCE = minicoredumper-$(MINICOREDUMPER_VERSION).tar.xz
MINICOREDUMPER_LICENSE_FILES = COPYING COPYING.BSD COPYING.LGPLv2.1
MINICOREDUMPER_DEPENDENCIES = json-c elfutils

$(eval $(autotools-package))

Maurice

On Tue, Oct 13, 2020 at 5:47 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Maurice,
>
> On Mon, 12 Oct 2020 17:06:26 -0600
> Maurice Smulders via buildroot <buildroot@busybox.net> wrote:
>
> > Currently, ELFUTILS gets built for all architectures it looks like.
> >
> > safe:/usr/lib/elfutils> ls
> > libebl_aarch64-0.177.so  libebl_i386.so           libebl_s390-0.177.so
> > libebl_aarch64.so        libebl_ia64-0.177.so     libebl_s390.so
> > libebl_alpha-0.177.so    libebl_ia64.so           libebl_sh-0.177.so
> > libebl_alpha.so          libebl_m68k-0.177.so     libebl_sh.so
> > libebl_arm-0.177.so      libebl_m68k.so           libebl_sparc-0.177.so
> > libebl_arm.so            libebl_ppc-0.177.so      libebl_sparc.so
> > libebl_bpf-0.177.so      libebl_ppc.so            libebl_tilegx-0.177.so
> > libebl_bpf.so            libebl_ppc64-0.177.so    libebl_tilegx.so
> > libebl_csky-0.177.so     libebl_ppc64.so          libebl_x86_64-0.177.so
> > libebl_csky.so           libebl_riscv-0.177.so    libebl_x86_64.so
> > libebl_i386-0.177.so     libebl_riscv.so
>
> I don't see these shared libraries when building elfutils with the
> current Buildroot. Could you give more details about your Buildroot
> version and configuration ?
>
> > Is there a way to get it built just for the target architecture - in
> > our case PowerPC (ppc)? I have added minicoredumper to the
> > customization packages, and it requires elfutils....
>
> I think these files are all probably built for your target
> architecture, but have support for inspecting ELF files from other CPU
> architectures? For example, even if you're on PPC system, you may want
> to inspect x86 or ARM binaries. But I'm really just guessing here since
> I don't have those shared libraries installed when I build elfutils.
>
> And I see in the libebl/Makefile.am that it's a noinst library, so
> libebl should not even be installed. That being said, I admit I'm
> building with the latest Buildroot, which has elfutils 0.181 and you're
> using elfutils 0.177.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com



-- 
Maurice Smulders, GTI

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] ELFUTILS - only build for the target architecture...
  2020-10-13 15:25   ` Maurice Smulders
@ 2020-10-13 15:56     ` Thomas Petazzoni
  2020-10-13 16:11       ` Maurice Smulders
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2020-10-13 15:56 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 13 Oct 2020 09:25:53 -0600
Maurice Smulders <maurice.smulders@genevatech.net> wrote:

> I am using a (slightly) modified version of 2020.02. It is a hybrid
> form of a custom tree and a few patches.
> 
> I patched the crosstool section to allow GLIBC to be used for our PPC
> e500v2 architecture - isn't that hard, but it requires an older
> version of GLIBC (2.29.1) - as the newest version doesn't support PPC
> e500 anymore - just like GCC 7.5 is the end of the line for it too
> and I made a patch to support compiling cborruby - as the ruby
> developers haven't thought at all about cross compiling for other than
> Windows on Linux...

Hm, we still have e500v2 supported in Buildroot but indeed only in the
"Classic" PowerPC ABI, and not the SPE ABI which indeed is no longer
supported since gcc 8.x.

I assume you're not able to use the Classic PowerPC ABI for some reason?

> I can likely upgrade buildroot to the latest LTS and apply these
> patches to be at the same state...

So indeed, in elfutils 0.177, I do see all those per-architecture
shared libraries. I looked at upstream elfutils, and they changed
things in commit 4f937e24dc7ad1820fc7c99a6dd6422657f14666, which says:

    Don't use dlopen() for libebl modules
    
    Currently, architecture-specific code for libebl exists in separate
    libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime.
    This makes it impossible to have standalone, statically-linked binaries
    which use libdwfl if they depend on any architecture-specific
    functionality. Additionally, when these libraries cannot be found, the
    failure modes are non-obvious. So, let's get rid of libebl_$arch.so and
    move it all into libdw.so/libdw.a, which simplifies things considerably.
    
    Signed-off-by: Omar Sandoval <osandov@fb.com>

So prior to that commit (for example elfutils 0.177), libebl what
dlopen-ing those per-architecture .so files. Now, all the code is built
into the libebl library directly.

And there's indeed no way to selectively compile support for only a
subset of the CPU architectures. But again, this is not about the CPU
architecture we run on: all those shared libraries are compiled for
your selected CPU architecture. However, they contain code to
manipulate ELF binaries that have been compiled for other CPU
architectures.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] ELFUTILS - only build for the target architecture...
  2020-10-13 15:56     ` Thomas Petazzoni
@ 2020-10-13 16:11       ` Maurice Smulders
  0 siblings, 0 replies; 5+ messages in thread
From: Maurice Smulders @ 2020-10-13 16:11 UTC (permalink / raw)
  To: buildroot

Thomas,

I am rebuilding with a patched br to use 0.188 of Elfutils. I have
started a discussion subject in the elfutils discussion list too - and
there is some agreement that it is really should support selective
targets, I'll forward you that thread.

And yes, the processor I am using (MPC8548E) is a SPE processor, with
it's funky partial APU (FP primitives only). I currently have no
choice to go to another one for our application.

Maurice

On Tue, Oct 13, 2020 at 9:56 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Tue, 13 Oct 2020 09:25:53 -0600
> Maurice Smulders <maurice.smulders@genevatech.net> wrote:
>
> > I am using a (slightly) modified version of 2020.02. It is a hybrid
> > form of a custom tree and a few patches.
> >
> > I patched the crosstool section to allow GLIBC to be used for our PPC
> > e500v2 architecture - isn't that hard, but it requires an older
> > version of GLIBC (2.29.1) - as the newest version doesn't support PPC
> > e500 anymore - just like GCC 7.5 is the end of the line for it too
> > and I made a patch to support compiling cborruby - as the ruby
> > developers haven't thought at all about cross compiling for other than
> > Windows on Linux...
>
> Hm, we still have e500v2 supported in Buildroot but indeed only in the
> "Classic" PowerPC ABI, and not the SPE ABI which indeed is no longer
> supported since gcc 8.x.
>
> I assume you're not able to use the Classic PowerPC ABI for some reason?
>
> > I can likely upgrade buildroot to the latest LTS and apply these
> > patches to be at the same state...
>
> So indeed, in elfutils 0.177, I do see all those per-architecture
> shared libraries. I looked at upstream elfutils, and they changed
> things in commit 4f937e24dc7ad1820fc7c99a6dd6422657f14666, which says:
>
>     Don't use dlopen() for libebl modules
>
>     Currently, architecture-specific code for libebl exists in separate
>     libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime.
>     This makes it impossible to have standalone, statically-linked binaries
>     which use libdwfl if they depend on any architecture-specific
>     functionality. Additionally, when these libraries cannot be found, the
>     failure modes are non-obvious. So, let's get rid of libebl_$arch.so and
>     move it all into libdw.so/libdw.a, which simplifies things considerably.
>
>     Signed-off-by: Omar Sandoval <osandov@fb.com>
>
> So prior to that commit (for example elfutils 0.177), libebl what
> dlopen-ing those per-architecture .so files. Now, all the code is built
> into the libebl library directly.
>
> And there's indeed no way to selectively compile support for only a
> subset of the CPU architectures. But again, this is not about the CPU
> architecture we run on: all those shared libraries are compiled for
> your selected CPU architecture. However, they contain code to
> manipulate ELF binaries that have been compiled for other CPU
> architectures.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com



-- 
Maurice Smulders, GTI

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-13 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 23:06 [Buildroot] ELFUTILS - only build for the target architecture Maurice Smulders
2020-10-13 11:47 ` Thomas Petazzoni
2020-10-13 15:25   ` Maurice Smulders
2020-10-13 15:56     ` Thomas Petazzoni
2020-10-13 16:11       ` Maurice Smulders

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.