Re: [PATCH 08/12] include: add elf.h support
From: Daniel Gomez
Date: Fri Sep 06 2024 - 04:34:46 EST
On Fri, Sep 06, 2024 at 08:58:15AM +0900, Masahiro Yamada wrote:
> On Thu, Sep 5, 2024 at 5:56 PM Daniel Gomez <da.gomez@xxxxxxxxxxx> wrote:
> >
> > On Mon, Sep 02, 2024 at 01:15:01AM +0900, Masahiro Yamada wrote:
> > > On Sat, Aug 31, 2024 at 4:54 AM Nicolas Schier <nicolas@xxxxxxxxx> wrote:
> > > >
> > > > On Sat, Aug 24, 2024 at 12:54:50AM +0200 Daniel Gomez wrote:
> > > > > On Wed, Aug 07, 2024 at 05:46:03PM +0200, Nicolas Schier wrote:
> > > > > > On Wed, Aug 07, 2024 at 04:18:54PM +0200, Greg Kroah-Hartman wrote:
> > > > > > > On Wed, Aug 07, 2024 at 02:13:57PM +0000, Daniel Gomez wrote:
> > > > > > > > > Also, as this is not internal for the kernel, but rather for userspace
> > > > > > > > > builds, shouldn't the include/ path be different?
> > > > > > > >
> > > > > > > > Can you suggest an alternative path or provide documentation that could help
> > > > > > > > identify the correct location? Perhaps usr/include?
> > > > > > >
> > > > > > > That is better than the generic include path as you are attempting to
> > > > > > > mix userspace and kernel headers in the same directory :(
> > > > > >
> > > > > > Please keep in mind, that usr/include/ currently does not hold a single
> > > > > > header file but is used for dynamically composing the UAPI header tree.
> > > > > >
> > > > > > In general, I do not like the idea of keeping a elf.h file here that
> > > > > > possibly is out-of-sync with the actual system's version (even though
> > > > > > elf.h should not see that much changes). Might it be more helpful to
> > > > > > provide a "development kit" for Linux devs that need to build on MacOS
> > > > > > that provides necessary missing system header files, instead of merging
> > > > > > those into upstream?
> > > > >
> > > > > I took this suggestion and tried pushing a Homebrew formula/package here [1].
> > > > > I think I chose a wrong name and maybe something like "development kit" would
> > > > > have been better. However, would it be possible instead to include the *.rb file
> > > > > in the scripts/ directory? So users of this can generate the development kit in
> > > > > their environments. I would maintain the script to keep it in sync with the
> > > > > required glibc version for the latest kernel version.
> > > > >
> > > > > [1] https://protect2.fireeye.com/v1/url?k=96027706-f7896236-9603fc49-000babffaa23-452f645d7a72e234&q=1&e=343dd31c-5e5b-4b09-8ee5-6c59a1ff826e&u=https%3A%2F%2Fgithub.com%2FHomebrew%2Fhomebrew-core%2Fpull%2F181885
> > > >
> > > > I think it sounds sensible to hold that formula file in the upstream tree. But
> > > > I am not sure if scripts/ is the best location.
> > > >
> > > > Masahiro, what do you think?
> > >
> > >
> > > I do not know much about the homebrew, but why does the upstream
> > > kernel need to merge such masOS stuff?
> >
> > The missing headers (in macOS) need to be provided somehow. One way can be
> > having the formula (*.rb file) in-tree, so users of this can install them in
> > their systems. This would also require to have a tarball with the missing
> > headers either in-tree or somewhere accessible so it can be fetched.
> >
> > To avoid having the formula and a tarball in-tree, I've created a Homebrew Tap
> > (3rd-Party Repository) called 'Bee Headers Project' [1][2][3] that can provision
> > the missing headers. The project provides a bee-headers package and formula
> > that will install byteswap.h, elf.h and endian.h in the user's system Hombrew
> > directory. It also provides a *.pc file so pkg-config can be used to find the
> > location of these headers. I have a v2 with this solution ready, perhaps is
> > easier to discuss this with the code.
>
>
> It is up to you what project you start in Github.
>
> Then, what do you need to submit v2 for this?
I'll just include a reference in the documentation.
And will send the v2 later today.
>
>
>
>
>
> >
> > I think we can extend the same package and include extra headers if we need
> > more in the future. I see for x86_64 asm/types.h and others might be required.
> > The bee-headers package can then be the repository to place and distribute them.
> >
> > Please, let me know if you think of an alternative solution, I can give a try
> > and explore.
> >
> > [1] Project:
> > https://protect2.fireeye.com/v1/url?k=8f1b9871-ee908d54-8f1a133e-74fe485cbff6-b9b8f875df8b37c5&q=1&e=860f3982-d1e4-4fcb-ab79-f181bb7fcda3&u=https%3A%2F%2Fgithub.com%2Fbee-headers
> > [2] Headers repository:
> > https://protect2.fireeye.com/v1/url?k=7c995f7b-1d124a5e-7c98d434-74fe485cbff6-a20d4e643f5978f8&q=1&e=860f3982-d1e4-4fcb-ab79-f181bb7fcda3&u=https%3A%2F%2Fgithub.com%2Fbee-headers%2Fheaders.git
> > [3] Homebrew Tap formula:
> > https://protect2.fireeye.com/v1/url?k=148f40fc-750455d9-148ecbb3-74fe485cbff6-5d795246adb22931&q=1&e=860f3982-d1e4-4fcb-ab79-f181bb7fcda3&u=https%3A%2F%2Fgithub.com%2Fbee-headers%2Fhomebrew-bee-headers.git
> >
> >
> > >
> > >
> > >
> > > >
> > > > Kind regards,
> > > > Nicolas
> > >
> > >
> > >
> > > --
> > > Best Regards
> > > Masahiro Yamada
>
>
>
> --
> Best Regards
> Masahiro Yamada