<feed xmlns='http://www.w3.org/2005/Atom'>
<title>staging/jow/tools/elfutils, branch main</title>
<subtitle>Staging tree of Jo-Philipp Wich</subtitle>
<id>https://git-03.infra.openwrt.org/openwrt/staging/jow/atom?h=main</id>
<link rel='self' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/'/>
<updated>2024-09-30T09:07:04Z</updated>
<entry>
<title>tools/elfutils: prevent invalid include of stack binary</title>
<updated>2024-09-30T09:07:04Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-09-28T11:06:59Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=484f71f4e6781587e613d4133a083db03685baaa'/>
<id>urn:sha1:484f71f4e6781587e613d4133a083db03685baaa</id>
<content type='text'>
In some versions of Xcode, some C++ header has an include
of the standard C++ header "stack" while "." is in the include paths
which can conflict with the binary "stack" built by elfutils.
This leads to a decode error as the binary is interpreted as text.

Add an arbitrary dependency between stack and the C++ program.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: simplify and cleanup Makefile</title>
<updated>2024-07-08T06:49:43Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-06-20T05:28:00Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=3b3a81f18eb8e1b46301f31dde40260bff51ce28'/>
<id>urn:sha1:3b3a81f18eb8e1b46301f31dde40260bff51ce28</id>
<content type='text'>
After changes to default host build recipes
and default variable definitions,
several custom definitions can be removed,
and the gnulib recipes replaced
with hooks to common recipes.

Also remove leftover PKG_INSTALL
which has no effect for host builds.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15853
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: remove header symlink between subdirectories</title>
<updated>2024-07-08T06:49:42Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-05-15T23:43:00Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=f9a1996367628d4e5a0849f58a2d29abb6b89bd5'/>
<id>urn:sha1:f9a1996367628d4e5a0849f58a2d29abb6b89bd5</id>
<content type='text'>
Replace the symlink in the build recipe for gnulib
with an extra include path flag in CPPFLAGS to the lib subdirectory
so that it is the last in the order of include paths,
and use a quote escape to make the flag a literal string
in order to use Make variables within it.

The original reason this is necessary is because the config.h header
provided by the project at the top-level build directory
calls another header eu-config.h
which is stored in the lib subdirectory instead of the top-level,
and building the gnulib library requires the config.h header.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15853
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: add more pkg-config library info</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-06-18T04:01:31Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=f560588b05b90df55bd0cf516ec22f2d6ce5516e'/>
<id>urn:sha1:f560588b05b90df55bd0cf516ec22f2d6ce5516e</id>
<content type='text'>
In order for linking the static libraries from elfutils to work,
other libraries need to be included to handle the references
to functions made in the library's objects that are not included
as they would already be if the library was a shared object instead.

A shared object library stores this list of libraries when it was made,
so that the dynamic linker can refer to that list at runtime,
but a static library has no such functionality so the list of libraries
for missing functions must be included at link time.

This information was already added to the pc file for libelf
using the definitions in src/Makefile.am,
so extend this to the rest of the pc files in the project.

For situations where the libraries may be used
without pkg-config setting the flags and library list,
this patch and the pc files can serve as a quick reference.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: use weak alias over no alias for macOS</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-06-11T03:59:10Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=e4fb7c9544d607ce9d63bcfaa955fc3b28b3898e'/>
<id>urn:sha1:e4fb7c9544d607ce9d63bcfaa955fc3b28b3898e</id>
<content type='text'>
Clang has support for weak aliases
despite no support for strong aliases,
but it only works with the #pragma directive.

Implementing weak aliases instead of none
is likely a more upstream-friendly solution
for supporting building on other platforms.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: split upstreamable parts of portability patch</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-05-18T03:21:42Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=52a53445014d87cf4cdc5484a8293a41b6f5b274'/>
<id>urn:sha1:52a53445014d87cf4cdc5484a8293a41b6f5b274</id>
<content type='text'>
The addition of LT_INIT as well as the adjustment of
the BUILD_STATIC and addition of the BUILD_SHARED conditionals
and their usage to block building of shared objects
and adjust the variables for building static libraries
is potentially upstream-friendly.

