Fakeroot uses an egrep configure check to look for the string "time64"
within a preprocessed include of the sys/stat.h header
in order to decide whether or not to create declarations
and internal functions used for wrapping the native functions
stat64_time64 fstat64_time64 lstat64_time64 and fstatat64_time64.
On specific older versions of glibc these functions are not included,
but there are some references to "time64" unrelated to functions,
like aliasing the time64_t typedef to the standard time_t typedef
when the size of a word is 64 bits or defining it if not.
In this case, a grep for "stat64"
of the preprocessed sys/stat.h header matches nothing,
however, the grep for "time64" in the configure check
of the preprocessed sys/stat.h header matches a line
that has nothing to do with the functions
that will be wrapped as a result of successful matching.
__extension__ typedef __int64_t __time64_t;
This causes the attempt to wrap the functions to occur,
which fails due to some of the corresponding macros being empty
since the native declarations they are based on do not exist,
causing a common error claiming that a part of the syntax is missing.
error: expected '=', ',', ';', 'asm' or '__attribute__' before ...
Fix this by making the testing regular expression more complex
in order to match actual function names ending in "_time64"
with or without a set of preceding underscores, but none after.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15773
Signed-off-by: Robert Marko <robimarko@gmail.com>
224d497dd94f srec2bin: drop unused "dum" variable
6777b2d51961 uimage_sgehdr: use "char" type for header struct strings
81db3025aac5 uimage_sgehdr: drop unused "ltmp" variable
bd7fcc74b43e pc1crypt: make decrypt/encrypt functions take void * as argument
6ac44974185a linksys: add magic header generation tool for e8350 v1
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
As a side-effect to adding a gnulib module for posix_fallocate(),
there are changes to the input file for fcntl.h which
are not handled here since autoreconf is not ran.
Skip updating the fcntl.h header from gnulib
and use the version shipped with the release.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
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>
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
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 <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add a module to gnulib to support posix_fallocate()
for macOS and other systems that are missing it.
Apple-specific code is sourced from Mozilla,
and the rest from glibc, both licensed under LGPL.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
Several changes to the elfutils source files
made during the process of figuring out how to
successfully build elfutils on macOS
turn out to not be necessary to do so,
and were most likely leftover bits during testing.
Remove the line changes that are not needed
and add some line changes to adapt to sources as is:
- Remove now unnecessary bump to autoconf version prereq
- AC_CONFIG_MACRO_DIRS is not necessary to define
as ACLOCAL_AMFLAGS is already defined in Makefiles
- let libtool "enable_static" variable also decide the value
of the local conditional BUILD_STATIC
- override configure variables instead of removing
checks for libraries or additions to LDFLAGS
- only exclude "hidden" attribute for macOS instead of deleting
- preserve original list of sources to build for libelf
- use openwrt Makefile to add gnulib headers
- use openwrt Makefile to add LIBADD variables
- remove deletion of variables and rules for shared objects
- prefer recursively expanded variables over muliple renames
each time that a word is added to its value
- remove changes to subdirectories that are not built
and remove changes to target files of those subdirectories
- prefer basic text rename over variables in cases where
there would be no line number difference
- give LT_INIT forced default values that match upstream
- move gl_EARLY and gl_INIT down relative to compiler checks
- reorganize some line changes to save some lines
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
The gnulib-tool script is written to have a fatal error
whenever the minimum required version of autoconf
for the project that gnulib is being imported into
as defined in configure.ac was less than
the minimum required version required by gnulib.
However, none of this matters if the version of autoconf
that we use is newer than both requirements.
Instead, use functions from the bootstrap script
to check for the version of autoconf being used
and print a warning whenever this case occurs.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
Overriding variables used in both the macros and the headers
like setting REPLACE_FCNTL to 0 while invoking Make causes the
function aliases like rpl_fcntl() to not be defined,
however the object may still be built with the fnctl() function.
Usually this is enough for building while avoiding
the need to link the resulting libgnu library
to every single other build target for a project
in order to include the gnulib copy of the function,
because in these cases we don't care which version
of the function is used.
However for functions like fcntl() this doesn't work
as it is designed to use either the alias or standard declaration
from gnulib headers in order to be
a wrapper for the native host copy of fcntl()
by containing recursive calls to fcntl() within itself
after undefining the gnulib function declaration.
Overriding the variables used by the header when invoking Make
causes the header's declarations to be blocked,
and this results in the gnulib version of fcntl()
to call itself recursively and indefinitely
leading to segmentation faults.
Fix this by using macros defined with those variables
in order to exclude the function during preprocessing.
While at it, do the same for reallocarray()
so that the configure option --avoid=reallocarray
and Make variable REPLACE_REALLOCARRAY set to 0
would have a similar effect.
In the future this patch can be expanded to include
more functions and some version of this may be upstreamable.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15690
Signed-off-by: Robert Marko <robimarko@gmail.com>
Instead of backporting select 1.35 fixes to make tar work for us, lets
update to 1.35 now that we have identified the upstream fix for macOS.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/15743
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Backport an upstream patch series that adds backend elfutils support for
DWARF relocations in MIPS debug info. This support is needed by pahole to
generate BTF for modules in BTF-enabled kernel builds.
The problem first manifests as pahole warnings during build:
BTF [M] lib/libcrc32c.ko
die__process_unit: DW_TAG_compile_unit (0x11) @ <0x932d> not handled!
die__process_unit: tag not supported 0x11 (compile_unit)!
die__process: got compile_unit unexpected tag after DW_TAG_compile_unit!
die__process_unit: DW_TAG_compile_unit (0x11) @ <0x99a3> not handled!
die__process_unit: tag not supported 0x11 (compile_unit)!
die__process: got compile_unit unexpected tag after DW_TAG_compile_unit!
During system boot the problem then causes module loading failures, which
may result in many other runtime issues:
[ 13.169785] kmodloader: loading kernel modules from /etc/modules.d/*
[ ... ]
[ 17.422840] mac80211_hwsim: initializing netlink
[ 17.526518] PPP generic driver version 2.4.2
[ 17.550346] NET: Registered PF_PPPOX protocol family
[ 17.795353] kmodloader: 26 modules could not be probed
[ 17.796084] kmodloader: dependency not loaded nf_conntrack
[ 17.796737] kmodloader: - act_connmark - 1
[ 17.797402] kmodloader: dependency not loaded nf_conntrack
[ 17.798056] kmodloader: - act_ctinfo - 1
[ ... ]
Link: https://lore.kernel.org/bpf/ZlkoM6%2FPSxVcGM6X@kodidev-ubuntu/
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/15697
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tar 1.34 ship an old version of paxlib with rtapelib.c that produce some
compilation warning. This library got updated in 1.35 but we still can't
use the new Tar version.
GCC 14 then made these compilarion warning errors.
Manually backport the fixes to rtapelib.c and patch the version shipped
in 1.34 to fix these compilation warning.
Fixes: #15692
Fixes: 2951e0a80e ("tools: tar: backport patches fixing broken --delete")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
In experimenting with --delete for APK handling, it was discovered that
--delete is broken and corrupts the TAR in some case.
This is fixed in version 1.35 but 1.35 introduce some problem with MacOS
making it difficult to bump. Backport the 2 required patches to fix this
problem so --delete is usable again.
Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Since the Yafut tool is now used for both updating the kernel on
MikroTik devices with NAND flash and preparing firmware images for
MikroTik devices with NOR flash, remove the kernel2minor utility from
the tree as it is no longer used for anything.
Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
Link: https://github.com/openwrt/openwrt/pull/13453
Signed-off-by: Robert Marko <robimarko@gmail.com>
The Yafut tool now has limited capabilities for working on filesystem
images stored in regular files. This enables preparing Yaffs2 images
for devices with NOR flash using upstream Yaffs2 filesystem code instead
of the custom kernel2minor tool.
Since minimizing the size of the resulting filesystem image size is
important and upstream Yaffs2 code requires two allocator reserve blocks
to be available when writing a file to the filesystem, a trick is
employed while preparing an OpenWRT image: the blank filesystem image
that Yafut operates on initially contains two extra erase blocks that
are chopped off after the kernel file is written. This is safe to do
because Yaffs2 has a true log structure and therefore only ever writes
sequentially (and the size of the kernel file is known beforehand).
While the two extra erase blocks are necessary for writes, Yaffs2 code
seems to be perfectly capable of reading back files from a "truncated"
filesystem that does not contain these extra erase blocks.
In terms of image size, this new approach is only marginally worse than
the current kernel2minor-based one: specifically, upstream Yaffs2 code
needs to write three object headers (each of which takes up an entire
data chunk) when the kernel file is written to the filesystem:
- an object header for the kernel file when it is created,
- an object header for the root directory when the kernel file is
created,
- an updated object header for the kernel file when the latter is
fully written (so that its new size can be recorded).
kernel2minor only writes two of these headers, which is the absolute
minimum required for reading the file back. This means that the
Yafut-based approach causes firmware images to be at most one erase
block (64 kB) larger than those created using kernel2minor, but only in
the very unfortunate scenario where the size of the kernel file is
really close to a multiple of the erase block size.
The rest of the calculations performed when the empty filesystem image
is first prepared stems from the Yaffs2 layout used by MikroTik NOR
devices: each 65,536-byte erase block contains 63 chunks, each of which
consists of 1024 bytes of data followed by 16-byte Yaffs tags without
ECC data; each such group of 63 chunks is then followed by 16 bytes of
padding, which translates to "-C 1040 -B 64k -E" in the Yafut
invocation. Yaffs2 checkpoints and summaries are disabled (using
Yafut's -P and -S switches, respectively) as they are merely performance
optimizations that require extra storage space. The -L and -M switches
are used to force little-endian or big-endian byte order (respectively)
in the resulting filesystem image, no matter what byte order the build
host uses. The tr invocation is used to ensure that the filesystem
image is initialized with 0xFF bytes (which are an indicator of unused
space for Yaffs2 code).
Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
Link: https://github.com/openwrt/openwrt/pull/13453
Signed-off-by: Robert Marko <robimarko@gmail.com>
The Yafut tool has so far been used to update the kernel on devices with
NAND flash via MTD character devices. Recent upstream updates extended
the tool with limited support for working with filesystem images stored
in regular files. This enables Yafut to be used for preparing a Yaffs
filesystem image for a device with NOR flash on a build host and
subsequently flashing it to the target device without using Yafut
itself.
Add Yafut to tools/ so that it can be compiled and run on the host
building OpenWRT.
Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
Link: https://github.com/openwrt/openwrt/pull/13453
Signed-off-by: Robert Marko <robimarko@gmail.com>
Trying to compile elfutils on Fedora 40 with GCC 14.1.1 will fail with:
/home/robimarko/Building/AX3600/qualcommax/staging_dir/host/bin/g++ -std=c++11 -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/home/robimarko/Building/AX3600/qualcommax/staging_dir/host/share/locale"' -DDEBUGPRED=0 -DSRCDIR=\"/home/robimarko/Building/AX3600/qualcommax/build_dir/host/elfutils-0.191/src\" -DOBJDIR=\"/home/robimarko/Building/AX3600/qualcommax/build_dir/host/elfutils-0.191/src\" -I. -I.. -I../libgnu -I../libgnu -I. -I. -I../lib -I.. -I./../libelf -I./../libebl -I./../libdw -I./../libdwelf -I./../libdwfl -I./../libasm -I../debuginfod -I/home/robimarko/Building/AX3600/qualcommax/staging_dir/host/include -std=c++11 -Wall -Wshadow -Wtrampolines -Wlogical-op -Wduplicated-cond -Wnull-dereference -Wimplicit-fallthrough=5 -Werror -Wunused -Wextra -Wstack-usage=262144 -D_FORTIFY_SOURCE=3 -c -o srcfiles.o srcfiles.cxx
In file included from /usr/include/c++/14/x86_64-redhat-linux/bits/os_defines.h:39,
from /usr/include/c++/14/x86_64-redhat-linux/bits/c++config.h:2521,
from /usr/include/c++/14/cstdlib:41,
from ../libgnu/gettext.h:56,
from ../libgnu/eu-config.h:62,
from ../config.h:2378,
from srcfiles.cxx:31:
/usr/include/features.h:414:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
414 | # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
| ^~~~~~~
cc1plus: all warnings being treated as errors
So, lets do as the error says and pass -O2 in HOST_CXXFLAGS like we already
do by default in HOST_CFLAGS.
Link: https://github.com/openwrt/openwrt/pull/15368
Signed-off-by: Robert Marko <robimarko@gmail.com>
The compiled library resulting from importing gnulib has been
linked to libelf in order to easily cover other link dependencies.
However, this is not appropriate for linking libelf to other programs
as it bloats the resulting libelf library, and may result in
multiple defintions of symbols based on whether or not
certain modules from gnulib are included while elfutils
already has it's own definition of a function.
This is not a problem while building elfutils, because gnulib has
it's own way of creating function aliases and special declarations
that allow the linker to ignore the original function definitions,
however, when libelf is used to link to something else,
this results in an error at link time.
The gnulib manual recommended linking the libraries directly,
but those who have written it may not have considered how this
can affect the ability to link that library in other builds,
they likely assume the build targets would not be a dependency.
Fix this by removing the linking between gnulib and libelf
and instead overriding Make variables in order to add linking
between gnulib and each of the binaries provided by elfutils,
using Make functions to avoid applying it to other subdirectories.
The function tdestroy() would still be missing on macOS,
but the existence of the gnulib tsearch object having been built
is an indicator of whether or not it is needed
because it is only built conditionally by gnulib,
so include linking that object only when it exists.
Block the unnecessary replacement of some functions by gnulib
so that future linking with libelf doesn't require
the associated gnulib "rpl" prefixed functions.
These replacements are very strict in order to correct
minor bugs that don't have a real impact in almost all cases
or new standards requirements that are not yet in effect or used.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15368
Signed-off-by: Robert Marko <robimarko@gmail.com>
Install binaries that are not common with binutils
instead of none at all. This adds a negligible time to the build.
Building shared libraries is disabled, so the AM_LDFLAGS can be reset
without the rpath-link option which is unrecognized by clang.
Some of the binaries depend on functions that are defined
using a "strong alias" instead of a normal definition,
but this is disabled by our patches in order to work on macOS,
so use the identical function directly instead.
Add fnmatch from gnulib with GNU extensions
which is needed for usage of the FNM_EXTMATCH flag.
Handle a "Wunused-const-variable" error with the same
preprocessor conditional used to include the function
that the variable is used in.
Ref: f64bd4b6c ("tools/elfutils: only build required components")
Tested-by: Georgi Valkov <gvalkov@gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15368
Signed-off-by: Robert Marko <robimarko@gmail.com>
The gnulib fts header is meant to not be overwritten
in any way by the host system's copy of fts.h
and was therefore given a unique name instead.
This is fine if the built libgnu library is directly linked
with the target library, but if we want to keep them isolated
we end up having the definitions being mangled anyway
when the next object to link against included the fts.h header.
On some macOS platforms, the use of __DARWIN_INODE64
is messing with the link name for fts functions, resulting in:
Undefined symbols for architecture x86_64:
"_rpl_fts_close$INODE64", referenced from:
...
Create a local fts header for gnulib
that completely blocks the macOS host fts header.
An alternative and more upstream friendly fix would be
to rename fts_.h to fts.h and add the macOS-only
include guard to that file within it's own include guard,
but that would be a massive patch, so do this for now.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/15368
Signed-off-by: Robert Marko <robimarko@gmail.com>
Refresh all tools patches now that tools/refresh correctly works.
CI now checks for them and actively complain if tools have unrefreshed
patches.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
[ reword commit message ]
Link: https://github.com/openwrt/openwrt/pull/15524
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
meson is used to build it since 291b137. No need to patch Makefiles.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/15524
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Now that Host/Prepare/Default is always defined, we can use that instead
of using raw commands to move files from the src directory to
HOST_BUILD_DIR.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Install files from HOST_BUILD_DIR instead of src. These files are now
correctly copied to HOST_BUILD_DIR and can be referenced from there.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
New:
- mold is now up to 10% faster when linking very large, debug
info-enabled executables such as Blender (~1.8 GiB) or Clang (~3.8
GiB), thanks to several improvements we've made to the string merging
algorithm. (53ebcd8, d714301, 40f6b17, c9faf3d)
- -z start-stop-visibility=hidden is now supported so that
linker-synthesized __start_<section-name> and __stop_<section-name>
symbols can be completely hidden from other ELF modules. Previously,
only -z start-stop-visibility=protected was supported. (99a5b15)
- -Bsymbolic-non-weak and -Bsymbolic-non-weak-functions options are now
supported for compatibility with LLVM lld. Just like lld, these options
control which symbols are exported as dynamic symbols.
-Bsymbolic-non-weak makes the linker to export only weak symbols,
whereas -Bsymbolic-non-weak-functions makes it to export only weak
function symbols. (7d17aa8)
Bug fixes and compatibility improvements:
- Previously, if a linker script contains a newline character in the
beginning four bytes of a file, it was not recognized as a linker
script by mold. Now, mold allows newlines at the beginning of a file.
(ea054cc)
- Under rare circumstances, the INPUT linker script command may have
found a different file than GNU ld would. Now, mold's behavior aligns
with GNU ld's. (163975d)
- Previously, the --repro option produced corrupted tar files. Now the
bug has been fixed. (32c4a09)
- mold generally guarantees that its output is reproducible, meaning that
if you run the linker with the exact same command line options and
input files, the output is guaranteed to be bit-for-bit identical to
the previous outputs. However, under rare circumstances, it might
produce different output due to a bug. It's reported that this
nondeterminism caused random crashes for some programs (#1247). This
bug has been fixed. (6463a7c)
- mold no longer sets the address of the .text section as the entry point
address if --entry option is not given, just like LLVM lld. (020b1a7)
- [RISC-V] __global_pointer$ symbol is now exported from executables as
required by the processor-specific ABI. (3df7c8e)
- [ARM32] --long-plt option is now recognized as known option by mold.
mold ignores the option, though, because the PLTs generated by our
linker is always long. (d432e98)
Release Notes:
https://github.com/rui314/mold/releases/tag/v2.31.0
Signed-off-by: Sean Khan <datapronix@protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/15403
Signed-off-by: Robert Marko <robimarko@gmail.com>
Some package might require to fix their pkg-config file to point to host
or hostpkg file. This is the case for glib2 library that provides with
pkg-config variables, tools to generates files from xml. Those tools
should use the host binary instead of the targets one to correctly build
packages that makes use of such tools.
Link: https://github.com/openwrt/openwrt/pull/15134
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
In the 0.191 update dirname was used instead of <libgen.h> to fix the
poisoned basename error:
/usr/include/libgen.h:35:9: error: attempt to use poisoned "basename"
35 | #define basename __xpg_basename
However, doing this has lead to libelf.a pulling in xmalloc, xstrdup and
friends and statically linking them thus leading to a symbol name conflict
with FRR host build and anything else that links against libelf and uses
xmalloc and friends.
Well, it turns out that upstream has added a helper[1] for basename so it
can compile with musl 1.2.5 which dropped the basename declaration, but it
also means that we must NOT include <libgen.h> and that poisoned error is
intentional and added to prevent duplicate basename definitions.
This also means that for macOS we dont need to do any additional header
inclusions as the new helper takes care of basename.
So, to fix the symbol conflict we can simply drop the <dirname.h> inclusion
and build from elfutils.
Tested on Fedora 40 as well as macOS 14.4.1.
[1] https://sourceware.org/git/?p=elfutils.git;a=commit;h=a2194f6b305bf0d0b9dd49dccd0a5c21994c8eeaFixes: #24030
Fixes: b6f025b424 ("tools/elfutils: update to 1.91")
Link: https://github.com/openwrt/openwrt/pull/15337
Signed-off-by: Robert Marko <robimarko@gmail.com>
Quilt refresh combined two sets of changes to the same file.
The switch from using libgen.h to dirname.h because of function poisoning
from gnulib's import of basename() was added as a new patch hunk instead
of an edit to the original one.
The original patch hunk was to fix build errors on an earlier version of
elfutils before the "dirname" module was being imported to fix further
build errors with the 0.191 version.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
A false tdestroy() function was added in order to make elfutils build on
macOS again. A previous commit added declarations for a real version of
tdestroy() into gnulib, which is already imported, as well as the
preprocessor flags and the triggers for the Makefile.am conditional in
order to include the source to be built.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
On macOS, stdlib.h in the standard include paths does not provide
reallocarray() while both elfutils and gnulib do, however they are
declared differently, leading to an error:
./system.h:101:1: error: static declaration of 'reallocarray' follows non-static declaration
reallocarray (void *ptr, size_t nmemb, size_t size)
A normal "configure && make" build cycle results in both declarations
being enabled as a result of both elfutils and gnulib having completely
separate configure checks where gnulib uses an internal placeholder symbol
HAVE_REALLOCARRAY, and elfutils uses a standard autoconf macro
HAVE_DECL_REALLOCARRAY.
Fix this by excluding the import of the reallocarray module which causes
gnulib checks in the configure stage to not even consider whether to
declare reallocarray later on, so the decision is only between the
standard include stdlib.h and the elfutils header.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Organize the Makefile lines involved in gnulib importing and its
workarounds. It improves readability and keeps git history organized.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Instead of editing the SUBDIRS variable with a patch, it can be overriden
at the end of the command line when invoking Make.
This tool has a series of recursive Makefiles in each subdirectory,
therefore SUBDIRS is set to a pattern of Make functions so that the result
is variable depending on the current subdirectory that Make is being
invoked in.
It's not necessary to have gnulib-cache.m4 in EXTRA_DIST since we don't
need to re-import after packaging this in the SDK, so get rid of the
entire patch hunk for ./Makefile.am
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Release Notes:
https://sourceware.org/pipermail/elfutils-devel/2024q1/006876.html
Manually refresh:
- 100-portability.patch
Change:
- replace libgen.h with gnulib "dirname" module for compilation errors:
In file included from ./../libdw/libdwP.h:38,
from eblobjnote.c:42:
/usr/include/libgen.h:35:9: error: attempt to use poisoned "basename"
35 | #define basename __xpg_basename
| ^
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Co-Developed-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Update to latest stable release.
The following commits in gnulib caused a conflict in locally bootstrapped
coreutils with stable gnulib:
8f4b4e52c991de2233b471f8e35a068866b31f01
2749234203959df8d72cd8638d4e00a9fff450db
A module (strftime) was marked deprecated and replaced by another module
(nstrftime) in the version of gnulib that coreutils was released with
compared to the stable branch that we use for importing. Conflicts from
the previous version of coreutils are now gone, so other imported headers
are now good.
Refresh patch:
- 000-bootstrap.patch
Remove upstreamed patch:
- 001-bootstrap-sync.patch
Link: https://lists.gnu.org/archive/html/coreutils/2024-03/msg00132.html
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Update to latest stable release.
Add configure option to disable support for the Year 2038 problem.
(for now, as some versions of GCC do not yet support it)
Syncing bootstrap script fails, backport an upstream patch which can be
removed at next coreutils update.
Several headers from the stable gnulib branch cause build failure because
the changes in the imported versions are incompatible with the Makefile
that gets generated for coreutils. This version of coreutils was released
after being bootstrapped and autoreconf'ed with a significantly different
version of gnulib compared to our local gnulib, so skip importing them
(and restore the backup).
While at it, organize restoring the originally shipped version of files
into a Make foreach function.
Refresh patch:
- 000-bootstrap.patch
New patch:
- 001-bootstrap-sync.patch
Link: https://lists.gnu.org/archive/html/coreutils/2023-08/msg00099.html
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Force bison to ignore the M4 environment variable and hardcode it to the
locally built m4 during build operations using the relocatable path
variable STAGING_DIR_HOST.
This allows bison to continue to function while we are forcefully avoiding
autoreconf and other autoconf and automake-like operations by giving a
fake path to m4 with the M4 environment variable.
The specific path can still be overridden independently from the
environment within the line of invocation that runs bison by setting
STAGING_DIR_HOST within the command, so document this in the help printout.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
The tdestroy() function, which is a GNU extension to the standard C
library, is defined in gnulib in tsearch.c but is missing it's
corresponding declaration in search.in.h by being completely missing...
This patch is large but upstreamable, including all of the macros and
conditionals and configure checks that upstream GNU would expect for
portable support, like using the @@ placeholder/substitution method to
determine whether or not to have declarations based on whether or not
tdestroy() is already declared within the standard headers of the default
include paths.
There were also some typedefs and aliases missing, along with the warnings
and preprocessor exceptions that need to be added for consistency with the
usage of the rest of the functions in the files.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
For modules that depend on the reallocarray module, like ialloc, xalloc,
and safe-alloc, it was not possible to skip importing the reallocarray
module as they all contained at least one function that called
reallocarray() and would cause build failure if the host system didn't
declare it.
This upstreamable patch adds macros that toggle whether to define
functions that depend on reallocarray() based on whether the reallocarray
module is being imported.
Tested-by: Georgi Valkov <gvalkov@gmail.com> # MacOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
There are other wrapper scripts released with makeinfo like texi2pdf which
are required by the build prerequisites of some tools, and have a similar
purpose and usage.
Let the makeinfo perl script handle all of these cases.
It's worth mentioning that "texi2any" is the actual program and "makeinfo"
is one of it's aliases. From upstream GNU:
makeinfo: texi2any
rm -f $@
-$(LN_S) texi2any $@
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Currently, trying to compile LLVM-BPF will fail with:
[2225/3517] Linking CXX shared library lib/libLLVM-15.so
FAILED: lib/libLLVM-15.so
/usr/bin/ld: staging_dir/host/lib/libzstd.a(zstd_common.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
So, to fix it enable PIC for the host ZSTD.
Fixes: #15247
Signed-off-by: Bryan Roessler <bryanroessler@gmail.com>
Proposed fixup has been replaced and merged with an advanced version.
install-pc-mt has been dropped and replaced for intall-pc MT=1 to
generate a .pc file with multithread libs.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Trying to compile with new new enough GCC but older binutils that dont
support AVX-VNNI will error out on the assembler, so backport an upstream
fix for it.
Fixes: 338b463e1e ("tools: libdeflate: update to 1.20")
Signed-off-by: Robert Marko <robimarko@gmail.com>
Changes:
* Improved CRC-32 performance on recent x86 CPUs by adding
VPCLMULQDQ-accelerated implementations using 256-bit and 512-bit vectors.
* Improved Adler-32 performance on recent x86 CPUs by adding
VNNI-accelerated implementations using 256-bit and 512-bit vectors.
* Improved CRC-32 and Adler-32 performance on short inputs.
* Optimized the portable implementation of Adler-32.
* Added some basic optimizations for RISC-V.
* Dropped support for gcc versions older than v4.9 (released in 2014) and
clang versions older than v3.9 (released in 2016).
* Dropped support for CRC-32 acceleration on 32-bit ARM using the ARMv8 pmull or crc32 instructions.
This code only worked on CPUs that also have a 64-bit mode, and it was
already disabled on many compiler versions due to compiler limitations.
CRC-32 acceleration remains fully supported on 64-bit ARM.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Now that instead of relying on env variables for the GH download script
invoking ZSTD tarball compression it passes the full arguments via tar -I
we can drop the CLI max compression level override.
Signed-off-by: Robert Marko <robimarko@gmail.com>
The current .pc generated by make build system for zstd is wrong and
always assume a single-threaded library is used.
This wasn't the case for the meson build system that used his own logic
to generate the pkg-config file.
Add a patch to fix this by introducing install-mt-pc make target to
generate the correct pkg-config gile.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This reverts commit 8d934c1196.
The update seems to be causing issues that need to be further
explored [0]. Let's revert it.
[0] - https://github.com/openwrt/openwrt/pull/15078
Signed-off-by: Nick Hainke <vincent@systemli.org>
We forgot to make sure install-includes is called for the libzstd in
order for it to install the required headers.
Fixes: 4b920e799f ("tools: zstd: convert to make and drop meson dependency")
Signed-off-by: Robert Marko <robimarko@gmail.com>
When using zst instead of xz, the hash changes. This commit fixes the
hash for packages and tools in core.
Signed-off-by: Paul Spooren <mail@aparcar.org>
In the light of recent XZ events, and fundamental XZ issues lets work on
moving away from using XZ.
So, use gz compressed tarballs as sources whenever possible.
dwarves only offers bz2 compressed tarballs, so use those as size
difference is minor compared to XZ.
Signed-off-by: Robert Marko <robimarko@gmail.com>
dwarves
libdeflate is currently intentionally being fetched via GIT.
However, with the move to using ZSTD to compress the cloned GIT repo
tarballs it means that we would first need to compile ZSTD.
But that means that we need to be able to unpack gzipped tarballs first
which we currently do by using libdeflate-gzip.
So, in order to do so lets fetch libdeflate as a tarball, use gzip to
extract it and then use libdeflate as regular for all other tools.
Signed-off-by: Robert Marko <robimarko@gmail.com>
ZSTD and libdeflate do not depend on SED nor flock, so instead of the whole
for loop that will filter 2 out of 4 core packages just specify that patch
and tar depend on sed explicitly.
ZSTD now depends on libdeflate since libdeflate-gzip will then be used to
unpack ZSTD as well as most tool archives.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
We dont really have a reason to deviate from the upstream default for
ZSTD_LEGACY_SUPPORT value of 5, as it will save a bit of space but
prevent decompressing data compressed with legacy ZSTD versions.
Signed-off-by: Robert Marko <robimarko@gmail.com>
ZTSD limits the safe compression level to a max of 19 as 20 to 22 cause
increased RAM usage. Higher levels require --ultra arg passed.
There isn't currently a way to set --ultra using ENV options similar to
ZSTD_CLEVEL and ZSTD_CLEVEL is limited to 19.
To fix this, we can increase the max safe compression level by providing
a custom ZSTDCLI_CLEVEL_MAX value with CFLAGS.
The max safe level is increased to 20.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Convert to make and drop meson dependency since it's not a core tools
and can't depend on advanced build system like cmake or meson.
On top of this make is the official build support and cmake/meson are
supported by 3rd parties.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
GCC14 no longer treats integer types and pointer types as equivalent in
assignments (including implied assignments of function arguments and return
values), and instead fails the compilation with a type error.
So, as a workaround lets disable the newly introduced error
-Werror=int-conversion and just make it print a warning to enable compiling
with GCC14 as Fedora 40 now defaults to it.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add the new 'zycast' tool for remote flashing of Zyxel devices, support
for factory image generation for two new TP-Link devices, and improved
compatibility with two other devices.
17de36575f1e zycast: disable build on non-Linux OS
a5dfb5fb5e6e tplink-safeloader: add TP-Link RE205 v3 support
c1e06daf4622 tplink-safeloader: bump EAP225-V3 compat_level
335d063cff23 tplink-safeloader: bump EAP225-Outdoor v1 compat
c1e69e6f9c0d tplink-safeloader: show compat_level with FW info
e87f23849790 zycast: new tool for ZyXEL bootloader flashing
9067281d17da tplink-safeloader: add RE365 v1
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Different from OPKG, APK uses a deterministic version schema which chips
the version into chunks and compares them individually. This enforces a
certain schema which was previously entirely flexible.
- Releases are added at the very and end prefixed with an `r` like
`1.2.3-r3`.
- Hashes are prefixed with a `~` like `1.2.3~abc123`.
- Dates become semantic versions, like `2024.04.01`
- Extra tags are possible like `_git`, `_alpha` and more.
For full details see the APK test list:
https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/test/version.data
Signed-off-by: Paul Spooren <mail@aparcar.org>
since kernel 6.4, commit bca2f3a9406b ("efi/zboot: Add BSS padding
before compression") introduces the use of hexdump to padding the
EFI kernel binary before compression.
util-linux which containing hexdump should then be compiled as a host
tool to guarantee not breaking the kernel build process.
Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Disable compilation of separate tests as it causes
a build error when combined with ccache
Fixes: 4a3f430d72 ("tools/expat: update to 2.6.0")
Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>