tools/elfutils: do not use ar to list library objects
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>