The use of a manifest file to keep a list
of the objects in each library instead of calling ar
is also potentially upstream-friendly.

Separate these changes from the macOS-specific hacks.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: use conditional to block build of shared objects</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-05-18T01:23:33Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=9670a38d08c1d842f16ef7811080808f2c147898'/>
<id>urn:sha1:9670a38d08c1d842f16ef7811080808f2c147898</id>
<content type='text'>
Add a potentially upstream-friendly conditional
using the libtool configure variable "enable_shared"
in order to block building and installing of shared objects
and adjust the build of static libraries
instead of directly patching lines in or out.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: do not use ar to list library objects</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-06-13T19:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=954179e412f19484fb9354f4c52f4beb9deb94a3'/>
<id>urn:sha1:954179e412f19484fb9354f4c52f4beb9deb94a3</id>
<content type='text'>
The use of ar to list the archive members in a library
in order to include them in another library is not portable.

On BSD and macOS, ar will also list
the special archive member "__.SYMDEF"
which is not a compiled object, rather it is
part of the metadata prepended to the library by ranlib.

Fix this by writing the list of unique objects used
to create the library into a separate "manifest" file
when the library is created, which will be read later
when the Makefiles of other subdirectories are ran.

Extend this to all other libraries whether or not they are linked
to another library for a shared object that is installed
so that it is possible for any of the libraries
to be statically built with more objects.

The use of the wildcard function to ignore the
special archive members which are only metadata
is no longer needed to prevent build errors.

Not using the wildcard function is preferred,
since errors should be caught during the build
instead of when linking something else or at runtime.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: do not use libtool for all subdirectories</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-05-18T00:11:58Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=8ce3873a28b1ee31125a10e813c0b685662a6b91'/>
<id>urn:sha1:8ce3873a28b1ee31125a10e813c0b685662a6b91</id>
<content type='text'>
Importing gnulib in order to have a local portable library
to link against for missing functions currently requires
using libtool to produce the libgnu.la library.

Ideally, linking would be simple if the rest of the libraries
built by elfutils were also built using libtool, as linking
them together would not require any manipulations of library paths.

However, upstream elfutils does not support building the libraries
statically with libtool, so using libtool comes at the cost
of creating a huge patch to introduce that functionality.

For building on macOS, it turns out that libgnu.la is only needed
for building the binaries, and that just one or two objects from libgnu
are needed to build the libraries, so in this case, it would be simple
to add the specific non-libtool-wrapped library and objects
to the link paths as needed, rather than use libtool to link
the libtool wrappers, which greatly reduces the need to patch.

Not using libtool also makes the original Makefile definitions for LIBADD
once again be the right ones to use. However, to be portable,
for libdw the wildcard function needs to be used in order to exclude
special archive members like "__.SYMDEF" which are not compiled objects
because some BSD-like versions of ar include that metadata in the list,
or because the library included may have objects from another subdirectory.
Also, the rest of the subdirectories have custom "LDLIBS" variables
meant for building shared objects only, so define the LIBADD variables
with objects from those existing definitions so that when building only
the static versions of the libraries, those objects can still be included.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
<entry>
<title>tools/elfutils: use gnulib module for posix_fallocate()</title>
<updated>2024-06-19T09:22:13Z</updated>
<author>
<name>Michael Pratt</name>
</author>
<published>2024-06-10T18:43:04Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/openwrt/staging/jow/commit/?id=c07a23416442ab9719d6fdb2fa73d680fbb2097e'/>
<id>urn:sha1:c07a23416442ab9719d6fdb2fa73d680fbb2097e</id>
<content type='text'>
The version of posix_fallocate() patched into elfutils
for macOS using code from Mozilla is now patched into gnulib.

Import the fallocate-posix module and always link
the corresponding object to libraries whenever it is built.

Signed-off-by: Michael Pratt &lt;mcpratt@pm.me&gt;
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko &lt;robimarko@gmail.com&gt;
</content>
</entry>
</feed>
