Complete Yocto mirror with license table for TQMa6UL (2038-compliance)

- 264 license table entries with exact download URLs (224/264 resolved)
- Complete sources/ directory with all BitBake recipes
- Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl)
- Full traceability for Softwarefreigabeantrag
- GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4
- License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
Siggi (OpenClaw Agent)
2026-03-01 20:58:18 +00:00
commit 16accb6b24
15086 changed files with 1292356 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
From 9023589317843df4e57f8ebef1d9a8398ddb929d Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 28 May 2020 15:34:05 +0000
Subject: [PATCH] CMakeLists.txt: avoid changing install paths based on host
distro
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cd4f8e..4759812 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,9 +21,9 @@ set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "-lgcov")
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "-lgcov")
# Work around bug in GNUInstallDirs
-if (EXISTS "/etc/debian_version")
- set(CMAKE_INSTALL_LIBEXECDIR "lib")
-endif()
+#if (EXISTS "/etc/debian_version")
+set(CMAKE_INSTALL_LIBEXECDIR "lib")
+#endif()
# Include stuff
include(Misc)

View File

@@ -0,0 +1,27 @@
From f629d1c3fcfb560ed24efc3e73d4e4999b1eab33 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 10 May 2019 14:16:47 +0200
Subject: [PATCH] Disable documentation directory altogether
Even when WITH_DOC=False, the build requires po4a to generate manpages.
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 668e2d762..62f441bfa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -246,7 +246,7 @@ add_subdirectory(apt-private)
endif()
add_subdirectory(cmdline)
add_subdirectory(completions)
-add_subdirectory(doc)
+#add_subdirectory(doc)
add_subdirectory(dselect)
add_subdirectory(ftparchive)
add_subdirectory(methods)

View File

@@ -0,0 +1,29 @@
From b84280fec4e1d0d33eca78e76556023f8f8fe5b7 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 10 May 2019 16:47:38 +0200
Subject: [PATCH] Do not init tables from dpkg configuration
This would require sysroot relocation logic, and it's easier to just disable them.
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
apt-pkg/init.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index b9d9b15d2..1725c5966 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -281,8 +281,8 @@ bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys)
return _error->Error(_("Unable to determine a suitable packaging system type"));
}
- if (pkgInitArchTupleMap() == false)
- return false;
+// if (pkgInitArchTupleMap() == false)
+// return false;
return Sys->Initialize(Cnf);
}

View File

@@ -0,0 +1,28 @@
From 6b8547161b902b01b639d05a4cdf849d7694556f Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 22 May 2020 15:29:23 +0000
Subject: [PATCH] apt-pkg/contrib/srvrec.h: Explicitly include sys/types.h
This avoids type errors with musl C library.
Upstream-Status: Submitted [https://salsa.debian.org/apt-team/apt/-/merge_requests/200]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
apt-pkg/contrib/srvrec.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/apt-pkg/contrib/srvrec.h b/apt-pkg/contrib/srvrec.h
index e5d0f43..2010184 100644
--- a/apt-pkg/contrib/srvrec.h
+++ b/apt-pkg/contrib/srvrec.h
@@ -9,6 +9,7 @@
#ifndef SRVREC_H
#define SRVREC_H
+#include <sys/types.h>
#include <string>
#include <vector>
#include <arpa/nameser.h>
--
2.20.1

View File

@@ -0,0 +1,48 @@
From e849b161ce1d87ab369b921438abcf5b3a03e186 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 25 Apr 2021 08:57:03 -0700
Subject: [PATCH] Hide fstatat64 and prlimit64 defines on musl
musl defines fstatat64 and prlimit64 as macros which confuses the
seccomp sysall rewiring since there are syscalls with same names
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
methods/aptmethod.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index bd50e80..3085aed 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -121,6 +121,12 @@ protected:
if (ctx == NULL)
return _error->FatalE("HttpMethod::Configuration", "Cannot init seccomp");
+#ifndef __GLIBC__
+#pragma push_macro("fstatat64")
+#pragma push_macro("prlimit64")
+#undef fstatat64
+#undef prlimit64
+#endif
#define ALLOW(what) \
if ((rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(what), 0))) \
return _error->FatalE("HttpMethod::Configuration", "Cannot allow %s: %s", #what, strerror(-rc));
@@ -320,9 +326,11 @@ protected:
if ((rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, seccomp_syscall_resolve_name(custom.c_str()), 0)))
return _error->FatalE("aptMethod::Configuration", "Cannot allow %s: %s", custom.c_str(), strerror(-rc));
}
-
#undef ALLOW
-
+#ifndef __GLIBC__
+#pragma pop_macro("fstatat64")
+#pragma pop_macro("prlimit64")
+#endif
rc = seccomp_load(ctx);
if (rc == -EINVAL)
{
--
2.31.1

View File

@@ -0,0 +1,87 @@
From e91fb0618ce0a5d42f239d0fca602544858f0819 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 16 Aug 2022 08:44:18 -0700
Subject: [PATCH] Remove using std::binary_function
std::binary_function and std::unary_function are deprecated since c++11
and removed in c++17, therefore remove it and use lambda functions to get same
functionality implemented.
Upstream-Status: Submitted [https://salsa.debian.org/apt-team/apt/-/merge_requests/253]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ftparchive/apt-ftparchive.cc | 33 ++++++++++-----------------------
1 file changed, 10 insertions(+), 23 deletions(-)
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index 0f6587281..0a253b12b 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -48,6 +48,11 @@
using namespace std;
unsigned Quiet = 0;
+auto ContentsCompare = [](const auto &a, const auto &b) { return a.ContentsMTime < b.ContentsMTime; };
+auto DBCompare = [](const auto &a, const auto &b) { return a.BinCacheDB < b.BinCacheDB; };
+auto SrcDBCompare = [](const auto &a, const auto &b) { return a.SrcCacheDB < b.SrcCacheDB; };
+
+
static struct timeval GetTimevalFromSteadyClock() /*{{{*/
{
auto const Time = std::chrono::steady_clock::now().time_since_epoch();
@@ -116,24 +121,6 @@ struct PackageMap
bool SrcDone;
time_t ContentsMTime;
- struct ContentsCompare
- {
- inline bool operator() (const PackageMap &x,const PackageMap &y)
- {return x.ContentsMTime < y.ContentsMTime;};
- };
-
- struct DBCompare
- {
- inline bool operator() (const PackageMap &x,const PackageMap &y)
- {return x.BinCacheDB < y.BinCacheDB;};
- };
-
- struct SrcDBCompare
- {
- inline bool operator() (const PackageMap &x,const PackageMap &y)
- {return x.SrcCacheDB < y.SrcCacheDB;};
- };
-
void GetGeneral(Configuration &Setup,Configuration &Block);
bool GenPackages(Configuration &Setup,struct CacheDB::Stats &Stats);
bool GenSources(Configuration &Setup,struct CacheDB::Stats &Stats);
@@ -869,7 +856,7 @@ static bool DoGenerateContents(Configuration &Setup,
else
I->ContentsMTime = A.st_mtime;
}
- stable_sort(PkgList.begin(),PkgList.end(),PackageMap::ContentsCompare());
+ stable_sort(PkgList.begin(),PkgList.end(),ContentsCompare);
/* Now for Contents.. The process here is to do a make-like dependency
check. Each contents file is verified to be newer than the package files
@@ -941,8 +928,8 @@ static bool Generate(CommandLine &CmdL)
LoadBinDir(PkgList,Setup);
// Sort by cache DB to improve IO locality.
- stable_sort(PkgList.begin(),PkgList.end(),PackageMap::DBCompare());
- stable_sort(PkgList.begin(),PkgList.end(),PackageMap::SrcDBCompare());
+ stable_sort(PkgList.begin(),PkgList.end(),DBCompare);
+ stable_sort(PkgList.begin(),PkgList.end(),SrcDBCompare);
// Generate packages
if (_config->FindB("APT::FTPArchive::ContentsOnly", false) == false)
@@ -993,8 +980,8 @@ static bool Clean(CommandLine &CmdL)
LoadBinDir(PkgList,Setup);
// Sort by cache DB to improve IO locality.
- stable_sort(PkgList.begin(),PkgList.end(),PackageMap::DBCompare());
- stable_sort(PkgList.begin(),PkgList.end(),PackageMap::SrcDBCompare());
+ stable_sort(PkgList.begin(),PkgList.end(),DBCompare);
+ stable_sort(PkgList.begin(),PkgList.end(),SrcDBCompare);
string CacheDir = Setup.FindDir("Dir::CacheDir");

View File

@@ -0,0 +1,48 @@
From a2dd661484536492b47d4c88998f2bf516749bc8 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 21 May 2020 20:13:25 +0000
Subject: [PATCH] Revert "always run 'dpkg --configure -a' at the end of our
dpkg callings"
This reverts commit a2a75ff4516f7609f4c55b42270abb8d08943c60, which
always run 'dpkg --configure -a' at the end of our dpkg callings,
but it does not work for cross-compile, since the rootfs dir can not
be passed into dpkg, and lead to the below similar error:
-------
|mkdir: cannot create directory '/usr/lib/opkg': Permission denied
-------
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
apt-pkg/deb/dpkgpm.cc | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 93effa959..4375781d1 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1199,12 +1199,6 @@ void pkgDPkgPM::BuildPackagesProgressMap()
}
}
}
- /* one extra: We don't want the progress bar to reach 100%, especially not
- if we call dpkg --configure --pending and process a bunch of triggers
- while showing 100%. Also, spindown takes a while, so never reaching 100%
- is way more correct than reaching 100% while still doing stuff even if
- doing it this way is slightly bending the rules */
- ++PackagesTotal;
}
/*}}}*/
void pkgDPkgPM::StartPtyMagic() /*{{{*/
@@ -1741,7 +1735,8 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
// support subpressing of triggers processing for special
// cases like d-i that runs the triggers handling manually
- if (_config->FindB("DPkg::ConfigurePending", true))
+ bool const SmartConf = (_config->Find("PackageManager::Configure", "all") != "all");
+ if (0)
List.emplace_back(Item::ConfigurePending, pkgCache::PkgIterator());
}
bool const TriggersPending = _config->FindB("DPkg::TriggersPending", false);

View File

@@ -0,0 +1,30 @@
From 5985f366750a73c81c7d86893a2b959b4af062a5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 26 May 2021 22:12:46 -0700
Subject: [PATCH] aptwebserver.cc: Include <array>
This helps getting std::array definition
Fixes
test/interactive-helper/aptwebserver.cc:36:55: error: constexpr variable cannot have non-literal type 'const std::array<std::array<const char *, 2>, 6>'
constexpr std::array<std::array<char const *,2>,6> htmlencode = {{
Upstream-Status: Submitted [https://github.com/Debian/apt/pull/133]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
test/interactive-helper/aptwebserver.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index f4f8d95..361c7a9 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -23,6 +23,7 @@
#include <array>
#include <algorithm>
+#include <array>
#include <fstream>
#include <iostream>
#include <list>

View File

@@ -0,0 +1,36 @@
From 33347f9f8301633b01af4e208b7be5fdfcb0df0c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 20 Mar 2021 14:45:18 -0700
Subject: [PATCH] cmake: Do not build po files
Fixes
| CMake Error at CMakeLists.txt:252 (add_dependencies):
| The dependency target "update-po4a" of target "update-po" does not exist.
|
Upstream-Status: Inappropriate [Cross-compile specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
CMakeLists.txt | 7 -------
1 file changed, 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be157a55f..54163ae6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -252,15 +252,6 @@ add_subdirectory(ftparchive)
add_subdirectory(methods)
add_subdirectory(test)
-if (USE_NLS)
-add_subdirectory(po)
-endif()
-
-if(TARGET update-po AND TARGET update-po4a)
-# Link update-po4a into the update-po target
-add_dependencies(update-po update-po4a)
-endif()
-
# Create our directories.
install_empty_directories(
${CONF_DIR}/apt.conf.d

View File

@@ -0,0 +1,728 @@
#!/usr/bin/perl -w
#
# Copyright (C) 2016 Julian Andres Klode <jak@jak-linux.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
=encoding utf8
=head1 NAME
triehash - Generate a perfect hash function derived from a trie.
=cut
use strict;
use warnings;
use utf8;
use Getopt::Long;
=head1 SYNOPSIS
B<triehash> [S<I<option>>] [S<I<input file>>]
=head1 DESCRIPTION
triehash takes a list of words in input file and generates a function and
an enumeration to describe the word
=head1 INPUT FILE FORMAT
The file consists of multiple lines of the form:
[label ~ ] word [= value]
This maps word to value, and generates an enumeration with entries of the form:
label = value
If I<label> is undefined, the word will be used, the minus character will be
replaced by an underscore. If value is undefined it is counted upwards from
the last value.
There may also be one line of the format
[ label ~] = value
Which defines the value to be used for non-existing keys. Note that this also
changes default value for other keys, as for normal entries. So if you place
= 0
at the beginning of the file, unknown strings map to 0, and the other strings
map to values starting with 1. If label is not specified, the default is
I<Unknown>.
=head1 OPTIONS
=over 4
=item B<-C>I<.c file> B<--code>=I<.c file>
Generate code in the given file.
=item B<-H>I<header file> B<--header>=I<header file>
Generate a header in the given file, containing a declaration of the hash
function and an enumeration.
=item B<--enum-name=>I<word>
The name of the enumeration.
=item B<--function-name=>I<word>
The name of the function.
=item B<--label-prefix=>I<word>
The prefix to use for labels.
=item B<--label-uppercase>
Uppercase label names when normalizing them.
=item B<--namespace=>I<name>
Put the function and enum into a namespace (C++)
=item B<--class=>I<name>
Put the function and enum into a class (C++)
=item B<--enum-class>
Generate an enum class instead of an enum (C++)
=item B<--counter-name=>I<name>
Use I<name> for a counter that is set to the latest entry in the enumeration
+ 1. This can be useful for defining array sizes.
=item B<--ignore-case>
Ignore case for words.
=item B<--multi-byte>=I<value>
Generate code reading multiple bytes at once. The value is a string of power
of twos to enable. The default value is 320 meaning that 8, 4, and single byte
reads are enabled. Specify 0 to disable multi-byte completely, or add 2 if you
also want to allow 2-byte reads. 2-byte reads are disabled by default because
they negatively affect performance on older Intel architectures.
This generates code for both multiple bytes and single byte reads, but only
enables the multiple byte reads of GNU C compatible compilers, as the following
extensions are used:
=over 8
=item Byte-aligned integers
We must be able to generate integers that are aligned to a single byte using:
typedef uint64_t __attribute__((aligned (1))) triehash_uu64;
=item Byte-order
The macros __BYTE_ORDER__ and __ORDER_LITTLE_ENDIAN__ must be defined.
=back
We forcefully disable multi-byte reads on platforms where the variable
I<__ARM_ARCH> is defined and I<__ARM_FEATURE_UNALIGNED> is not defined,
as there is a measurable overhead from emulating the unaligned reads on
ARM.
=item B<--language=>I<language>
Generate a file in the specified language. Currently known are 'C' and 'tree',
the latter generating a tree.
=item B<--include=>I<header>
Add the header to the include statements of the header file. The value must
be surrounded by quotes or angle brackets for C code. May be specified multiple
times.
=back
=cut
my $unknown = -1;
my $unknown_label = undef;
my $counter_start = 0;
my $enum_name = 'PerfectKey';
my $function_name = 'PerfectHash';
my $enum_class = 0;
my $code_name = '-';
my $header_name = '-';
my $code;
my $header;
my $label_prefix = undef;
my $label_uppercase = 0;
my $ignore_case = 0;
my $multi_byte = '320';
my $language = 'C';
my $counter_name = undef;
my @includes = ();
Getopt::Long::config('default',
'bundling',
'no_getopt_compat',
'no_auto_abbrev',
'permute',
'auto_help');
GetOptions ('code|C=s' => \$code_name,
'header|H=s' => \$header_name,
'function-name=s' => \$function_name,
'label-prefix=s' => \$label_prefix,
'label-uppercase' => \$label_uppercase,
'ignore-case' => \$ignore_case,
'enum-name=s' => \$enum_name,
'language|l=s' => \$language,
'multi-byte=s' => \$multi_byte,
'enum-class' => \$enum_class,
'include=s' => \@includes,
'counter-name=s' => \$counter_name)
or die('Could not parse options!');
# This implements a simple trie. Each node has three attributes:
#
# children - A hash of keys to other nodes
# value - The value to be stored here
# label - A named representation of the value.
#
# The key at each level of the trie can consist of one or more bytes, and the
# trie can be normalized to a form where all keys at a level have the same
# length using rebuild_tree().
package Trie {
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
$self->{children} = {};
$self->{value} = undef;
$self->{label} = undef;
return $self;
}
# Return the largest power of 2 smaller or equal to the argument
sub alignpower2 {
my ($self, $length) = @_;
return 8 if ($length >= 8 && $multi_byte =~ /3/);
return 4 if ($length >= 4 && $multi_byte =~ /2/);
return 2 if ($length >= 2 && $multi_byte =~ /1/);
return 1;
}
# Split the key into a head block and a tail
sub split_key {
my ($self, $key) = @_;
my $length = length $key;
my $split = $self->alignpower2($length);
return (substr($key, 0, $split), substr($key, $split));
}
# Given a key, a label, and a value, insert that into the tree, possibly
# replacing an existing node.
sub insert {
my ($self, $key, $label, $value) = @_;
if (length($key) == 0) {
$self->{label} = $label;
$self->{value} = $value;
return;
}
my ($child, $tail) = $self->split_key($key);
$self->{children}{$child} = Trie->new if (!defined($self->{children}{$child}));
$self->{children}{$child}->insert($tail, $label, $value);
}
# Construct a new trie that only contains words of a given length. This
# is used to split up the common trie after knowing all words, so we can
# switch on the expected word length first, and have the per-trie function
# implement simple longest prefix matching.
sub filter_depth {
my ($self, $togo) = @_;
my $new = Trie->new;
if ($togo != 0) {
my $found = 0;
foreach my $key (sort keys %{$self->{children}}) {
if ($togo > length($key) || defined $self->{children}{$key}->{value}) {
my $child = $self->{children}{$key}->filter_depth($togo - length($key));
$new->{children}{$key}= $child if defined $child;
$found = 1 if defined $child;
}
}
return if (!$found);
} else {
$new->{value} = $self->{value};
$new->{label} = $self->{label};
}
return $new;
}
# (helper for rebuild_tree)
# Reinsert all value nodes into the specified $trie, prepending $prefix
# to their $paths.
sub reinsert_value_nodes_into {
my ($self, $trie, $prefix) = @_;
$trie->insert($prefix, $self->{label}, $self->{value}) if (defined $self->{value});
foreach my $key (sort keys %{$self->{children}}) {
$self->{children}{$key}->reinsert_value_nodes_into($trie, $prefix . $key);
}
}
# (helper for rebuild_tree)
# Find the earliest point to split a key. Normally, we split at the maximum
# power of 2 that is greater or equal than the length of the key. When we
# are building an ASCII-optimised case-insensitive trie that simply ORs
# each byte with 0x20, we need to split at the first ambiguous character:
#
# For example, the words a-bc and a\rbc are identical in such a situation:
# '-' | 0x20 == '-' == '\r' | 0x20
# We cannot simply switch on all 4 bytes at once, but need to split before
# the ambiguous character so we can process the ambiguous character on its
# own.
sub find_earlier_split {
my ($self, $key) = @_;
if ($ignore_case) {
for my $i (0..length($key)-1) {
# If the key starts with an ambiguous character, we need to
# take only it. Otherwise, we need to take everything
# before the character.
return $self->alignpower2($i || 1) if (main::ambiguous(substr($key, $i, 1)));
}
}
return $self->alignpower2(length $key);
}
# This rebuilds the trie, splitting each key before ambiguous characters
# as explained in find_earlier_split(), and then chooses the smallest
# such split at each level, so that all keys at all levels have the same
# length (so we can use a multi-byte switch).
sub rebuild_tree {
my $self = shift;
# Determine if/where we need to split before an ambiguous character
my $new_split = 99999999999999999;
foreach my $key (sort keys %{$self->{children}}) {
my $special_length = $self->find_earlier_split($key);
$new_split = $special_length if ($special_length < $new_split);
}
# Start building a new uniform trie
my $newself = Trie->new;
$newself->{label} = $self->{label};
$newself->{value} = $self->{value};
$newself->{children} = {};
foreach my $key (sort keys %{$self->{children}}) {
my $head = substr($key, 0, $new_split);
my $tail = substr($key, $new_split);
# Rebuild the child node at $head, pushing $tail downwards
$newself->{children}{$head} //= Trie->new;
$self->{children}{$key}->reinsert_value_nodes_into($newself->{children}{$head}, $tail);
# We took up to one special character of each key label. There might
# be more, so we need to rebuild recursively.
$newself->{children}{$head} = $newself->{children}{$head}->rebuild_tree();
}
return $newself;
}
}
# Code generator for C and C++
package CCodeGen {
my $static = ($code_name eq $header_name) ? "static " : "";
my $enum_specifier = $enum_class ? "enum class" : "enum";
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
return $self;
}
sub open_output {
my $self = shift;
if ($code_name ne '-') {
open($code, '>', $code_name) or die "Cannot open $code_name: $!" ;
} else {
$code = *STDOUT;
}
if($code_name eq $header_name) {
$header = $code;
} elsif ($header_name ne '-') {
open($header, '>', $header_name) or die "Cannot open $header_name: $!" ;
} else {
$header = *STDOUT;
}
}
sub mangle_label {
my ($self, $label) = @_;
$label = $label_prefix . $label if defined($label_prefix);
$label = uc $label if $label_uppercase;
return $label;
}
sub word_to_label {
my ($self, $word) = @_;
$word =~ s/_/__/g;
$word =~ s/-/_/g;
return $self->mangle_label($word);
}
# Return a case label, by shifting and or-ing bytes in the word
sub case_label {
my ($self, $key) = @_;
return sprintf("'%s'", substr($key, 0, 1)) if not $multi_byte;
my $output = '0';
for my $i (0..length($key)-1) {
$output .= sprintf("| onechar('%s', %d, %d)", substr($key, $i, 1), 8 * $i, 8*length($key));
}
return $output;
}
# Return an appropriate read instruction for $length bytes from $offset
sub switch_key {
my ($self, $offset, $length) = @_;
return "string[$offset]" if $length == 1;
return sprintf("*((triehash_uu%s*) &string[$offset])", $length * 8);
}
# Render the trie so that it matches the longest prefix.
sub print_table {
my ($self, $trie, $fh, $indent, $index) = @_;
$indent //= 0;
$index //= 0;
# If we have children, try to match them.
if (%{$trie->{children}}) {
# The difference between lowercase and uppercase alphabetical characters
# is that they have one bit flipped. If we have alphabetical characters
# in the search space, and the entire search space works fine if we
# always turn on the flip, just OR the character we are switching over
# with the bit.
my $want_use_bit = 0;
my $can_use_bit = 1;
my $key_length = 0;
foreach my $key (sort keys %{$trie->{children}}) {
$can_use_bit &= not main::ambiguous($key);
$want_use_bit |= ($key =~ /^[a-zA-Z]+$/);
$key_length = length($key);
}
if ($ignore_case && $can_use_bit && $want_use_bit) {
printf { $fh } ((' ' x $indent) . "switch(%s | 0x%s) {\n", $self->switch_key($index, $key_length), '20' x $key_length);
} else {
printf { $fh } ((' ' x $indent) . "switch(%s) {\n", $self->switch_key($index, $key_length));
}
my $notfirst = 0;
foreach my $key (sort keys %{$trie->{children}}) {
if ($notfirst) {
printf { $fh } (' ' x $indent . " break;\n");
}
if ($ignore_case) {
printf { $fh } (' ' x $indent . "case %s:\n", $self->case_label(lc($key)));
printf { $fh } (' ' x $indent . "case %s:\n", $self->case_label(uc($key))) if lc($key) ne uc($key) && !($can_use_bit && $want_use_bit);
} else {
printf { $fh } (' ' x $indent . "case %s:\n", $self->case_label($key));
}
$self->print_table($trie->{children}{$key}, $fh, $indent + 1, $index + length($key));
$notfirst=1;
}
printf { $fh } (' ' x $indent . "}\n");
}
# This node has a value, so it is a possible end point. If no children
# matched, we have found our longest prefix.
if (defined $trie->{value}) {
printf { $fh } (' ' x $indent . "return %s;\n", ($enum_class ? "${enum_name}::" : '').$trie->{label});
}
}
sub print_words {
my ($self, $trie, $fh, $indent, $sofar) = @_;
$indent //= 0;
$sofar //= '';
printf { $fh } (' ' x $indent."%s = %s,\n", $trie->{label}, $trie->{value}) if defined $trie->{value};
foreach my $key (sort keys %{$trie->{children}}) {
$self->print_words($trie->{children}{$key}, $fh, $indent, $sofar . $key);
}
}
sub print_functions {
my ($self, $trie, %lengths) = @_;
foreach my $local_length (sort { $a <=> $b } (keys %lengths)) {
print { $code } ("static enum ${enum_name} ${function_name}${local_length}(const char *string)\n");
print { $code } ("{\n");
$self->print_table($trie->filter_depth($local_length)->rebuild_tree(), $code, 1);
printf { $code } (" return %s$unknown_label;\n", ($enum_class ? "${enum_name}::" : ''));
print { $code } ("}\n");
}
}
sub main {
my ($self, $trie, $num_values, %lengths) = @_;
print { $header } ("#ifndef TRIE_HASH_${function_name}\n");
print { $header } ("#define TRIE_HASH_${function_name}\n");
print { $header } ("#include <stddef.h>\n");
print { $header } ("#include <stdint.h>\n");
foreach my $include (@includes) {
print { $header } ("#include $include\n");
}
printf { $header } ("enum { $counter_name = $num_values };\n") if (defined($counter_name));
print { $header } ("${enum_specifier} ${enum_name} {\n");
$self->print_words($trie, $header, 1);
printf { $header } (" $unknown_label = $unknown,\n");
print { $header } ("};\n");
print { $header } ("${static}enum ${enum_name} ${function_name}(const char *string, size_t length);\n");
print { $code } ("#include \"$header_name\"\n") if ($header_name ne $code_name);
if ($multi_byte) {
print { $code } ("#ifdef __GNUC__\n");
foreach my $i ((16, 32, 64)) {
print { $code } ("typedef uint${i}_t __attribute__((aligned (1))) triehash_uu${i};\n");
print { $code } ("typedef char static_assert${i}[__alignof__(triehash_uu${i}) == 1 ? 1 : -1];\n");
}
print { $code } ("#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__\n");
print { $code } ("#define onechar(c, s, l) (((uint64_t)(c)) << (s))\n");
print { $code } ("#else\n");
print { $code } ("#define onechar(c, s, l) (((uint64_t)(c)) << (l-8-s))\n");
print { $code } ("#endif\n");
print { $code } ("#if (!defined(__ARM_ARCH) || defined(__ARM_FEATURE_UNALIGNED)) && !defined(TRIE_HASH_NO_MULTI_BYTE)\n");
print { $code } ("#define TRIE_HASH_MULTI_BYTE\n");
print { $code } ("#endif\n");
print { $code } ("#endif /*GNUC */\n");
print { $code } ("#ifdef TRIE_HASH_MULTI_BYTE\n");
$self->print_functions($trie, %lengths);
$multi_byte = 0;
print { $code } ("#else\n");
$self->print_functions($trie, %lengths);
print { $code } ("#endif /* TRIE_HASH_MULTI_BYTE */\n");
} else {
$self->print_functions($trie, %lengths);
}
print { $code } ("${static}enum ${enum_name} ${function_name}(const char *string, size_t length)\n");
print { $code } ("{\n");
print { $code } (" switch (length) {\n");
foreach my $local_length (sort { $a <=> $b } (keys %lengths)) {
print { $code } (" case $local_length:\n");
print { $code } (" return ${function_name}${local_length}(string);\n");
}
print { $code } (" default:\n");
printf { $code } (" return %s$unknown_label;\n", ($enum_class ? "${enum_name}::" : ''));
print { $code } (" }\n");
print { $code } ("}\n");
# Print end of header here, in case header and code point to the same file
print { $header } ("#endif /* TRIE_HASH_${function_name} */\n");
}
}
# A character is ambiguous if the 1<<5 (0x20) bit does not correspond to the
# lower case bit. A word is ambiguous if any character is. This definition is
# used to check if we can perform the |0x20 optimization when building a case-
# insensitive trie.
sub ambiguous {
my $word = shift;
foreach my $char (split //, $word) {
# If 0x20 does not solely indicate lowercase, it is ambiguous
return 1 if ord(lc($char)) != (ord($char) | 0x20);
return 1 if ord(uc($char)) != (ord($char) & ~0x20);
}
return 0;
}
sub build_trie {
my $codegen = shift;
my $trie = Trie->new;
my $counter = $counter_start;
my $prev_value;
my %lengths;
open(my $input, '<', $ARGV[0]) or die "Cannot open $ARGV[0]: $!";
while (my $line = <$input>) {
my ($label, $word, $value) = $line =~ m{
(?:\s*([^~\s]+)\s*~)? # Label ~
(?:\s*([^~=\s]+))? # Word
(?:\s*=\s*([^\s]+)\s+)? # = Value
\s*
}x;
if (defined $word) {
$label //= $codegen->word_to_label($word);
$value //= defined $prev_value ? $prev_value + 1 : 0;
$trie->insert($word, $label, $value);
$lengths{length($word)} = 1;
} elsif (defined $value) {
$unknown = $value;
$unknown_label = $codegen->mangle_label($label) if defined $label;
} else {
die "Invalid line: $line";
}
$prev_value = $value;
$counter = $value + 1 if $value >= $counter;
}
$unknown_label //= $codegen->mangle_label('Unknown');
return ($trie, $counter, %lengths);
}
# Generates an ASCII art tree
package TreeCodeGen {
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
return $self;
}
sub mangle_label {
my ($self, $label) = @_;
return $label;
}
sub word_to_label {
my ($self, $word) = @_;
return $word;
}
sub main {
my ($self, $trie, $counter, %lengths) = @_;
printf { $code } ("┌────────────────────────────────────────────────────┐\n");
printf { $code } ("│ Initial trie │\n");
printf { $code } ("└────────────────────────────────────────────────────┘\n");
$self->print($trie);
printf { $code } ("┌────────────────────────────────────────────────────┐\n");
printf { $code } ("│ Rebuilt trie │\n");
printf { $code } ("└────────────────────────────────────────────────────┘\n");
$self->print($trie->rebuild_tree());
foreach my $local_length (sort { $a <=> $b } (keys %lengths)) {
printf { $code } ("┌────────────────────────────────────────────────────┐\n");
printf { $code } ("│ Trie for words of length %-4d │\n", $local_length);
printf { $code } ("└────────────────────────────────────────────────────┘\n");
$self->print($trie->filter_depth($local_length)->rebuild_tree());
}
}
sub open_output {
my $self = shift;
if ($code_name ne '-') {
open($code, '>:encoding(utf8)', $code_name) or die "Cannot open $ARGV[0]: $!" ;
} else {
$code = *STDOUT;
binmode($code, ':encoding(utf8)');
}
}
# Print a trie
sub print {
my ($self, $trie, $depth) = @_;
$depth //= 0;
print { $code } (' → ') if defined($trie->{label});
print { $code } ($trie->{label} // '', "\n");
foreach my $key (sort keys %{$trie->{children}}) {
print { $code } ('│ ' x ($depth), "├── $key");
$self->print($trie->{children}{$key}, $depth + 1);
}
}
}
my %codegens = (
C => 'CCodeGen',
tree => 'TreeCodeGen',
);
defined($codegens{$language}) or die "Unknown language $language. Valid choices: ", join(', ', keys %codegens);
my $codegen = $codegens{$language}->new();
my ($trie, $counter, %lengths) = build_trie($codegen);
$codegen->open_output();
$codegen->main($trie, $counter, %lengths);
=head1 LICENSE
triehash is available under the MIT/Expat license, see the source code
for more information.
=head1 AUTHOR
Julian Andres Klode <jak@jak-linux.org>
=cut

View File

@@ -0,0 +1,142 @@
SUMMARY = "Advanced front-end for dpkg"
DESCRIPTION = "APT is the Advanced Package Tool, an advanced interface to the Debian packaging system which provides the apt-get program."
HOMEPAGE = "https://packages.debian.org/sid/apt"
LICENSE = "GPL-2.0-or-later"
SECTION = "base"
# Triehash script taken from https://github.com/julian-klode/triehash
SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
file://triehash \
file://0001-Disable-documentation-directory-altogether.patch \
file://0001-Fix-musl-build.patch \
file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
file://0001-cmake-Do-not-build-po-files.patch \
file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
file://0001-aptwebserver.cc-Include-array.patch \
file://0001-Remove-using-std-binary_function.patch \
"
SRC_URI:append:class-native = " \
file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
"
SRC_URI:append:class-nativesdk = " \
file://0001-Do-not-init-tables-from-dpkg-configuration.patch \
file://0001-Revert-always-run-dpkg-configure-a-at-the-end-of-our.patch \
"
SRC_URI[sha256sum] = "86b888c901fa2e78f1bf52a2aaa2f400ff82a472b94ff0ac6631939ee68fa6fd"
LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263"
# the package is taken from snapshots.debian.org; that source is static and goes stale
# so we check the latest upstream from a directory that does get updated
UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/a/apt/"
# apt seems to follow a peculiar version policy, where every *other* even version
# is considered stable, e.g. 1.0, 1.4, 1.8, 2.2, 2.6, etc. As there is no way
# to express 'divisible by 4 plus 2' in regex (that I know of), let's hardcode a few.
UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>((2\.2)|(2\.6)|(3\.0)|(3\.4)|(3\.8)|(4\.2))(\.\d+)+)\.tar"
inherit cmake perlnative bash-completion useradd
# User is added to allow apt to drop privs, will runtime warn without
USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} = "--system --home /nonexistent --no-create-home _apt"
BBCLASSEXTEND = "native nativesdk"
DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
EXTRA_OECMAKE:append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
-DDPKG_DATADIR=${datadir}/dpkg \
-DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
-DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
-DCMAKE_DISABLE_FIND_PACKAGE_SECCOMP=True \
-DWITH_TESTS=False \
"
do_configure:prepend() {
echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
}
# Unfortunately apt hardcodes this all over the place
FILES:${PN} += "${prefix}/lib/dpkg ${prefix}/lib/apt"
RDEPENDS:${PN} += "bash perl dpkg"
customize_apt_conf_sample() {
cat > ${D}${sysconfdir}/apt/apt.conf.sample << EOF
Dir "${STAGING_DIR_NATIVE}/"
{
State "var/lib/apt/"
{
Lists "#APTCONF#/lists/";
status "#ROOTFS#/var/lib/dpkg/status";
};
Cache "var/cache/apt/"
{
Archives "archives/";
pkgcache "";
srcpkgcache "";
};
Bin "${STAGING_BINDIR_NATIVE}/"
{
methods "${STAGING_LIBDIR}/apt/methods/";
gzip "/bin/gzip";
dpkg "dpkg";
dpkg-source "dpkg-source";
dpkg-buildpackage "dpkg-buildpackage";
apt-get "apt-get";
apt-cache "apt-cache";
};
Etc "#APTCONF#"
{
Preferences "preferences";
};
Log "var/log/apt";
};
APT
{
Install-Recommends "true";
Immediate-Configure "false";
Architecture "i586";
Get
{
Assume-Yes "true";
};
};
Acquire
{
AllowInsecureRepositories "true";
};
DPkg::Options {"--root=#ROOTFS#";"--admindir=#ROOTFS#/var/lib/dpkg";"--force-all";"--no-force-overwrite";"--no-debsig"};
DPkg::Path "";
EOF
}
do_install:append:class-native() {
customize_apt_conf_sample
}
do_install:append:class-nativesdk() {
customize_apt_conf_sample
rm -rf ${D}${localstatedir}/log
}
do_install:append:class-target() {
# Write the correct apt-architecture to apt.conf
APT_CONF=${D}${sysconfdir}/apt/apt.conf
echo 'APT::Architecture "${DPKG_ARCH}";' > ${APT_CONF}
# Remove /var/log/apt. /var/log is normally a link to /var/volatile/log
# and /var/volatile is a tmpfs mount. So anything created in /var/log
# will not be available when the tmpfs is mounted.
rm -rf ${D}${localstatedir}/log
}
do_install:append() {
# Avoid non-reproducible -src package
sed -i -e "s,${B}/include/,,g" ${B}/apt-pkg/tagfile-keys.cc
}

View File

@@ -0,0 +1,17 @@
SUMMARY = "a collection of freely re-usable Autoconf macros"
HOMEPAGE = "http://www.gnu.org/software/autoconf-archive/"
SECTION = "devel"
LICENSE = "GPL-3.0-with-autoconf-exception"
LIC_FILES_CHKSUM = "file://COPYING;md5=11cc2d3ee574f9d6b7ee797bdce4d423 \
file://COPYING.EXCEPTION;md5=fdef168ebff3bc2f13664c365a5fb515"
SRC_URI = "${GNU_MIRROR}/${BPN}/${BPN}-${PV}.tar.xz"
SRC_URI[sha256sum] = "71d4048479ae28f1f5794619c3d72df9c01df49b1c628ef85fde37596dc31a33"
inherit autotools allarch texinfo
PACKAGES = "${PN} ${PN}-doc"
FILES:${PN} += "${datadir}/aclocal"
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,121 @@
From 1a50157aa11da48921200a0d8d4308863716eab0 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 12 Mar 2020 17:25:23 +0000
Subject: [PATCH] autoreconf-exclude.patch
Upstream-Status: Inappropriate [oe specific]
---
bin/autoreconf.in | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index 98ebab6..937f758 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -83,6 +83,7 @@ Operation modes:
-i, --install copy missing standard auxiliary files
--no-recursive don't rebuild sub-packages
-s, --symlink with -i, install symbolic links instead of copies
+ -x, --exclude=STEPS steps we should not run
-m, --make when applicable, re-run ./configure && make
-W, --warnings=CATEGORY report the warnings falling in CATEGORY
(comma-separated list accepted)
@@ -141,6 +142,10 @@ my $run_make = 0;
# Recurse into subpackages
my $recursive = 1;
+# Steps to exclude
+my @exclude;
+my @ex;
+
## ---------- ##
## Routines. ##
## ---------- ##
@@ -161,6 +166,7 @@ sub parse_args ()
'B|prepend-include=s' => \@prepend_include,
'i|install' => \$install,
's|symlink' => \$symlink,
+ 'x|exclude=s' => \@exclude,
'm|make' => \$run_make,
'recursive!' => \$recursive);
@@ -170,6 +176,8 @@ sub parse_args ()
parse_WARNINGS;
parse_warnings @warning;
+ @exclude = map { split /,/ } @exclude;
+
# Even if the user specified a configure.ac, trim to get the
# directory, and look for configure.ac again. Because (i) the code
# is simpler, and (ii) we are still able to diagnose simultaneous
@@ -493,8 +501,11 @@ sub autoreconf_current_directory ($)
}
else
{
+ @ex = grep (/^autopoint$/, @exclude);
+ if ($#ex == -1) {
xsystem_hint ("autopoint is needed because this package uses Gettext",
$autopoint);
+ }
}
@@ -691,9 +702,12 @@ sub autoreconf_current_directory ($)
{
$libtoolize .= " --ltdl";
}
+ @ex = grep (/^libtoolize$/, @exclude);
+ if ($#ex == -1) {
xsystem_hint ("libtoolize is needed because this package uses Libtool",
$libtoolize);
$rerun_aclocal = 1;
+ }
}
else
{
@@ -730,8 +744,11 @@ sub autoreconf_current_directory ($)
}
elsif ($install)
{
+ @ex = grep (/^gtkdocize$/, @exclude);
+ if ($#ex == -1) {
xsystem_hint ("gtkdocize is needed because this package uses Gtkdoc",
$gtkdocize);
+ }
}
else
{
@@ -769,7 +786,10 @@ sub autoreconf_current_directory ($)
# latter runs the former, and (ii) autoconf is stricter than
# autoheader. So all in all, autoconf should give better error
# messages.
+ @ex = grep (/^autoconf$/, @exclude);
+ if ($#ex == -1) {
xsystem ($autoconf);
+ }
# -------------------- #
@@ -790,7 +810,10 @@ sub autoreconf_current_directory ($)
}
else
{
+ @ex = grep (/^autoheader$/, @exclude);
+ if ($#ex == -1) {
xsystem ($autoheader);
+ }
}
@@ -807,7 +830,10 @@ sub autoreconf_current_directory ($)
# We should always run automake, and let it decide whether it shall
# update the file or not. In fact, the effect of '$force' is already
# included in '$automake' via '--no-force'.
+ @ex = grep (/^automake$/, @exclude);
+ if ($#ex == -1) {
xsystem ($automake);
+ }
}
# ---------------------------------------------------- #

View File

@@ -0,0 +1,127 @@
From b28bd61e4716e744617bd681a5b0d5472f62bd67 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 12 Mar 2020 17:25:45 +0000
Subject: [PATCH] autotest-automake-result-format.patch
Upstream-Status: Inappropriate [oe specific]
---
lib/autotest/general.m4 | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index bf18866..8097523 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -427,6 +427,9 @@ at_recheck=
# Whether a write failure occurred
at_write_fail=0
+# Automake result format "result: testname"
+at_am_fmt=false
+
# The directory we run the suite in. Default to . if no -C option.
at_dir=`pwd`
# An absolute reference to this testsuite script.
@@ -540,6 +543,10 @@ do
at_check_filter_trace=at_fn_filter_trace
;;
+ --am-fmt | -A )
+ at_am_fmt=:
+ ;;
+
[[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]])
at_fn_validate_ranges at_option
AS_VAR_APPEND([at_groups], ["$at_option$as_nl"])
@@ -728,10 +735,10 @@ m4_divert_push([HELP_MODES])dnl
cat <<_ATEOF || at_write_fail=1
Operation modes:
- -h, --help print the help message, then exit
- -V, --version print version number, then exit
- -c, --clean remove all the files this test suite might create and exit
- -l, --list describes all the tests, or the selected TESTS
+ -h, --help print the help message, then exit
+ -V, --version print version number, then exit
+ -c, --clean remove all the files this test suite might create and exit
+ -l, --list describes all the tests, or the selected TESTS
_ATEOF
m4_divert_pop([HELP_MODES])dnl
m4_wrap([m4_divert_push([HELP_TUNING_BEGIN])dnl
@@ -757,6 +764,7 @@ Execution tuning:
-d, --debug inhibit clean up and top-level logging
[ default for debugging scripts]
-x, --trace enable tests shell tracing
+ -A, --am-fmt automake result format "result: testname"
_ATEOF
m4_divert_pop([HELP_TUNING_BEGIN])])dnl
m4_divert_push([HELP_END])dnl
@@ -1139,7 +1147,9 @@ at_fn_group_banner ()
[*]) at_desc_line="$[1]: " ;;
esac
AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"])
- $at_quiet AS_ECHO_N(["$at_desc_line"])
+ if ! $at_am_fmt; then
+ $at_quiet AS_ECHO_N(["$at_desc_line"])
+ fi
echo "# -*- compilation -*-" >> "$at_group_log"
}
@@ -1165,42 +1175,51 @@ _ATEOF
case $at_xfail:$at_status in
yes:0)
at_msg="UNEXPECTED PASS"
+ at_am_msg="XPASS"
at_res=xpass
at_errexit=$at_errexit_p
at_color=$at_red
;;
no:0)
at_msg="ok"
+ at_am_msg="PASS"
at_res=pass
at_errexit=false
at_color=$at_grn
;;
*:77)
at_msg='skipped ('`cat "$at_check_line_file"`')'
+ at_am_msg="SKIP"
at_res=skip
at_errexit=false
at_color=$at_blu
;;
no:* | *:99)
at_msg='FAILED ('`cat "$at_check_line_file"`')'
+ at_am_msg="FAIL"
at_res=fail
at_errexit=$at_errexit_p
at_color=$at_red
;;
yes:*)
at_msg='expected failure ('`cat "$at_check_line_file"`')'
+ at_am_msg="XFAIL"
at_res=xfail
at_errexit=false
at_color=$at_lgn
;;
esac
echo "$at_res" > "$at_job_dir/$at_res"
- # In parallel mode, output the summary line only afterwards.
- if test $at_jobs -ne 1 && test -n "$at_verbose"; then
- AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"])
+ if $at_am_fmt; then
+ AS_ECHO(["$at_am_msg: $at_desc"])
else
- # Make sure there is a separator even with long titles.
- AS_ECHO([" $at_color$at_msg$at_std"])
+ # In parallel mode, output the summary line only afterwards.
+ if test $at_jobs -ne 1 && test -n "$at_verbose"; then
+ AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"])
+ else
+ # Make sure there is a separator even with long titles.
+ AS_ECHO([" $at_color$at_msg$at_std"])
+ fi
fi
at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
case $at_status in

View File

@@ -0,0 +1,31 @@
From 1c033f2a23941c46d88b9ac279f87bf2c6e99499 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Wed, 15 Jul 2020 16:03:21 +0100
Subject: [PATCH] Don't use the target perl when regenerating the man pages.
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
man/local.mk | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/man/local.mk b/man/local.mk
index 775c131..ba94753 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -77,13 +77,12 @@ SUFFIXES += .w .1
@echo "Updating man page $@"
$(MKDIR_P) $(@D)
PATH="$(top_srcdir)/man$(PATH_SEPARATOR)$$PATH"; \
- PERL="$(PERL)"; \
PACKAGE_NAME="$(PACKAGE_NAME)"; \
VERSION="$(VERSION)"; \
RELEASE_YEAR="$(RELEASE_YEAR)"; \
top_srcdir="$(top_srcdir)"; \
channeldefs_pm="$(channeldefs_pm)"; \
- export PATH PERL PACKAGE_NAME VERSION RELEASE_YEAR; \
+ export PATH PACKAGE_NAME VERSION RELEASE_YEAR; \
export top_srcdir channeldefs_pm; \
$(HELP2MAN) \
--include=$(srcdir)/$*.x \

View File

@@ -0,0 +1,36 @@
From 8bcaf677e41f1f5d3fa0a746e35958e7b303ac71 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Wed, 15 Jul 2020 16:03:21 +0100
Subject: [PATCH] autoconf: upgrade to 2.71
For native builds we don't care about the documentation, and this would
otherwise pull in a dependency on help2man.
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
Makefile.in | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index c8d6425..72d6d05 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -771,16 +771,6 @@ buildauxdir = $(pkgdatadir)/build-aux
dist_buildaux_DATA = \
$(AUXSCRIPTS)
-dist_man_MANS = \
- man/autoconf.1 \
- man/autoheader.1 \
- man/autom4te.1 \
- man/autoreconf.1 \
- man/autoscan.1 \
- man/autoupdate.1 \
- man/ifnames.1
-
-
# Each manpage depends on:
# - its .w and .x files and its source script in bin/
# - common.x for the SEE ALSO list

View File

@@ -0,0 +1,36 @@
From a877ff979349d3bf6f5f0d92fe4e741be0ad98b4 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 12 Mar 2020 17:25:41 +0000
Subject: [PATCH] m4sh: prefer bash over sh
_AS_DETECT_BETTER_SHELL looks for a good shell to use, and tries to look for
'sh' before 'bash'. Whilst for many systems sh is a symlink to bash,
there are many where sh is a symlink to a more minimal sh implementation.
For example, Debian by default has /bin/sh -> /bin/dash: dash is a faster
shell to start (which makes a notable difference to boot speed) but is not
as fast as bash at executing long scripts (and configure scripts are not
known for their conciseness).
Change the search order to bash then sh, so that a known-good shell (bash)
is used if available over something which is merely POSIX compliant.
Upstream-Status: Inappropriate [oe specific]
---
lib/m4sugar/m4sh.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 368487f..cc70f51 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -233,7 +233,7 @@ dnl Remove any tests from suggested that are also required
[_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
[case $as_dir in @%:@(
/*)
- for as_base in sh bash ksh sh5; do
+ for as_base in bash sh ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir$as_base
AS_IF([{ test -f "$as_shell" || test -f "$as_shell.exe"; } &&

View File

@@ -0,0 +1,25 @@
From 7949496ff3834dcd98407cc3f3ea022ee2471d52 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 12 Mar 2020 17:28:38 +0000
Subject: [PATCH] program_prefix.patch
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
lib/autoconf/general.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 47d896d..3deaa46 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2071,7 +2071,7 @@ _AC_CANONICAL_SPLIT([target])
# The aliases save the names the user supplied, while $host etc.
# will get canonicalized.
-test -n "$target_alias" &&
+test -n "$target_alias" && test "$target_alias" != "$host_alias" &&
test "$program_prefix$program_suffix$program_transform_name" = \
NONENONEs,x,x, &&
program_prefix=${target_alias}-[]dnl

View File

@@ -0,0 +1,32 @@
From 294a8d47a70db077691624615c5cb6d331a3299b Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 12 Mar 2020 17:25:37 +0000
Subject: [PATCH] remove-usr-local-lib-from-m4.patch
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
lib/autoconf/functions.m4 | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 9b3f3c0..1faa99b 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -825,15 +825,6 @@ if test $ac_have_func = no; then
[LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
fi
-if test $ac_have_func = no; then
- # There is a commonly available library for RS/6000 AIX.
- # Since it is not a standard part of AIX, it might be installed locally.
- ac_getloadavg_LIBS=$LIBS
- LIBS="-L/usr/local/lib $LIBS"
- AC_CHECK_LIB(getloadavg, getloadavg,
- [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS])
-fi
-
# Make sure it is really in the library, if we think we found it,
# otherwise set up the replacement function.
AC_CHECK_FUNCS(getloadavg, [],

View File

@@ -0,0 +1,83 @@
SUMMARY = "A GNU tool that produce shell scripts to automatically configure software"
DESCRIPTION = "Autoconf is an extensible package of M4 macros that produce shell scripts to automatically \
configure software source code packages. Autoconf creates a configuration script for a package from a template \
file that lists the operating system features that the package can use, in the form of M4 macro calls."
LICENSE = "GPL-3.0-or-later"
HOMEPAGE = "http://www.gnu.org/software/autoconf/"
SECTION = "devel"
DEPENDS = "m4-native autoconf-native automake-native gnu-config-native help2man-native"
DEPENDS:remove:class-native = "autoconf-native automake-native help2man-native"
LIC_FILES_CHKSUM = "file://COPYING;md5=cc3f3a7596cb558bbd9eb7fbaa3ef16c \
file://COPYINGv3;md5=1ebbd3e34237af26da5dc08a4e440464"
SRC_URI = " \
https://alpha.gnu.org/gnu/autoconf/${BP}.tar.gz \
file://program_prefix.patch \
file://autoreconf-exclude.patch \
file://remove-usr-local-lib-from-m4.patch \
file://preferbash.patch \
file://autotest-automake-result-format.patch \
file://man-host-perl.patch \
"
SRC_URI:append:class-native = " file://no-man.patch"
SRC_URI[sha256sum] = "f3478d3b597d51f5d61596fb2f6f6aba49cdd974b4b05ff0bac57f56b5cfdb39"
RDEPENDS:${PN} = "m4 gnu-config \
perl \
perl-module-bytes \
perl-module-carp \
perl-module-constant \
perl-module-data-dumper \
perl-module-errno \
perl-module-exporter \
perl-module-file-basename \
perl-module-file-compare \
perl-module-file-copy \
perl-module-file-find \
perl-module-file-glob \
perl-module-file-path \
perl-module-file-spec \
perl-module-file-spec-unix \
perl-module-file-stat \
perl-module-file-temp \
perl-module-getopt-long \
perl-module-io-file \
perl-module-list-util \
perl-module-overloading \
perl-module-posix \
perl-module-scalar-util \
perl-module-symbol \
perl-module-thread-queue \
perl-module-threads \
perl-module-feature \
"
RDEPENDS:${PN}:class-native = "m4-native gnu-config-native hostperl-runtime-native"
inherit autotools texinfo
PERL = "${USRBINPATH}/perl"
PERL:class-native = "/usr/bin/env perl"
PERL:class-nativesdk = "/usr/bin/env perl"
CACHED_CONFIGUREVARS += "ac_cv_path_PERL='${PERL}'"
EXTRA_OECONF += "ac_cv_path_M4=m4 ac_cv_prog_TEST_EMACS=no"
# As autoconf installs its own config.* files, ensure that they're always up to date.
update_gnu_config() {
install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/build-aux
install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/build-aux
}
do_configure[prefuncs] += "update_gnu_config"
do_configure:class-native() {
oe_runconf
}
do_install:append() {
rm -rf ${D}${datadir}/emacs
}
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,21 @@
SUMMARY = "A GNU tool for automatically generating Makefiles"
DESCRIPTION = "Automake is a tool for automatically generating `Makefile.in' files compliant with the GNU Coding \
Standards. Automake requires the use of Autoconf."
LICENSE = "GPL-2.0-only"
HOMEPAGE = "http://www.gnu.org/software/automake/"
SECTION = "devel"
SRC_URI = "${GNU_MIRROR}/automake/automake-${PV}.tar.gz"
inherit autotools texinfo
do_configure() {
# We can end up patching macros, which would then mean autoreconf
# Cheat by saying everything is up to date.
touch ${S}/aclocal.m4 ${S}/Makefile.in ${S}/configure
oe_runconf
}
export AUTOMAKE = "${@bb.utils.which('automake', d.getVar('PATH'))}"
FILES:${PN} += "${datadir}/automake* ${datadir}/aclocal*"

View File

@@ -0,0 +1,35 @@
From bed646918bc67e9e2151ccbda03aae34717821fe Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 20 Apr 2022 14:57:14 +0200
Subject: [PATCH] Drop ar 'u' argument
binutils/ar is configured in deterministic mode by default making the
'u' argument irrelevant while leading to warning massages similar to:
| ar: `u' modifier ignored since `D' is the default (see `U')
We also add 'D' flag explicitely to not rely in the default configuration
for reproducible archives.
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
bin/automake.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/automake.in b/bin/automake.in
index 92bcebe..0f2b84b 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -2678,7 +2678,7 @@ sub handle_libraries ()
}
define_variable ('AR', 'ar', INTERNAL);
- define_variable ('ARFLAGS', 'cru', INTERNAL);
+ define_variable ('ARFLAGS', 'crD', INTERNAL);
define_verbose_tagvar ('AR');
foreach my $pair (@liblist)
--
2.25.1

View File

@@ -0,0 +1,27 @@
From b3c6e1971786cd93a2e3017c92bfbfe96baaf2f7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 26 Jul 2017 11:19:56 -0700
Subject: [PATCH] automake: Add default libtool_tag to cppasm.
* bin/automake.in (register_language): Define default libtool tag to be CC
since CPPASCOMPILE is using CC to call assembler
Upstream-Status: Submitted
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
bin/automake.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/bin/automake.in b/bin/automake.in
index 3a66965..08ba09a 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -898,6 +898,7 @@ register_language ('name' => 'cppasm',
'libtool_tag' => 'CC',
'compile_flag' => '-c',
'output_flag' => '-o',
+ 'libtool_tag' => 'CC',
'extensions' => ['.S', '.sx']);
# Fortran 77

View File

@@ -0,0 +1,83 @@
From dff74c5b19935cc11b30116a7ae9c8affdff246b Mon Sep 17 00:00:00 2001
From: Kumar Gala <galak@kernel.crashing.org>
Date: Thu, 11 Aug 2011 01:26:33 -0500
Subject: [PATCH] automake: Update for python.m4 to respect libdir
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Updated for automake-1.12.6
Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
m4/python.m4 | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/m4/python.m4 b/m4/python.m4
index 4e7de9427..40fc5b396 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -96,6 +96,8 @@ AC_DEFUN([AM_PATH_PYTHON],
[am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`])
AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
+ AC_SUBST([PYTHON_LIB_PREFIX], ['${libdir}'])
+
dnl At times, e.g., when building shared libraries, you may want
dnl to know which OS platform Python thinks this is.
dnl
@@ -251,14 +253,7 @@ except ImportError:
else
am_py_prefix=$am_cv_python_prefix
fi
- am_cv_python_pythondir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
- sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
-else:
- from distutils import sysconfig
- sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
-sys.stdout.write(sitedir)"`
+ am_cv_python_pythondir=`echo "$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages"`
#
case $am_cv_python_pythondir in
$am_py_prefix*)
@@ -268,7 +263,7 @@ sys.stdout.write(sitedir)"`
*)
case $am_py_prefix in
/usr|/System*) ;;
- *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
+ *) am_cv_python_pythondir=$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages
;;
esac
;;
@@ -293,14 +288,7 @@ sys.stdout.write(sitedir)"`
else
am_py_exec_prefix=$am_cv_python_exec_prefix
fi
- am_cv_python_pyexecdir=`$PYTHON -c "
-$am_python_setup_sysconfig
-if can_use_sysconfig:
- sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'})
-else:
- from distutils import sysconfig
- sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
-sys.stdout.write(sitedir)"`
+ am_cv_python_pyexecdir=`echo "$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages"`
#
case $am_cv_python_pyexecdir in
$am_py_exec_prefix*)
@@ -310,7 +298,7 @@ sys.stdout.write(sitedir)"`
*)
case $am_py_exec_prefix in
/usr|/System*) ;;
- *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages"
+ *) am_cv_python_pyexecdir=$PYTHON_LIB_PREFIX/python$PYTHON_VERSION/site-packages
;;
esac
;;
--
2.20.1

View File

@@ -0,0 +1,65 @@
From 592eb55b248a765abfc796fccb68baa3d53745ac Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Thu, 26 Jul 2018 00:58:12 -0700
Subject: [PATCH] build: fix race in parallel builds
The automake-$(APIVERSION) is a hardlink of automake, if it is
created later than update_mans executing, there is a failure
[snip]
|: && mkdir -p doc && ./pre-inst-env /usr/bin/env perl
../automake-1.16.1/doc/help2man --output=doc/aclocal-1.16.1
aclocal-1.16
|help2man: can't get `--help' info from aclocal-1.16
|Try `--no-discard-stderr' if option outputs to stderr
Makefile:3693: recipe for target 'doc/aclocal-1.16.1' failed
[snip]
The automake_script is required by update_mans and update_mans
invokes automake-$(APIVERSION) rather than automake to generate
doc, so we should assign `automake-$(APIVERSION)' to automake_script.
The same reason to tweak aclocal_script.
* bin/local.mk: correct automake_script/aclocal_script
Upstream-Status: Submitted [automake-patches@gnu.org]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
Makefile.in | 4 ++--
bin/local.mk | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index c3e934c..7cddb8d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -691,8 +691,8 @@ bin_SCRIPTS = bin/automake bin/aclocal
# Used by maintainer checks and such.
automake_in = $(srcdir)/bin/automake.in
aclocal_in = $(srcdir)/bin/aclocal.in
-automake_script = bin/automake
-aclocal_script = bin/aclocal
+automake_script = bin/automake-$(APIVERSION)
+aclocal_script = bin/aclocal-$(APIVERSION)
AUTOMAKESOURCES = $(automake_in) $(aclocal_in)
info_TEXINFOS = doc/automake.texi doc/automake-history.texi
doc_automake_TEXINFOS = doc/fdl.texi
diff --git a/bin/local.mk b/bin/local.mk
index 97b38db..058ca99 100644
--- a/bin/local.mk
+++ b/bin/local.mk
@@ -31,8 +31,8 @@ CLEANFILES += \
# Used by maintainer checks and such.
automake_in = $(srcdir)/%D%/automake.in
aclocal_in = $(srcdir)/%D%/aclocal.in
-automake_script = %D%/automake
-aclocal_script = %D%/aclocal
+automake_script = %D%/automake-$(APIVERSION)
+aclocal_script = %D%/aclocal-$(APIVERSION)
AUTOMAKESOURCES = $(automake_in) $(aclocal_in)
TAGS_FILES += $(AUTOMAKESOURCES)
--
2.7.4

View File

@@ -0,0 +1,47 @@
From a860b28069785aa5bf2fa9b671287de9af5004ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= <bjst@enea.com>
Date: Wed, 19 Dec 2012 17:18:27 +0100
Subject: [PATCH] Add a new distro feature "ptest".
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Split "check-TESTS" into a buildtest and runtest target, so that they can
be run separately.
Signed-off-by: Björn Stenberg <bjst@enea.com>
Upstream-Status: Pending
---
lib/am/check.am | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/am/check.am b/lib/am/check.am
index e0db651..de137fa 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -41,7 +41,7 @@ am__tty_colors = { \
fi; \
}
-.PHONY: check-TESTS
+.PHONY: check-TESTS buildtest-TESTS runtest-TESTS
if !%?SERIAL_TESTS%
@@ -466,7 +466,14 @@ else %?SERIAL_TESTS%
## Obsolescent serial testsuite driver.
-check-TESTS: $(TESTS)
+AM_RECURSIVE_TARGETS += buildtest runtest
+
+buildtest-TESTS: $(TESTS) $(check_PROGRAMS)
+
+check-TESTS: buildtest-TESTS
+ $(MAKE) $(AM_MAKEFLAGS) runtest-TESTS
+
+runtest-TESTS:
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
## Make sure Solaris VPATH-expands all members of this list, even

View File

@@ -0,0 +1,48 @@
From f78dfa39139d528c94d72f27994f337f2fd3b6bd Mon Sep 17 00:00:00 2001
From: Adrian Calianu <adrian.calianu@enea.com>
Date: Thu, 25 Feb 2016 16:08:04 +0100
Subject: [PATCH] Set relative to top_builddir path in Makefile to access
test-driver
Signed-off-by: Adrian Calianu <adrian.calianu@enea.com>
Upstream-Status: Inappropriate [specific to oe-core target ptest installation]
Bug-Report: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19042
---
bin/automake.in | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/bin/automake.in b/bin/automake.in
index a52a489..8377d20 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -324,6 +324,9 @@ my $config_aux_dir_set_in_configure_ac = 0;
# $AM_CONFIG_AUX_DIR is prefixed with $(top_srcdir), so it can be used
# in Makefiles.
my $am_config_aux_dir = '';
+# Directory used at runtime like running test-driver that should not
+# depend on $(top_srcdir)
+my $am_config_rt_aux_dir = '';
# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR
# in configure.ac.
@@ -4854,7 +4857,7 @@ sub handle_per_suffix_test
{
require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
define_variable ("${pfx}LOG_DRIVER",
- "\$(SHELL) $am_config_aux_dir/test-driver",
+ "\$(SHELL) $am_config_rt_aux_dir/test-driver",
INTERNAL);
}
my $driver = '$(' . $pfx . 'LOG_DRIVER)';
@@ -7440,6 +7443,10 @@ sub locate_aux_dir ()
$am_config_aux_dir =
'$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir");
$am_config_aux_dir =~ s,/*$,,;
+
+ $am_config_rt_aux_dir =
+ '$(top_builddir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir");
+ $am_config_rt_aux_dir =~ s,/*$,,;
}

View File

@@ -0,0 +1,82 @@
From cd47c328cb53546891bb3dc7c9b2c54ed01cc6d1 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Mon, 7 Dec 2015 18:28:05 +0000
Subject: [PATCH] automake: Remove delays in configure scripts using automake
By default automake puts "sleep 1" into the start of configure scripts
which adds pointless delays to them. Rather than do this, lets just assume
our systems are sane.
RP
2015/12/7
Upstream-Status: Inappropriate
---
m4/sanity.m4 | 55 -------------------------------------------------------
1 file changed, 55 deletions(-)
diff --git a/m4/sanity.m4 b/m4/sanity.m4
index eaac218..bfdfe88 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -23,60 +23,5 @@ case $srcdir in
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
-# Do 'set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- am_has_slept=no
- for am_try in 1 2; do
- echo "timestamp, slept: $am_has_slept" > conftest.file
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$[*]" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- if test "$[*]" != "X $srcdir/configure conftest.file" \
- && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
- alias in your environment])
- fi
- if test "$[2]" = conftest.file || test $am_try -eq 2; then
- break
- fi
- # Just in case.
- sleep 1
- am_has_slept=yes
- done
- test "$[2]" = conftest.file
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
AC_MSG_RESULT([yes])
-# If we didn't sleep, we still need to ensure time stamps of config.status and
-# generated files are strictly newer.
-am_sleep_pid=
-if grep 'slept: no' conftest.file >/dev/null 2>&1; then
- ( sleep 1 ) &
- am_sleep_pid=$!
-fi
-AC_CONFIG_COMMANDS_PRE(
- [AC_MSG_CHECKING([that generated files are newer than configure])
- if test -n "$am_sleep_pid"; then
- # Hide warnings about reused PIDs.
- wait $am_sleep_pid 2>/dev/null
- fi
- AC_MSG_RESULT([done])])
-rm -f conftest.file
])

View File

@@ -0,0 +1,43 @@
require automake.inc
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
DEPENDS:class-native = "autoconf-native"
NAMEVER = "${@oe.utils.trim_version("${PV}", 2)}"
RDEPENDS:${PN} += "\
autoconf \
perl \
perl-module-bytes \
perl-module-data-dumper \
perl-module-strict \
perl-module-text-parsewords \
perl-module-thread-queue \
perl-module-threads \
perl-module-vars "
RDEPENDS:${PN}:class-native = "autoconf-native hostperl-runtime-native"
SRC_URI += "\
file://0001-automake-Update-for-python.m4-to-respect-libdir.patch \
file://buildtest.patch \
file://performance.patch \
file://new_rt_path_for_test-driver.patch \
file://0001-automake-Add-default-libtool_tag-to-cppasm.patch \
file://0001-build-fix-race-in-parallel-builds.patch \
file://0001-Drop-ar-u-argument.patch \
"
SRC_URI[sha256sum] = "07bd24ad08a64bc17250ce09ec56e921d6343903943e99ccf63bbf0705e34605"
PERL = "${USRBINPATH}/perl"
PERL:class-native = "${USRBINPATH}/env perl"
PERL:class-nativesdk = "${USRBINPATH}/env perl"
CACHED_CONFIGUREVARS += "ac_cv_path_PERL='${PERL}'"
do_install:append () {
install -d ${D}${datadir}
}
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,59 @@
LIC_FILES_CHKSUM="\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
"
# When upgrading to 2.42, please make sure there is no trailing .0, so
# that upstream version check can work correctly.
PV = "2.42"
CVE_VERSION = "2.42"
SRCBRANCH ?= "binutils-2_42-branch"
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
CVE_STATUS[CVE-2023-25584] = "cpe-incorrect: Applies only for version 2.40 and earlier"
CVE_STATUS[CVE-2025-1180] = "patched: fixed by patch for CVE-2025-1176"
SRCREV ?= "f9488b0d92b591bdf3ff8cce485cb0e1b3727cc0"
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=https"
SRC_URI = "\
${BINUTILS_GIT_URI} \
file://0004-Point-scripts-location-to-libdir.patch \
file://0005-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \
file://0006-warn-for-uses-of-system-directories-when-cross-linki.patch \
file://0007-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \
file://0008-Use-libtool-2.4.patch \
file://0009-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \
file://0010-sync-with-OE-libtool-changes.patch \
file://0011-Check-for-clang-before-checking-gcc-version.patch \
file://0012-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \
file://0013-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
file://0014-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \
file://0015-gprofng-change-use-of-bignum-to-bigint.patch \
file://0016-CVE-2024-53589.patch \
file://0017-dlltool-file-name-too-long.patch \
file://0018-CVE-2025-0840.patch \
file://CVE-2025-1176.patch \
file://CVE-2025-1178.patch \
file://CVE-2024-57360.patch \
file://CVE-2025-1181-pre.patch \
file://CVE-2025-1181.patch \
file://CVE-2025-1182.patch \
file://0019-CVE-2025-1153-1.patch \
file://0020-CVE-2025-1153-2.patch \
file://0021-CVE-2025-1153-3.patch \
file://CVE-2025-1179-pre.patch \
file://CVE-2025-1179.patch \
file://0022-CVE-2025-5245.patch \
file://0022-CVE-2025-5244.patch \
file://0023-CVE-2025-7546.patch \
file://0023-CVE-2025-7545.patch \
"
S = "${WORKDIR}/git"

View File

@@ -0,0 +1,32 @@
inherit cross-canadian
SUMMARY = "GNU binary utilities (cross-canadian for ${TARGET_ARCH} target)"
PN = "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
BPN = "binutils"
DEPENDS = "flex-native bison-native virtual/${HOST_PREFIX}gcc virtual/nativesdk-libc nativesdk-zlib nativesdk-gettext nativesdk-flex"
EXTRA_OECONF += "--with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
--enable-poison-system-directories \
"
# We have to point binutils at a sysroot but we don't need to rebuild if this changes
# e.g. we switch between different machines with different tunes.
EXTRA_OECONF[vardepsexclude] = "TUNE_PKGARCH"
do_install () {
autotools_do_install
# We're not interested in the libs or headers, these would come from the
# nativesdk or target version of the binutils recipe
rm -rf ${D}${prefix}/${TARGET_SYS}
rm -f ${D}${libdir}/libbfd*
rm -f ${D}${libdir}/libiberty*
rm -f ${D}${libdir}/libopcodes*
rm -f ${D}${includedir}/*.h
rm -f ${D}${sysconfdir}/gprofng.rc
rmdir ${D}${sysconfdir} || :
cross_canadian_bindirlinks
}
BBCLASSEXTEND = ""

View File

@@ -0,0 +1,3 @@
require binutils.inc
require binutils-${PV}.inc
require binutils-cross-canadian.inc

View File

@@ -0,0 +1,83 @@
require binutils.inc
require binutils-${PV}.inc
BPN = "binutils"
DEPENDS += "dejagnu-native expect-native"
DEPENDS += "binutils-native"
deltask do_compile
deltask do_install
inherit nopackages
do_configure[dirs] += "${B}/ld ${B}/bfd"
do_configure() {
# create config.h, oe enables initfini-array by default
echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h
}
# target depends
DEPENDS += "virtual/${TARGET_PREFIX}binutils"
DEPENDS += "virtual/${TARGET_PREFIX}gcc"
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
DEPENDS += "virtual/${MLPREFIX}libc"
python check_prepare() {
def suffix_sys(sys):
if sys.endswith("-linux"):
return sys + "-gnu"
return sys
def generate_site_exp(d, suite):
content = []
content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite))
content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite))
content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS")))
content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS")))
# use BUILD here since HOST=TARGET
content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS")))
content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS")))
content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS")))
content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS"))))
content.append("set development true")
content.append("set experimental false")
content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
content.append(d.expand('set LD "${TARGET_PREFIX}ld ${TUNE_LDARGS}"'))
content.append(d.expand('set LDFLAGS_FOR_TARGET "${TUNE_LDARGS}"'))
if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64":
# oe patches binutils to have the default mips64 abi as 64bit, but
# skips gas causing issues with the ld test suite (which uses gas)
content.append('set ASFLAGS "-64"')
return "\n".join(content)
for i in ["binutils", "gas", "ld"]:
builddir = os.path.join(d.getVar("B"), i)
if not os.path.isdir(builddir):
os.makedirs(builddir)
with open(os.path.join(builddir, "site.exp"), "w") as f:
f.write(generate_site_exp(d, i))
}
CHECK_TARGETS ??= "binutils gas ld"
do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
do_check[prefuncs] += "check_prepare"
do_check[nostamp] = "1"
do_check() {
export LC_ALL=C
for i in ${CHECK_TARGETS}; do
(cd ${B}/$i; runtest \
--tool $i \
--srcdir ${S}/$i/testsuite \
--ignore 'plugin.exp' \
|| true)
done
}
addtask check after do_configure

View File

@@ -0,0 +1,39 @@
inherit cross
PROVIDES = "virtual/${TARGET_PREFIX}binutils"
PN = "binutils-cross-${TARGET_ARCH}"
BPN = "binutils"
# Ignore how TARGET_ARCH is computed.
TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
INHIBIT_DEFAULT_DEPS = "1"
INHIBIT_AUTOTOOLS_DEPS = "1"
SRC_URI += "file://0002-binutils-cross-Do-not-generate-linker-script-directo.patch"
# Specify lib-path else we use a load of search dirs which we don't use
# and mean the linker scripts have to be relocated.
EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_TARGET} \
--disable-install-libbfd \
--disable-gprofng \
--enable-poison-system-directories \
--with-lib-path==${target_base_libdir}:=${target_libdir} \
"
do_install () {
oe_runmake 'DESTDIR=${D}' install
# We don't really need these, so we'll remove them...
rm -rf ${D}${STAGING_DIR_NATIVE}${libdir_native}/libiberty.a
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/lib/ldscripts
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/info
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/locale
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/man
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/share || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}/gcc-lib || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64/gcc-lib || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir} || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64 || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${prefix} || :
}

View File

@@ -0,0 +1,3 @@
require binutils.inc
require binutils-${PV}.inc
require binutils-cross.inc

View File

@@ -0,0 +1,11 @@
require binutils-cross_${PV}.bb
inherit crosssdk
PN = "binutils-crosssdk-${SDK_SYS}"
SRC_URI += "file://0001-binutils-crosssdk-Generate-relocatable-SDKs.patch"
do_configure:prepend () {
sed -i 's#/usr/local/lib /lib /usr/lib#${SDKPATHNATIVE}/lib ${SDKPATHNATIVE}/usr/lib /usr/local/lib /lib /usr/lib#' ${S}/ld/configure.tgt
}

View File

@@ -0,0 +1,207 @@
SUMMARY = "GNU binary utilities"
DESCRIPTION = "The GNU Binutils are a collection of binary tools. \
The main ones are ld (GNU Linker), and as (GNU Assembler). This \
package also includes addition tools such as addr2line (Converts \
addresses into filenames and line numbers), ar (utility for creating, \
modifying and extracting archives), nm (list symbols in object \
files), objcopy (copy and translate object files), objdump (Display \
object information), and other tools and related libraries."
HOMEPAGE = "http://www.gnu.org/software/binutils/"
BUGTRACKER = "http://sourceware.org/bugzilla/"
SECTION = "devel"
LICENSE = "GPL-3.0-only"
DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native"
inherit autotools gettext multilib_header pkgconfig texinfo
FILES:${PN} = " \
${bindir}/${TARGET_PREFIX}* \
${libdir}/lib*.so.* \
${libdir}/bfd-plugins/lib*.so \
${libdir}/lib*-${PV}*.so \
${prefix}/${TARGET_SYS}/bin/* \
${bindir}/embedspu"
RPROVIDES:${PN} += "${PN}-symlinks"
FILES:${PN}-dev = " \
${includedir} \
${libdir}/*.la \
${libdir}/libbfd.so \
${libdir}/libctf.so \
${libdir}/libctf-nobfd.so \
${libdir}/libopcodes.so"
FILES:${PN}-staticdev += "${libdir}/gprofng/*.a"
# Rather than duplicating multiple entries for these, make one
# list and reuse it.
GPROFNGS = " \
gp-archive \
gp-collect-app \
gp-display-html \
gp-display-src \
gp-display-text \
gprofng \
"
# it disables gprofng for clang and musl in the bb file
GPROFNGS:toolchain-clang = ""
GPROFNGS:libc-musl = ""
GPROFNG_ALTS ?= ""
GPROFNG_ALTS:x86 = "${GPROFNGS}"
GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
LDGOLD_ALTS ?= "ld.gold dwp"
LDGOLD_ALTS:riscv64 = ""
LDGOLD_ALTS:riscv32 = ""
LDGOLD_ALTS:loongarch64 = ""
LDGOLD_ALTS:libc-glibc:mipsarch = ""
USE_ALTERNATIVES_FOR = " \
addr2line \
ar \
as \
c++filt \
elfedit \
gprof \
${GPROFNG_ALTS} \
ld \
ld.bfd \
${LDGOLD_ALTS} \
nm \
objcopy \
objdump \
ranlib \
readelf \
size \
strings \
strip \
"
python do_package:prepend() {
make_alts = d.getVar("USE_ALTERNATIVES_FOR") or ""
prefix = d.getVar("TARGET_PREFIX")
bindir = d.getVar("bindir")
for alt in make_alts.split():
d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt)
d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt)
}
B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
--disable-werror \
--enable-deterministic-archives \
--enable-plugins \
--enable-new-dtags \
--disable-gdb \
--disable-gdbserver \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
${LDGOLD} \
${EXTRA_TARGETS} \
${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
EXTRA_TARGETS = ""
EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep "
EXTRA_TARGETS:class-native = ""
LDGOLD:class-native = ""
LDGOLD:class-crosssdk = ""
LDGOLD:libc-glibc:mipsarch = ""
LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}"
# This is necessary due to a bug in the binutils Makefiles
# EXTRA_OEMAKE = "configure-build-libiberty all"
export AR = "${HOST_PREFIX}ar"
export AS = "${HOST_PREFIX}as"
export LD = "${HOST_PREFIX}ld"
export NM = "${HOST_PREFIX}nm"
export RANLIB = "${HOST_PREFIX}ranlib"
export OBJCOPY = "${HOST_PREFIX}objcopy"
export OBJDUMP = "${HOST_PREFIX}objdump"
export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
export AS_FOR_TARGET = "${TARGET_PREFIX}as"
export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
# autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need
# to unset LD_LIBRARY_PATH.
export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
do_configure[vardeps] += "MULTIARCH"
do_configure () {
(cd ${S} && gnu-configize)
oe_runconf
#
# must prime config.cache to ensure the build of libiberty
#
mkdir -p ${B}/build-${BUILD_SYS}
for i in ${CONFIG_SITE}; do
cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true
done
}
do_install () {
autotools_do_install
# We don't really need these, so we'll remove them...
rm -rf ${D}${libdir}/ldscripts
bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')}
# Fix the /usr/${TARGET_SYS}/bin/* links
for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
rm -f $l
ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l
done
# Install the libiberty header
install -d ${D}${includedir}
install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
install -m 644 ${S}/include/libiberty.h ${D}${includedir}
# insall pic version of libiberty if available
if [ -e ${B}/libiberty/pic/libiberty.a ]; then
install -Dm 0644 ${B}/libiberty/pic/libiberty.a ${D}${libdir}/libiberty.a
fi
cd ${D}${bindir}
# Symlinks for ease of running these on the native target
for p in ${TARGET_PREFIX}* ; do
ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,`
done
for alt in ${USE_ALTERNATIVES_FOR}; do
rm -f ${D}${bindir}/$alt
done
oe_multilib_header bfd.h
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}"
python () {
if bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', True, False, d) and bb.utils.contains_any('TARGET_ARCH', 'riscv32 riscv64 loongarch64', True, False, d):
bb.fatal("Gold linker does not _yet_ support RISC-V and LoongArch architecture please remove ld-is-gold from DISTRO_FEATURES")
}

View File

@@ -0,0 +1,75 @@
From 089ee95b342e79af09258b45c888a13b35fadf26 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:58:54 +0000
Subject: [PATCH] binutils-crosssdk: Generate relocatable SDKs
This patch will modify the ELF linker scripts so that the crosssdk
linker will generate binaries with a 4096 bytes PT_INTERP section. When the binaries
will be relocated, at SDK install time, the interpreter path can be easily
changed by the relocating script.
generate larger .interp section for gold linker as well
Upstream-Status: Inappropriate [SDK specific]
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gold/layout.cc | 2 +-
ld/genscripts.sh | 3 +++
ld/scripttempl/elf.sc | 4 ++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gold/layout.cc b/gold/layout.cc
index b43ae841a6c..6101a95195b 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -5102,7 +5102,7 @@ Layout::create_interp(const Target* target)
gold_assert(interp != NULL);
}
- size_t len = strlen(interp) + 1;
+ size_t len = 4096;
Output_section_data* odata = new Output_data_const(interp, len, 1);
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index d6ceb3fe4f5..365c0e778cc 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -298,6 +298,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
LD_FLAG=r
DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
+PARTIAL_LINKING=" "
( echo "/* Script for -r */"
source_sh ${CUSTOMIZER_SCRIPT}
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
@@ -306,10 +307,12 @@ DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
LD_FLAG=u
DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
CONSTRUCTING=" "
+PARTIAL_LINKING=" "
( echo "/* Script for -Ur */"
source_sh ${CUSTOMIZER_SCRIPT}
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu
+unset PARTIAL_LINKING
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
RELOCATING=" "
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index fae7c2ad71c..7fe37eb1874 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -150,8 +150,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
fi
fi
-if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
- INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
+if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}${PARTIAL_LINKING}"; then
+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }"
fi
if test -z "$PLT"; then
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"

View File

@@ -0,0 +1,59 @@
From 6fae7afeb713a60755e17443964e46190bb97ede Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Mar 2017 23:37:05 -0800
Subject: [PATCH] binutils-cross: Do not generate linker script directories
We don't place target libraries within ${exec_prefix}, we'd always place these
within the target sysroot within the standard library directories. Worse, the
append_to_lib_path code prefixes these paths with the sysroot which makes even
less sense.
These directories therefore don't make sense in our case and mean we have to
relocate all the linker scripts if they're present. Dropping them
gives a reasonable performance improvement/simplification.
Upstream-Status: Inappropriate
RP 2017/01/30
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/genscripts.sh | 25 -------------------------
1 file changed, 25 deletions(-)
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index 365c0e778cc..b0893fda3c5 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -229,31 +229,6 @@ append_to_lib_path()
fi
}
-# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native
-# except when LIBPATH=":".
-if [ "${LIB_PATH}" != ":" ] ; then
- libs=
- if [ "x${TOOL_LIB}" = "x" ] ; then
- if [ "x${NATIVE}" = "xyes" ] ; then
- libs="${exec_prefix}/${target_alias}/lib"
- fi
- else
- # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX}
- # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} are in the default search path,
- # because 64bit libraries may be in both places, depending on
- # cross-development setup method (e.g.: /usr/s390x-linux/lib64
- # vs. /usr/s390-linux/lib64)
- for libpath_suffix in ${LIBPATH_SUFFIX}; do
- case "${NATIVE}:${libpath_suffix}:${TOOL_LIB}" in
- :* | *::* | *:*:*${libpath_suffix}) ;;
- *) libs="${exec_prefix}/${target_alias}/lib${libpath_suffix}" ;;
- esac
- done
- libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}"
- fi
- append_to_lib_path ${libs}
-fi
-
if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
libs=${NATIVE_LIB_DIRS}
if [ "x${NATIVE}" = "xyes" ] ; then

View File

@@ -0,0 +1,95 @@
From 1fe9aa3f25e09281cb018b29081db4cc44bdc01f Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Wed, 19 Feb 2020 09:51:16 -0800
Subject: [PATCH] binutils-nativesdk: Search for alternative ld.so.conf in SDK
installation
We need binutils to look at our ld.so.conf file within the SDK to ensure
we search the SDK's libdirs as well as those from the host system.
We therefore pass in the directory to the code using a define, then add
it to a section we relocate in a similar way to the way we relocate the
gcc internal paths. This ensures that ld works correctly in our buildtools
tarball.
Standard sysroot relocation doesn't work since we're not in a sysroot,
we want to use both the host system and SDK libs.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020/1/17
Upstream-Status: Inappropriate [OE specific tweak]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/Makefile.am | 3 ++-
ld/Makefile.in | 3 ++-
ld/ldelf.c | 2 +-
ld/ldmain.c | 1 +
ld/ldmain.h | 1 +
5 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index f9ee05b1400..07801c2c3ac 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -42,7 +42,8 @@ ZLIBINC = @zlibinc@
ELF_CFLAGS=-DELF_LIST_OPTIONS=@elf_list_options@ \
-DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \
- -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@
+ -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ \
+ -DSYSCONFDIR="\"$(sysconfdir)\""
WARN_CFLAGS = @WARN_CFLAGS@
NO_WERROR = @NO_WERROR@
AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
diff --git a/ld/Makefile.in b/ld/Makefile.in
index abb0565718f..6329a12a0d6 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -576,7 +576,8 @@ ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
ELF_CFLAGS = -DELF_LIST_OPTIONS=@elf_list_options@ \
-DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \
- -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@
+ -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ \
+ -DSYSCONFDIR="\"$(sysconfdir)\""
AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
diff --git a/ld/ldelf.c b/ld/ldelf.c
index 2852851dcd5..187b359af86 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -939,7 +939,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force,
info.path = NULL;
info.len = info.alloc = 0;
- tmppath = concat (ld_sysroot, prefix, "/etc/ld.so.conf",
+ tmppath = concat (ld_sysconfdir, "/ld.so.conf",
(const char *) NULL);
if (!ldelf_parse_ld_so_conf (&info, tmppath))
{
diff --git a/ld/ldmain.c b/ld/ldmain.c
index e90c2021b33..01b306e58a1 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -69,6 +69,7 @@ char *program_name;
/* The prefix for system library directories. */
const char *ld_sysroot;
+char ld_sysconfdir[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSCONFDIR;
/* The canonical representation of ld_sysroot. */
char *ld_canon_sysroot;
diff --git a/ld/ldmain.h b/ld/ldmain.h
index 0238aed0ebd..2dd00db13b3 100644
--- a/ld/ldmain.h
+++ b/ld/ldmain.h
@@ -23,6 +23,7 @@
extern char *program_name;
extern const char *ld_sysroot;
+extern char ld_sysconfdir[4096];
extern char *ld_canon_sysroot;
extern int ld_canon_sysroot_len;
extern FILE *saved_script_handle;

View File

@@ -0,0 +1,39 @@
From 780109902b00652dfdc080607c614f210e96ae9b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:09:58 +0000
Subject: [PATCH] Point scripts location to libdir
Upstream-Status: Inappropriate [debian patch]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/Makefile.am | 2 +-
ld/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 07801c2c3ac..a2bcffecf73 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -51,7 +51,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 6329a12a0d6..15311048855 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -584,7 +584,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@@ -0,0 +1,32 @@
From c8cca8d2364c9f233d6e771136a4d4ff7f405c21 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:39:01 +0000
Subject: [PATCH] don't let the distro compiler point to the wrong installation
location
Thanks to RP for helping find the source code causing the issue.
2010/08/13
Nitin A Kamble <nitin.a.kamble@intel.com>
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libiberty/Makefile.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 85c4b6b6ef8..cb6e91c8f9b 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -385,7 +385,8 @@ install-strip: install
# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
# default multilib, so we have to take CFLAGS into account as well,
# since it will be passed the multilib flags.
-MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
+#MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
+MULTIOSDIR = ""
install_to_libdir: all
if test -n "${target_header_dir}"; then \
${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \

View File

@@ -0,0 +1,287 @@
From a92c46e3703d038d7d810bdc91e8540ad9d9150a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 15 Jan 2016 06:31:09 +0000
Subject: [PATCH] warn for uses of system directories when cross linking
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.in (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Upstream-Status: Pending
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/config.in | 3 +++
ld/configure | 16 ++++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 6 ++++--
ld/lexsup.c | 15 +++++++++++++++
9 files changed, 87 insertions(+), 2 deletions(-)
diff --git a/ld/config.in b/ld/config.in
index 52d62f06ff0..b5944e7ba55 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -70,6 +70,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index 6f8a05c3b6c..98a76d6da7f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -844,6 +844,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1534,6 +1535,8 @@ Optional Features:
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15566,6 +15569,19 @@ fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
+
# Check whether --enable-gold was given.
if test "${enable_gold+set}" = set; then :
enableval=$enable_gold; case "${enableval}" in
diff --git a/ld/configure.ac b/ld/configure.ac
index 4a11787ae71..104a531fb0f 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -103,6 +103,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index 54d9079678c..9f0163b2911 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -166,6 +166,14 @@ typedef struct
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index 4fda259a552..22685f5f1dd 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -3119,6 +3119,18 @@ creation of the metadata note, if one had been enabled by an earlier
occurrence of the --package-metadata option.
If the linker has been built with libjansson, then the JSON string
will be validated.
+
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index dc9875d8813..49d899ee49d 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -327,6 +327,23 @@ ldfile_add_library_path (const char *name, bool cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 161a9d4d8dc..757fe2f7650 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -147,6 +147,8 @@ enum option_values
OPTION_PLUGIN,
OPTION_PLUGIN_OPT,
#endif /* BFD_SUPPORTS_PLUGINS */
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
OPTION_DEFAULT_SCRIPT,
OPTION_PRINT_OUTPUT_FORMAT,
OPTION_PRINT_SYSROOT,
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 01b306e58a1..eddefc24332 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -326,6 +326,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
@@ -1458,7 +1460,7 @@ undefined_symbol (struct bfd_link_info *info,
argv[1] = "undefined-symbol";
argv[2] = (char *) name;
argv[3] = NULL;
-
+
if (verbose)
einfo (_("%P: About to run error handling script '%s' with arguments: '%s' '%s'\n"),
argv[0], argv[1], argv[2]);
@@ -1479,7 +1481,7 @@ undefined_symbol (struct bfd_link_info *info,
carry on to issue the normal error message. */
}
#endif /* SUPPORT_ERROR_HANDLING_SCRIPT */
-
+
if (section != NULL)
{
if (error_count < MAX_ERRORS_IN_A_ROW)
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 099dff8ecde..e9939000b2e 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -642,6 +642,14 @@ static const struct ld_option ld_options[] =
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -1818,6 +1826,13 @@ parse_args (unsigned argc, char **argv)
case OPTION_PRINT_MAP_LOCALS:
config.print_map_locals = true;
+
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
break;
case OPTION_DEPENDENCY_FILE:

View File

@@ -0,0 +1,37 @@
From d35fd95eee9930ab41d9ad637eacb35aa9fe6f44 Mon Sep 17 00:00:00 2001
From: Zhenhua Luo <zhenhua.luo@nxp.com>
Date: Sat, 11 Jun 2016 22:08:29 -0500
Subject: [PATCH] fix the incorrect assembling for ppc wait mnemonic
The wait mnemonic for ppc targets is incorrectly assembled into 0x7c00003c due
to duplicated address definition with waitasec instruction. The issue causes
kernel boot calltrace for ppc targets when wait instruction is executed.
Upstream-Status: Pending
Signed-off-by: Zhenhua Luo <zhenhua.luo@nxp.com>
---
opcodes/ppc-opc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index e55bfe846cd..66b37e36e6f 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -7138,8 +7138,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{"waitasec", X(31,30), XRTRARB_MASK, POWER8, POWER9, {0}},
{"waitrsv", XWCPL(31,30,1,0),0xffffffff, POWER10, EXT, {0}},
{"pause_short", XWCPL(31,30,2,0),0xffffffff, POWER10, EXT, {0}},
-{"wait", X(31,30), XWCPL_MASK, POWER10, 0, {WC, PL}},
-{"wait", X(31,30), XWC_MASK, POWER9, POWER10, {WC}},
{"lwepx", X(31,31), X_MASK, E500MC|PPCA2, 0, {RT, RA0, RB}},
@@ -7193,7 +7191,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{"waitrsv", X(31,62)|(1<<21), 0xffffffff, E500MC|PPCA2, EXT, {0}},
{"waitimpl", X(31,62)|(2<<21), 0xffffffff, E500MC|PPCA2, EXT, {0}},
-{"wait", X(31,62), XWC_MASK, E500MC|PPCA2, 0, {WC}},
+{"wait", X(31,62), XWC_MASK, E500MC|PPCA2|POWER9|POWER10, 0, {WC}},
{"dcbstep", XRT(31,63,0), XRT_MASK, E500MC|PPCA2, 0, {RA0, RB}},

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
From c9e810840d95554046b7132e3e2c98bf99cb2d89 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:42:38 +0000
Subject: [PATCH] Fix rpath in libtool when sysroot is enabled
Enabling sysroot support in libtool exposed a bug where the final
library had an RPATH encoded into it which still pointed to the
sysroot. This works around the issue until it gets sorted out
upstream.
Fix suggested by Richard Purdie <richard.purdie@linuxfoundation.org>
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ltmain.sh b/ltmain.sh
index 7f7104ffc82..f59eb4aa631 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8035,9 +8035,11 @@ EOF
test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ func_stripname '=' '' "$libdir"
+ libdir=$func_stripname_result
if test -n "$hardcode_libdir_separator"; then
- func_replace_sysroot "$libdir"
- libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
@@ -8770,6 +8772,10 @@ EOF
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ func_stripname '=' '' "$libdir"
+ libdir=$func_stripname_result
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"

View File

@@ -0,0 +1,86 @@
From befc176c209bbb4c32b57c2068e813c88b1ab6b1 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Mon, 6 Mar 2017 23:33:27 -0800
Subject: [PATCH] sync with OE libtool changes
Apply these patches from our libtool patches as not only are redundant RPATHs a
waste of space but they can cause incorrect linking when native packages are
restored from sstate.
fix-rpath.patch:
We don't want to add RPATHS which match default linker
search paths, they're a waste of space. This patch
filters libtools list and removes the ones we don't need.
norm-rpath.patch:
Libtool may be passed link paths of the form "/usr/lib/../lib", which
fool its detection code into thinking it should be included as an
RPATH in the generated binary. Normalize before comparision.
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/ltmain.sh b/ltmain.sh
index f59eb4aa631..ce97db42ce7 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8053,8 +8053,16 @@ EOF
esac
fi
else
- eval flag=\"$hardcode_libdir_flag_spec\"
- func_append dep_rpath " $flag"
+ # We only want to hardcode in an rpath if it isn't in the
+ # default dlsearch path.
+ func_normal_abspath "$libdir"
+ libdir_norm=$func_normal_abspath_result
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir_norm "*) ;;
+ *) eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ ;;
+ esac
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
@@ -8790,8 +8798,16 @@ EOF
esac
fi
else
- eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ # We only want to hardcode in an rpath if it isn't in the
+ # default dlsearch path.
+ func_normal_abspath "$libdir"
+ libdir_norm=$func_normal_abspath_result
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir_norm "*) ;;
+ *) eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath+=" $flag"
+ ;;
+ esac
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
@@ -8841,8 +8857,14 @@ EOF
esac
fi
else
- eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ # We only want to hardcode in an rpath if it isn't in the
+ # default dlsearch path.
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *) eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ ;;
+ esac
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in

View File

@@ -0,0 +1,45 @@
From cad852e0ed46a1c26607f9e7d17cc5974b05e38a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 15 Apr 2020 14:17:20 -0700
Subject: [PATCH] Check for clang before checking gcc version
Clang advertises itself to be gcc 4.2.1, so when compiling this test
here fails since gcc < 4.4.5 did not support -static-libstdc++ but thats
not true for clang, so its better to make an additional check for clang
before resorting to gcc version check. This should let clang enable
static libstdc++ linking
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 670684d83d1..f9ba1c0a4f7 100755
--- a/configure
+++ b/configure
@@ -5432,7 +5432,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#if !defined(__clang__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
#error -static-libstdc++ not implemented
#endif
int main() {}
diff --git a/configure.ac b/configure.ac
index 88b4800e298..6cd4530db56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1410,7 +1410,7 @@ if test "$GCC" = yes; then
AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_SOURCE([
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#if !defined(__clang__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
#error -static-libstdc++ not implemented
#endif
int main() {}])],

View File

@@ -0,0 +1,38 @@
From 47e53916e3112391d8bff2b2257dcec0a2426d66 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 10 Mar 2022 21:21:33 -0800
Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty
for cases where -rpath isn't specified. debian (#151024)
Upstream-Status: Pending
Signed-off-by: Chris Chimelis <chris@debian.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/ldelf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ld/ldelf.c b/ld/ldelf.c
index 187b359af86..ad792f02d63 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1130,6 +1130,9 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
&& command_line.rpath == NULL)
{
path = (const char *) getenv ("LD_RUN_PATH");
+ if ((path) && (strlen (path) == 0))
+ path = NULL;
+
if (path
&& ldelf_search_needed (path, &n, force,
is_linux, elfsize))
@@ -1805,6 +1808,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)

View File

@@ -0,0 +1,48 @@
From d479020609329cdc7fa3675bc3daf072401fefae Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 15 Jan 2023 00:16:25 -0800
Subject: [PATCH] Define alignof using _Alignof when using C11 or newer
WG14 N2350 made very clear that it is an UB having type definitions
within "offsetof" [1]. This patch enhances the implementation of macro
alignof to use builtin "_Alignof" to avoid undefined behavior on
when using std=c11 or newer
clang 16+ has started to flag this [2]
Fixes build when using -std >= gnu11 and using clang16+
Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
may support C11, exclude those compilers too
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
[2] https://reviews.llvm.org/D133574
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libiberty/sha1.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libiberty/sha1.c b/libiberty/sha1.c
index 49e8e0b6c2b..72de5cc8ad6 100644
--- a/libiberty/sha1.c
+++ b/libiberty/sha1.c
@@ -234,7 +234,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
if (len >= 64)
{
#if !_STRING_ARCH_unaligned
+/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
+ clang versions < 8.0.0 have the same bug. */
+#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
+ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
+ && !defined __clang__) \
+ || (defined __clang__ && __clang_major__ < 8))
# define alignof(type) offsetof (struct { char c; type x; }, x)
+#else
+# define alignof(type) _Alignof(type)
+#endif
# define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
if (UNALIGNED_P (buffer))
while (len > 64)

View File

@@ -0,0 +1,32 @@
From ddd941856582a82171626cbe609325b11e223704 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Jan 2023 19:35:07 -0800
Subject: [PATCH] Remove duplicate pe-dll.o entry deom targ_extra_ofiles
Commit c60b3806799abf1d7f6cf5108a1b0e733a950b13 added support for
aarch64-pe which introduced wrapper over pep-dll.c for x86_64 as well as
aarch64, on x86_64 it was added but the old object pe-dll.o needs to be
removed too, otherwise build fails with duplicate symbols from pe-dll.o
and pep-dll-x86_64.o
Upstream-Status: Submitted [https://sourceware.org/pipermail/binutils/2023-January/125739.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Jedidiah Thompson <wej22007@outlook.com>
Cc: Zac Walker <zac.walker@linaro.org>
---
ld/configure.tgt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index f937f78b876..830613744c2 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -1067,7 +1067,7 @@ x86_64-*-cygwin) targ_emul=i386pep ;
;;
x86_64-*-mingw*) targ_emul=i386pep ;
targ_extra_emuls=i386pe
- targ_extra_ofiles="deffilep.o pdb.o pep-dll.o pe-dll.o"
+ targ_extra_ofiles="deffilep.o pdb.o pe-dll.o"
;;
x86_64-*-gnu*) targ_emul=elf_x86_64
targ_extra_emuls="elf32_x86_64 elf_iamcu elf_i386"

View File

@@ -0,0 +1,17 @@
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3243d790ee32aa8eda69226d81b1e79dbd1dcd87]
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
diff --git a/gprofng/gp-display-html/gp-display-html.in b/gprofng/gp-display-html/gp-display-html.in
index 6f37ca282e7..306c99a0ec3 100644
--- a/gprofng/gp-display-html/gp-display-html.in
+++ b/gprofng/gp-display-html/gp-display-html.in
@@ -25,7 +25,7 @@ use warnings;
# Disable before release
# use Perl::Critic;
-use bignum;
+use bigint;
use List::Util qw (max);
use Cwd qw (abs_path cwd);
use File::Basename;

View File

@@ -0,0 +1,92 @@
Author: Alan Modra <amodra@gmail.com>
Date: Mon Nov 11 10:24:09 2024 +1030
Re: tekhex object file output fixes
Commit 8b5a212495 supported *ABS* symbols by allowing "section" to be
bfd_abs_section, but bfd_abs_section needs to be treated specially.
In particular, bfd_get_next_section_by_name (.., bfd_abs_section_ptr)
is invalid.
PR 32347
* tekhex.c (first_phase): Guard against modification of
_bfd_std_section[] entries.
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=e0323071916878e0634a6e24d8250e4faff67e88]
CVE: CVE-2024-53589
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index aea2ebb23df..b305c1f96f1 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -361,6 +361,7 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
{
asection *section, *alt_section;
unsigned int len;
+ bfd_vma addr;
bfd_vma val;
char sym[17]; /* A symbol can only be 16chars long. */
@@ -368,20 +369,16 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
{
case '6':
/* Data record - read it and store it. */
- {
- bfd_vma addr;
-
- if (!getvalue (&src, &addr, src_end))
- return false;
-
- while (*src && src < src_end - 1)
- {
- insert_byte (abfd, HEX (src), addr);
- src += 2;
- addr++;
- }
- return true;
- }
+ if (!getvalue (&src, &addr, src_end))
+ return false;
+
+ while (*src && src < src_end - 1)
+ {
+ insert_byte (abfd, HEX (src), addr);
+ src += 2;
+ addr++;
+ }
+ return true;
case '3':
/* Symbol record, read the segment. */
@@ -406,13 +403,16 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
{
case '1': /* Section range. */
src++;
- if (!getvalue (&src, &section->vma, src_end))
+ if (!getvalue (&src, &addr, src_end))
return false;
if (!getvalue (&src, &val, src_end))
return false;
- if (val < section->vma)
- val = section->vma;
- section->size = val - section->vma;
+ if (bfd_is_const_section (section))
+ break;
+ section->vma = addr;
+ if (val < addr)
+ val = addr;
+ section->size = val - addr;
/* PR 17512: file: objdump-s-endless-loop.tekhex.
Check for overlarge section sizes. */
if (section->size & 0x80000000)
@@ -455,6 +455,8 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
new_symbol->symbol.flags = BSF_LOCAL;
if (stype == '2' || stype == '6')
new_symbol->symbol.section = bfd_abs_section_ptr;
+ else if (bfd_is_const_section (section))
+ ;
else if (stype == '3' || stype == '7')
{
if ((section->flags & SEC_DATA) == 0)

View File

@@ -0,0 +1,208 @@
From d95d8395b3a533461f46e8b7e55fef540fc2621b Mon Sep 17 00:00:00 2001
From: Jiaying Song <jiaying.song.cn@windriver.com>
Date: Tue, 13 Aug 2024 10:31:21 +0800
Subject: [PATCH] dlltool: file name too long
During the execution of the command: i686-w64-mingw32-dlltool
--input-def $def_filepath --output-delaylib $filepath --dllname qemu.exe
An error occurred:
i686-w64-mingw32-dlltool: failed to open temporary head file: ..._w64_mingw32_nativesdk_qemu_8_2_2_build_plugins_libqemu_plugin_api_a_h.s
Due to the path length exceeding the Linux system's file name length
limit (NAME_MAX=255), the temporary file name generated by the
i686-w64-mingw32-dlltool command becomes too long to open. To address
this, a new temporary file name prefix is generated using tmp_prefix =
prefix_encode ("d", getpid()), ensuring that the file name does not
exceed the system's length limit.
Upstream-Status: Backport
[https://github.com/bminor/binutils-gdb/commit/a253bea8995323201b016fe477280c1782688ab4]
Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
Reviewed-by: Alan Modra <amodra@gmail.com>
Allow for "snnnnn.o" suffix when testing against NAME_MAX, and tidy
TMP_STUB handling by overwriting a prior nnnnn.o string rather than
copying the entire name.
* dlltool.c (TMP_STUB): Add "nnnnn.o" to format.
(make_one_lib_file): Localise variables. Don't copy TMP_STUB,
overwrite suffix instead.
(gen_lib_file): Similarly.
(main): Allow for max suffix when testing against NAME_MAX.
Upstream-Status: Backport
[https://github.com/bminor/binutils-gdb/commit/d0285cdf58adf04e861cd1687f7ecec65937c99d]
Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
---
binutils/dlltool.c | 64 +++++++++++++++++-----------------------------
1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 066c99a4..94f6c34b 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -498,7 +498,7 @@ char *tmp_stub_buf;
#define TMP_HEAD_O dlltmp (&tmp_head_o_buf, "%sh.o")
#define TMP_TAIL_S dlltmp (&tmp_tail_s_buf, "%st.s")
#define TMP_TAIL_O dlltmp (&tmp_tail_o_buf, "%st.o")
-#define TMP_STUB dlltmp (&tmp_stub_buf, "%ss")
+#define TMP_STUB dlltmp (&tmp_stub_buf, "%ssnnnnn.o")
/* This bit of assembly does jmp * .... */
static const unsigned char i386_jtab[] =
@@ -2401,26 +2401,11 @@ make_imp_label (const char *prefix, const char *name)
static bfd *
make_one_lib_file (export_type *exp, int i, int delay)
{
- bfd * abfd;
- asymbol * exp_label;
- asymbol * iname = 0;
- asymbol * iname2;
- asymbol * iname_lab;
- asymbol ** iname_lab_pp;
- asymbol ** iname_pp;
-#ifndef EXTRA
-#define EXTRA 0
-#endif
- asymbol * ptrs[NSECS + 4 + EXTRA + 1];
- flagword applicable;
- char * outname = xmalloc (strlen (TMP_STUB) + 10);
- int oidx = 0;
-
-
- sprintf (outname, "%s%05d.o", TMP_STUB, i);
-
- abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
+ char *outname = TMP_STUB;
+ size_t name_len = strlen (outname);
+ sprintf (outname + name_len - 7, "%05d.o", i);
+ bfd *abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
if (!abfd)
/* xgettext:c-format */
fatal (_("bfd_open failed open stub file: %s: %s"),
@@ -2437,9 +2422,13 @@ make_one_lib_file (export_type *exp, int i, int delay)
bfd_set_private_flags (abfd, F_INTERWORK);
#endif
- applicable = bfd_applicable_section_flags (abfd);
-
/* First make symbols for the sections. */
+ flagword applicable = bfd_applicable_section_flags (abfd);
+#ifndef EXTRA
+#define EXTRA 0
+#endif
+ asymbol *ptrs[NSECS + 4 + EXTRA + 1];
+ int oidx = 0;
for (i = 0; i < NSECS; i++)
{
sinfo *si = secdata + i;
@@ -2466,7 +2455,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
if (! exp->data)
{
- exp_label = bfd_make_empty_symbol (abfd);
+ asymbol *exp_label = bfd_make_empty_symbol (abfd);
exp_label->name = make_imp_label ("", exp->name);
exp_label->section = secdata[TEXT].sec;
exp_label->flags = BSF_GLOBAL;
@@ -2482,6 +2471,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
/* Generate imp symbols with one underscore for Microsoft
compatibility, and with two underscores for backward
compatibility with old versions of cygwin. */
+ asymbol *iname = NULL;
if (create_compat_implib)
{
iname = bfd_make_empty_symbol (abfd);
@@ -2491,25 +2481,24 @@ make_one_lib_file (export_type *exp, int i, int delay)
iname->value = 0;
}
- iname2 = bfd_make_empty_symbol (abfd);
+ asymbol *iname2 = bfd_make_empty_symbol (abfd);
iname2->name = make_imp_label ("__imp_", exp->name);
iname2->section = secdata[IDATA5].sec;
iname2->flags = BSF_GLOBAL;
iname2->value = 0;
- iname_lab = bfd_make_empty_symbol (abfd);
-
+ asymbol *iname_lab = bfd_make_empty_symbol (abfd);
iname_lab->name = head_label;
iname_lab->section = bfd_und_section_ptr;
iname_lab->flags = 0;
iname_lab->value = 0;
- iname_pp = ptrs + oidx;
+ asymbol **iname_pp = ptrs + oidx;
if (create_compat_implib)
ptrs[oidx++] = iname;
ptrs[oidx++] = iname2;
- iname_lab_pp = ptrs + oidx;
+ asymbol **iname_lab_pp = ptrs + oidx;
ptrs[oidx++] = iname_lab;
ptrs[oidx] = 0;
@@ -3089,29 +3078,26 @@ gen_lib_file (int delay)
if (dontdeltemps < 2)
{
- char *name;
- size_t stub_len = strlen (TMP_STUB);
+ char *name = TMP_STUB;
+ size_t name_len = strlen (name);
- name = xmalloc (stub_len + 10);
- memcpy (name, TMP_STUB, stub_len);
for (i = 0; (exp = d_exports_lexically[i]); i++)
{
/* Don't delete non-existent stubs for PRIVATE entries. */
if (exp->private)
continue;
- sprintf (name + stub_len, "%05d.o", i);
+ sprintf (name + name_len - 7, "%05d.o", i);
if (unlink (name) < 0)
/* xgettext:c-format */
non_fatal (_("cannot delete %s: %s"), name, strerror (errno));
if (ext_prefix_alias)
{
- sprintf (name + stub_len, "%05d.o", i + PREFIX_ALIAS_BASE);
+ sprintf (name + name_len - 7, "%05d.o", i + PREFIX_ALIAS_BASE);
if (unlink (name) < 0)
/* xgettext:c-format */
non_fatal (_("cannot delete %s: %s"), name, strerror (errno));
}
}
- free (name);
}
inform (_("Created lib file"));
@@ -4096,9 +4082,9 @@ main (int ac, char **av)
if (tmp_prefix == NULL)
{
/* If possible use a deterministic prefix. */
- if (imp_name || delayimp_name)
+ const char *input = imp_name ? imp_name : delayimp_name;
+ if (input && strlen (input) + sizeof ("_snnnnn.o") - 1 <= NAME_MAX)
{
- const char *input = imp_name ? imp_name : delayimp_name;
tmp_prefix = xmalloc (strlen (input) + 2);
sprintf (tmp_prefix, "%s_", input);
for (i = 0; tmp_prefix[i]; i++)
@@ -4106,9 +4092,7 @@ main (int ac, char **av)
tmp_prefix[i] = '_';
}
else
- {
- tmp_prefix = prefix_encode ("d", getpid ());
- }
+ tmp_prefix = prefix_encode ("d", getpid ());
}
mangle_defs ();
--
2.34.1

View File

@@ -0,0 +1,53 @@
Author: Alan Modra <amodra@gmail.com>
Date: Wed, 15 Jan 2025 19:13:43 +1030
PR32560 stack-buffer-overflow at objdump disassemble_bytes
There's always someone pushing the boundaries.
PR 32560
* objdump.c (MAX_INSN_WIDTH): Define.
(insn_width): Make it an unsigned long.
(disassemble_bytes): Use MAX_INSN_WIDTH to size buffer.
(main <OPTION_INSN_WIDTH>): Restrict size of insn_width.
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=baac6c221e9d69335bf41366a1c7d87d8ab2f893]
CVE: CVE-2025-0840
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 49e944b1..dba726e3 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -116,7 +116,8 @@ static bool disassemble_all; /* -D */
static int disassemble_zeroes; /* --disassemble-zeroes */
static bool formats_info; /* -i */
int wide_output; /* -w */
-static int insn_width; /* --insn-width */
+#define MAX_INSN_WIDTH 49
+static unsigned long insn_width; /* --insn-width */
static bfd_vma start_address = (bfd_vma) -1; /* --start-address */
static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */
static int dump_debugging; /* --debugging */
@@ -3327,7 +3328,7 @@ disassemble_bytes (struct disassemble_info *inf,
}
else
{
- char buf[50];
+ char buf[MAX_INSN_WIDTH + 1];
unsigned int bpc = 0;
unsigned int pb = 0;
@@ -5995,8 +5996,9 @@ main (int argc, char **argv)
break;
case OPTION_INSN_WIDTH:
insn_width = strtoul (optarg, NULL, 0);
- if (insn_width <= 0)
- fatal (_("error: instruction width must be positive"));
+ if (insn_width - 1 >= MAX_INSN_WIDTH)
+ fatal (_("error: instruction width must be in the range 1 to "
+ XSTRING (MAX_INSN_WIDTH)));
break;
case OPTION_INLINES:
unwind_inlines = true;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,840 @@
From 31e9e2e8d1090da0c1da97a70005d8841fff8ddd Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Sun, 16 Feb 2025 23:34:55 +1030
Subject: [PATCH] PR 32603, more ld -w misbehaviour
Commit 8d97c1a53f3d claimed to replace all einfo calls using %F with
a call to fatal. It did so only for the ld/ directory. This patch
adds a "fatal" to linker callbacks, and replaces those calls in bfd/
too.
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31e9e2e8d1090da0c1da97a70005d8841fff8ddd]
CVE: CVE-2025-1153
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
bfd/archive.c | 4 ++--
bfd/coff-aarch64.c | 4 +---
bfd/coffgen.c | 2 +-
bfd/elf-ifunc.c | 4 ++--
bfd/elf-m10300.c | 4 ++--
bfd/elf-properties.c | 4 ++--
bfd/elf.c | 4 ++--
bfd/elf32-arm.c | 2 +-
bfd/elf32-avr.c | 4 ++--
bfd/elf32-csky.c | 2 +-
bfd/elf32-frv.c | 4 ++--
bfd/elf32-hppa.c | 6 ++---
bfd/elf32-i386.c | 4 ++--
bfd/elf32-m68hc11.c | 2 +-
bfd/elf32-m68hc12.c | 2 +-
bfd/elf32-metag.c | 2 +-
bfd/elf32-spu.c | 5 ++--
bfd/elf64-ia64-vms.c | 4 ++--
bfd/elf64-ppc.c | 4 ++--
bfd/elf64-x86-64.c | 14 +++++------
bfd/elflink.c | 8 +++----
bfd/elfnn-aarch64.c | 6 ++---
bfd/elfnn-ia64.c | 4 ++--
bfd/elfnn-kvx.c | 2 +-
bfd/elfnn-loongarch.c | 4 ++--
bfd/elfxx-aarch64.c | 6 ++---
bfd/elfxx-sparc.c | 4 ++--
bfd/elfxx-x86.c | 56 +++++++++++++++++++++----------------------
bfd/linker.c | 2 +-
bfd/reloc.c | 4 ++--
bfd/reloc16.c | 4 ++--
bfd/xcofflink.c | 2 +-
include/bfdlink.h | 3 +++
ld/ldmain.c | 1 +
34 files changed, 94 insertions(+), 93 deletions(-)
diff --git a/bfd/archive.c b/bfd/archive.c
index 9f3fbce9..0f617276 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -749,8 +749,8 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos,
case bfd_error_system_call:
if (info != NULL)
{
- info->callbacks->einfo
- (_("%F%P: %pB(%s): error opening thin archive member: %E\n"),
+ info->callbacks->fatal
+ (_("%P: %pB(%s): error opening thin archive member: %E\n"),
archive, filename);
break;
}
diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c
index 825963c0..53f539e0 100644
--- a/bfd/coff-aarch64.c
+++ b/bfd/coff-aarch64.c
@@ -876,10 +876,8 @@ coff_pe_aarch64_relocate_section (bfd *output_bfd,
}
default:
- info->callbacks->einfo (_("%F%P: Unhandled relocation type %u\n"),
+ info->callbacks->fatal (_("%P: Unhandled relocation type %u\n"),
rel->r_type);
- BFD_FAIL ();
- return false;
}
}
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index cc1c6557..3270cd2f 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2793,7 +2793,7 @@ _bfd_coff_section_already_linked (bfd *abfd,
/* This is the first section with this name. Record it. */
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
- info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
+ info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
return false;
}
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index 42a3bcdf..58a1ca5e 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -139,9 +139,9 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
|| info->export_dynamic)
&& h->pointer_equality_needed)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
+ (_("%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
"equality in `%pB' can not be used when making an "
"executable; recompile with -fPIE and relink with -pie\n"),
h->root.root.string,
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 24ea43a7..cf6bb13b 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -2646,8 +2646,8 @@ mn10300_elf_relax_section (bfd *abfd,
bfd_vma align_gap_adjustment;
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
/* Assume nothing changes. */
*again = false;
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index ee8bd37f..a4591472 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -665,11 +665,11 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
| SEC_HAS_CONTENTS
| SEC_DATA));
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create GNU property section\n"));
+ info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
if (!bfd_set_section_alignment (sec,
elfclass == ELFCLASS64 ? 3 : 2))
- info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+ info->callbacks->fatal (_("%pA: failed to align section\n"),
sec);
elf_section_type (sec) = SHT_NOTE;
diff --git a/bfd/elf.c b/bfd/elf.c
index 8bffd3c5..8e4e1e7f 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5188,8 +5188,8 @@ _bfd_elf_map_sections_to_segments (bfd *abfd,
&& need_layout != NULL
&& bed->size_relative_relocs
&& !bed->size_relative_relocs (info, need_layout))
- info->callbacks->einfo
- (_("%F%P: failed to size relative relocations\n"));
+ info->callbacks->fatal
+ (_("%P: failed to size relative relocations\n"));
}
if (no_user_phdrs && bfd_count_sections (abfd) != 0)
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 4ad7c354..b4a822f1 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -5053,7 +5053,7 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 20e03bd7..912f7533 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -2484,8 +2484,8 @@ elf32_avr_relax_section (bfd *abfd,
shrinkable = false;
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
htab = avr_link_hash_table (link_info);
if (htab == NULL)
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 9479705d..edff65a9 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3728,7 +3728,7 @@ csky_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 5b66b074..245db7c2 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -5617,8 +5617,8 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
struct _frvfdpic_dynamic_got_plt_info gpinfo;
if (bfd_link_relocatable (info))
- (*info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
/* If we return early, we didn't change anything. */
*again = false;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index c2a7ad98..f1e67a06 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -729,7 +729,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
"section. Retry without "
"--enable-non-contiguous-regions.\n"),
hsh->target_section);
@@ -758,7 +758,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
"section. Retry without "
"--enable-non-contiguous-regions.\n"),
hsh->target_section);
@@ -839,7 +839,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
"section. Retry without "
"--enable-non-contiguous-regions.\n"),
hsh->target_section);
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index e2f88a11..1637e39f 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -4092,8 +4092,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
{
if (bfd_is_abs_section (htab->elf.splt->output_section))
{
- info->callbacks->einfo
- (_("%F%P: discarded output section: `%pA'\n"),
+ info->callbacks->fatal
+ (_("%P: discarded output section: `%pA'\n"),
htab->elf.splt);
return false;
}
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
index 5fc611f5..6f705718 100644
--- a/bfd/elf32-m68hc11.c
+++ b/bfd/elf32-m68hc11.c
@@ -419,7 +419,7 @@ m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
index 1be174c0..bdfb9ca5 100644
--- a/bfd/elf32-m68hc12.c
+++ b/bfd/elf32-m68hc12.c
@@ -539,7 +539,7 @@ m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index de14dfe5..49f93cc7 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -3342,7 +3342,7 @@ metag_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
hsh->target_section);
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 881d4d8e..dd5d5fbe 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -4689,8 +4689,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
file_err:
bfd_set_error (bfd_error_system_call);
err_exit:
- info->callbacks->einfo (_("%F%P: auto overlay error: %E\n"));
- xexit (1);
+ info->callbacks->fatal (_("%P: auto overlay error: %E\n"));
}
/* Provide an estimate of total stack required. */
@@ -4743,7 +4742,7 @@ spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
info->callbacks->einfo (_("%X%P: stack/lrlive analysis error: %E\n"));
if (!spu_elf_build_stubs (info))
- info->callbacks->einfo (_("%F%P: can not build overlay stubs: %E\n"));
+ info->callbacks->fatal (_("%P: can not build overlay stubs: %E\n"));
return bfd_elf_final_link (output_bfd, info);
}
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index 2f37e90c..b1eaaac0 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -361,8 +361,8 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
*again = false;
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
/* Don't even try to relax for non-ELF outputs. */
if (!is_elf_hash_table (link_info->hash))
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 720d6ac9..7b798732 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -12289,7 +12289,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (stub_entry->target_section != NULL
&& stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->target_section);
@@ -12297,7 +12297,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (stub_entry->group->stub_sec != NULL
&& stub_entry->group->stub_sec->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
stub_entry->group->stub_sec);
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index c3fb375c..a22d57d7 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3706,8 +3706,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|| (roff - 3 + 22) > input_section->size)
{
corrupt_input:
- info->callbacks->einfo
- (_("%F%P: corrupt input: %pB\n"),
+ info->callbacks->fatal
+ (_("%P: corrupt input: %pB\n"),
input_bfd);
return false;
}
@@ -4679,7 +4679,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
/* Check PC-relative offset overflow in PLT entry. */
if ((plt_got_pcrel_offset + 0x80000000) > 0xffffffff)
/* xgettext:c-format */
- info->callbacks->einfo (_("%F%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
+ info->callbacks->fatal (_("%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
output_bfd, h->root.root.string);
bfd_put_32 (output_bfd, plt_got_pcrel_offset,
@@ -4752,7 +4752,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
will overflow first. */
if (plt0_offset > 0x80000000)
/* xgettext:c-format */
- info->callbacks->einfo (_("%F%pB: branch displacement overflow in PLT entry for `%s'\n"),
+ info->callbacks->fatal (_("%pB: branch displacement overflow in PLT entry for `%s'\n"),
output_bfd, h->root.root.string);
bfd_put_32 (output_bfd, - plt0_offset,
(plt->contents + h->plt.offset
@@ -4805,7 +4805,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
if ((got_after_plt && got_pcrel_offset < 0)
|| (!got_after_plt && got_pcrel_offset > 0))
/* xgettext:c-format */
- info->callbacks->einfo (_("%F%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
+ info->callbacks->fatal (_("%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
output_bfd, h->root.root.string);
bfd_put_32 (output_bfd, got_pcrel_offset,
@@ -5092,8 +5092,8 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
{
if (bfd_is_abs_section (htab->elf.splt->output_section))
{
- info->callbacks->einfo
- (_("%F%P: discarded output section: `%pA'\n"),
+ info->callbacks->fatal
+ (_("%P: discarded output section: `%pA'\n"),
htab->elf.splt);
return false;
}
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8af6898a..dba176cc 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12891,8 +12891,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (info->enable_dt_relr
&& bed->finish_relative_relocs
&& !bed->finish_relative_relocs (info))
- info->callbacks->einfo
- (_("%F%P: %pB: failed to finish relative relocations\n"), abfd);
+ info->callbacks->fatal
+ (_("%P: %pB: failed to finish relative relocations\n"), abfd);
/* Since ELF permits relocations to be against local symbols, we
must have the local symbols available when we do the relocations.
@@ -14087,7 +14087,7 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
else if (strcmp (bfd_section_name (isec),
"__patchable_function_entries") == 0
&& elf_linked_to_section (isec) == NULL)
- info->callbacks->einfo (_("%F%P: %pB(%pA): error: "
+ info->callbacks->fatal (_("%P: %pB(%pA): error: "
"need linked-to section "
"for --gc-sections\n"),
isec->owner, isec);
@@ -15264,7 +15264,7 @@ _bfd_elf_section_already_linked (bfd *abfd,
/* This is the first section with this name. Record it. */
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
- info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
+ info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
return sec->output_section == bfd_abs_section_ptr;
}
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 109517db..0f454d23 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -3272,7 +3272,7 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without "
"--enable-non-contiguous-regions.\n"),
stub_entry->target_section);
@@ -9008,9 +9008,9 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_ ("%F%P: %pB: copy relocation against non-copyable "
+ (_ ("%P: %pB: copy relocation against non-copyable "
"protected symbol `%s'\n"),
p->sec->owner, h->root.root.string);
return false;
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 7081ba1b..41d9e6fe 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -361,8 +361,8 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
*again = false;
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
/* Don't even try to relax for non-ELF outputs. */
if (!is_elf_hash_table (link_info->hash))
diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c
index ae5ed6bf..b752891b 100644
--- a/bfd/elfnn-kvx.c
+++ b/bfd/elfnn-kvx.c
@@ -927,7 +927,7 @@ kvx_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign '%pA' to an output section. "
"Retry without "
"--enable-non-contiguous-regions.\n"),
stub_entry->target_section);
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index a7daea67..a8c4226d 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -1445,9 +1445,9 @@ local_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
|| info->export_dynamic)
&& h->pointer_equality_needed)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format. */
- (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
+ (_("%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
"equality in `%pB' can not be used when making an "
"executable; recompile with -fPIE and relink with -pie\n"),
h->root.root.string,
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index d1279adc..161c8a52 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -754,12 +754,12 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
| SEC_HAS_CONTENTS
| SEC_DATA));
if (sec == NULL)
- info->callbacks->einfo (
- _("%F%P: failed to create GNU property section\n"));
+ info->callbacks->fatal (
+ _("%P: failed to create GNU property section\n"));
align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3;
if (!bfd_set_section_alignment (sec, align))
- info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+ info->callbacks->fatal (_("%pA: failed to align section\n"),
sec);
elf_section_type (sec) = SHT_NOTE;
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 6f5062bb..95b1928d 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2680,8 +2680,8 @@ _bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
bool *again)
{
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
*again = false;
sec_do_relax (section) = 1;
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 8c261cf8..606c8905 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -531,9 +531,9 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
asection *s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: copy relocation against non-copyable "
+ (_("%P: %pB: copy relocation against non-copyable "
"protected symbol `%s' in %pB\n"),
p->sec->owner, h->root.root.string,
h->root.u.def.section->owner);
@@ -1030,9 +1030,9 @@ elf_x86_relative_reloc_record_add
if (relative_reloc->data == NULL)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: failed to allocate relative reloc record\n"),
+ (_("%P: %pB: failed to allocate relative reloc record\n"),
info->output_bfd);
return false;
}
@@ -1388,9 +1388,9 @@ elf64_dt_relr_bitmap_add
if (bitmap->u.elf64 == NULL)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
+ (_("%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
info->output_bfd);
}
@@ -1424,9 +1424,9 @@ elf32_dt_relr_bitmap_add
if (bitmap->u.elf32 == NULL)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
+ (_("%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
info->output_bfd);
}
@@ -1750,9 +1750,9 @@ elf_x86_compute_dl_relr_bitmap
*need_layout = true;
}
else
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: size of compact relative reloc section is "
+ (_("%P: %pB: size of compact relative reloc section is "
"changed: new (%lu) != old (%lu)\n"),
info->output_bfd, htab->dt_relr_bitmap.count,
dt_relr_bitmap_count);
@@ -1772,9 +1772,9 @@ elf_x86_write_dl_relr_bitmap (struct bfd_link_info *info,
contents = (unsigned char *) bfd_alloc (sec->owner, size);
if (contents == NULL)
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: failed to allocate compact relative reloc section\n"),
+ (_("%P: %pB: failed to allocate compact relative reloc section\n"),
info->output_bfd);
/* Cache the section contents for elf_link_input_bfd. */
@@ -2219,9 +2219,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
else
name = bfd_elf_sym_name (input_section->owner, symtab_hdr,
sym, NULL);
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: relocation %s against absolute symbol "
+ (_("%P: %pB: relocation %s against absolute symbol "
"`%s' in section `%pA' is disallowed\n"),
input_section->owner, internal_reloc.howto->name, name,
input_section);
@@ -3429,9 +3429,9 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
{
- info->callbacks->einfo
+ info->callbacks->fatal
/* xgettext:c-format */
- (_("%F%P: %pB: copy relocation against non-copyable "
+ (_("%P: %pB: copy relocation against non-copyable "
"protected symbol `%s' in %pB\n"),
p->sec->owner, h->root.root.string,
h->root.u.def.section->owner);
@@ -4138,12 +4138,12 @@ _bfd_x86_elf_link_setup_gnu_properties
| SEC_HAS_CONTENTS
| SEC_DATA));
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create GNU property section\n"));
+ info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
if (!bfd_set_section_alignment (sec, class_align))
{
error_alignment:
- info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+ info->callbacks->fatal (_("%pA: failed to align section\n"),
sec);
}
@@ -4404,7 +4404,7 @@ _bfd_x86_elf_link_setup_gnu_properties
&& !elf_vxworks_create_dynamic_sections (dynobj, info,
&htab->srelplt2))
{
- info->callbacks->einfo (_("%F%P: failed to create VxWorks dynamic sections\n"));
+ info->callbacks->fatal (_("%P: failed to create VxWorks dynamic sections\n"));
return pbfd;
}
@@ -4413,7 +4413,7 @@ _bfd_x86_elf_link_setup_gnu_properties
don't need to do it in check_relocs. */
if (htab->elf.sgot == NULL
&& !_bfd_elf_create_got_section (dynobj, info))
- info->callbacks->einfo (_("%F%P: failed to create GOT sections\n"));
+ info->callbacks->fatal (_("%P: failed to create GOT sections\n"));
got_align = (bed->target_id == X86_64_ELF_DATA) ? 3 : 2;
@@ -4431,7 +4431,7 @@ _bfd_x86_elf_link_setup_gnu_properties
/* Create the ifunc sections here so that check_relocs can be
simplified. */
if (!_bfd_elf_create_ifunc_sections (dynobj, info))
- info->callbacks->einfo (_("%F%P: failed to create ifunc sections\n"));
+ info->callbacks->fatal (_("%P: failed to create ifunc sections\n"));
plt_alignment = bfd_log2 (htab->plt.plt_entry_size);
@@ -4468,7 +4468,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".plt.got",
pltflags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create GOT PLT section\n"));
+ info->callbacks->fatal (_("%P: failed to create GOT PLT section\n"));
if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment))
goto error_alignment;
@@ -4487,7 +4487,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".plt.sec",
pltflags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create IBT-enabled PLT section\n"));
+ info->callbacks->fatal (_("%P: failed to create IBT-enabled PLT section\n"));
if (!bfd_set_section_alignment (sec, plt_alignment))
goto error_alignment;
@@ -4507,7 +4507,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".eh_frame",
flags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create PLT .eh_frame section\n"));
+ info->callbacks->fatal (_("%P: failed to create PLT .eh_frame section\n"));
if (!bfd_set_section_alignment (sec, class_align))
goto error_alignment;
@@ -4520,7 +4520,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".eh_frame",
flags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create GOT PLT .eh_frame section\n"));
+ info->callbacks->fatal (_("%P: failed to create GOT PLT .eh_frame section\n"));
if (!bfd_set_section_alignment (sec, class_align))
goto error_alignment;
@@ -4534,7 +4534,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".eh_frame",
flags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create the second PLT .eh_frame section\n"));
+ info->callbacks->fatal (_("%P: failed to create the second PLT .eh_frame section\n"));
if (!bfd_set_section_alignment (sec, class_align))
goto error_alignment;
@@ -4554,7 +4554,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".sframe",
flags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create PLT .sframe section\n"));
+ info->callbacks->fatal (_("%P: failed to create PLT .sframe section\n"));
// FIXME check this
// if (!bfd_set_section_alignment (sec, class_align))
@@ -4569,7 +4569,7 @@ _bfd_x86_elf_link_setup_gnu_properties
".sframe",
flags);
if (sec == NULL)
- info->callbacks->einfo (_("%F%P: failed to create second PLT .sframe section\n"));
+ info->callbacks->fatal (_("%P: failed to create second PLT .sframe section\n"));
htab->plt_second_sframe = sec;
}
diff --git a/bfd/linker.c b/bfd/linker.c
index 0821db55..5b912221 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -2982,7 +2982,7 @@ _bfd_generic_section_already_linked (bfd *abfd ATTRIBUTE_UNUSED,
/* This is the first section with this name. Record it. */
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
- info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
+ info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
return false;
}
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 7583b7fd..1fee86f1 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -8465,8 +8465,8 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
bool *again)
{
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
*again = false;
return true;
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index ff5412dc..a16d6b20 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -151,8 +151,8 @@ bfd_coff_reloc16_relax_section (bfd *abfd,
long reloc_count;
if (bfd_link_relocatable (link_info))
- (*link_info->callbacks->einfo)
- (_("%P%F: --relax and -r may not be used together\n"));
+ link_info->callbacks->fatal
+ (_("%P: --relax and -r may not be used together\n"));
/* We only do global relaxation once. It is not safe to do it multiple
times (see discussion of the "shrinks" array below). */
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 6ef9abcd..9b01cc37 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -4681,7 +4681,7 @@ xcoff_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (hstub->target_section != NULL
&& hstub->target_section->output_section == NULL
&& info->non_contiguous_regions)
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
"Retry without --enable-non-contiguous-regions.\n"),
hstub->target_section);
diff --git a/include/bfdlink.h b/include/bfdlink.h
index eac07d78..0d03fa70 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -868,6 +868,9 @@ struct bfd_link_callbacks
(struct bfd_link_info *, struct bfd_link_hash_entry *h,
struct bfd_link_hash_entry *inh,
bfd *abfd, asection *section, bfd_vma address, flagword flags);
+ /* Fatal error. */
+ void (*fatal)
+ (const char *fmt, ...) ATTRIBUTE_NORETURN;
/* Error or warning link info message. */
void (*einfo)
(const char *fmt, ...);
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 878d9536..a61086c3 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -146,6 +146,7 @@ static struct bfd_link_callbacks link_callbacks =
reloc_dangerous,
unattached_reloc,
notice,
+ fatal,
einfo,
info_msg,
minfo,
--
2.43.0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
From: Alan Modra <amodra@gmail.com>
Date: Thu, 10 Apr 2025 19:41:49 +0930
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=d1458933830456e54223d9fc61f0d9b3a19256f5]
CVE: CVE-2025-5244
PR32858 ld segfault on fuzzed object
We missed one place where it is necessary to check for empty groups.
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
diff --git a/bfd/elflink.c b/bfd/elflink.c
index a76e8e38da7..549b7b7dd92 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -14408,7 +14408,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
if (o->flags & SEC_GROUP)
{
asection *first = elf_next_in_group (o);
- o->gc_mark = first->gc_mark;
+ if (first != NULL)
+ o->gc_mark = first->gc_mark;
}
if (o->gc_mark)

View File

@@ -0,0 +1,38 @@
From: Alan Modra <amodra@gmail.com>
Date: Tue, 1 Apr 2025 22:36:54 +1030
PR32829, SEGV on objdump function debug_type_samep
u.kenum is always non-NULL, see debug_make_enum_type.
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6c3458a8b7ee7d39f070c7b2350851cb2110c65a]
CVE: CVE-2025-5245
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
diff --git a/binutils/debug.c b/binutils/debug.c
index dcc8ccde..465b18e7 100644
--- a/binutils/debug.c
+++ b/binutils/debug.c
@@ -2554,9 +2554,6 @@ debug_write_type (struct debug_handle *info,
case DEBUG_KIND_UNION_CLASS:
return debug_write_class_type (info, fns, fhandle, type, tag);
case DEBUG_KIND_ENUM:
- if (type->u.kenum == NULL)
- return (*fns->enum_type) (fhandle, tag, (const char **) NULL,
- (bfd_signed_vma *) NULL);
return (*fns->enum_type) (fhandle, tag, type->u.kenum->names,
type->u.kenum->values);
case DEBUG_KIND_POINTER:
@@ -3097,9 +3094,9 @@ debug_type_samep (struct debug_handle *info, struct debug_type_s *t1,
break;
case DEBUG_KIND_ENUM:
- if (t1->u.kenum == NULL)
- ret = t2->u.kenum == NULL;
- else if (t2->u.kenum == NULL)
+ if (t1->u.kenum->names == NULL)
+ ret = t2->u.kenum->names == NULL;
+ else if (t2->u.kenum->names == NULL)
ret = false;
else
{

View File

@@ -0,0 +1,39 @@
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 21 Jun 2025 06:36:56 +0800
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944]
CVE: CVE-2025-7545
Since the output section contents are copied from the input, don't
extend the output section size beyond the input section size.
PR binutils/33049
* objcopy.c (copy_section): Don't extend the output section
size beyond the input section size.
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index a85d2620..18cd1bfd 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4547,6 +4547,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
char *to = (char *) memhunk;
char *end = (char *) memhunk + size;
int i;
+ bfd_size_type memhunk_size = size;
/* If the section address is not exactly divisible by the interleave,
then we must bias the from address. If the copy_byte is less than
@@ -4566,6 +4567,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
}
size = (size + interleave - 1 - copy_byte) / interleave * copy_width;
+
+ /* Don't extend the output section size. */
+ if (size > memhunk_size)
+ size = memhunk_size;
+
osection->lma /= interleave;
if (copy_byte < extra)
osection->lma++;

View File

@@ -0,0 +1,58 @@
From 41461010eb7c79fee7a9d5f6209accdaac66cc6b Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 21 Jun 2025 06:52:00 +0800
Subject: [PATCH] elf: Report corrupted group section
Report corrupted group section instead of trying to recover.
PR binutils/33050
* elf.c (bfd_elf_set_group_contents): Report corrupted group
section.
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41461010eb7c79fee7a9d5f6209accdaac66cc6b]
CVE: CVE-2025-7546
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
---
bfd/elf.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index 14ce15c7254..ee894eb05f2 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3971,20 +3971,17 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
break;
}
- /* We should always get here with loc == sec->contents + 4, but it is
- possible to craft bogus SHT_GROUP sections that will cause segfaults
- in objcopy without checking loc here and in the loop above. */
- if (loc == sec->contents)
- BFD_ASSERT (0);
- else
+ /* We should always get here with loc == sec->contents + 4. Return
+ an error for bogus SHT_GROUP sections. */
+ loc -= 4;
+ if (loc != sec->contents)
{
- loc -= 4;
- if (loc != sec->contents)
- {
- BFD_ASSERT (0);
- memset (sec->contents + 4, 0, loc - sec->contents);
- loc = sec->contents;
- }
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: corrupted group section: `%pA'"),
+ abfd, sec);
+ bfd_set_error (bfd_error_bad_value);
+ *failedptr = true;
+ return;
}
H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
--
2.43.5

View File

@@ -0,0 +1,75 @@
From 5f8987d3999edb26e757115fe87be55787d510b9 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Tue, 17 Dec 2024 09:18:57 +0000
Subject: [PATCH] nm: Avoid potential segmentation fault when displaying
symbols without version info.
PR 32467
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=75086e9de1707281172cc77f178e7949a4414ed0]
CVE: CVE-2024-57360
Signed-off-by: Ashish Sharma <asharma@mvista.com>
binutils/nm.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/binutils/nm.c b/binutils/nm.c
index faf27c59b4d..0ba7604d34f 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -682,7 +682,7 @@ print_symname (const char *form, struct extended_symbol_info *info,
const char *name, bfd *abfd)
{
char *alloc = NULL;
- char *atver = NULL;
+ char *atname = NULL;
if (name == NULL)
name = info->sinfo->name;
@@ -690,9 +690,19 @@ print_symname (const char *form, struct extended_symbol_info *info,
if (!with_symbol_versions
&& bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
- atver = strchr (name, '@');
+ char *atver = strchr (name, '@');
+
if (atver)
- *atver = 0;
+ {
+ /* PR 32467 - Corrupt binaries might include an @ character in a
+ symbol name. Since non-versioned symbol names can be in
+ read-only memory (via memory mapping of a file's contents) we
+ cannot just replace the @ character with a NUL. Instead we
+ create a truncated copy of the name. */
+ atname = xstrdup (name);
+ atname [atver - name] = 0;
+ name = atname;
+ }
}
if (do_demangle && *name)
@@ -703,9 +713,7 @@ print_symname (const char *form, struct extended_symbol_info *info,
}
if (unicode_display != unicode_default)
- {
- name = convert_utf8 (name);
- }
+ name = convert_utf8 (name);
if (info != NULL && info->elfinfo && with_symbol_versions)
{
@@ -726,8 +734,8 @@ print_symname (const char *form, struct extended_symbol_info *info,
}
}
printf (form, name);
- if (atver)
- *atver = '@';
+
+ free (atname);
free (alloc);
}
--
2.43.5

View File

@@ -0,0 +1,156 @@
From f9978defb6fab0bd8583942d97c112b0932ac814 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 5 Feb 2025 11:15:11 +0000
Subject: [PATCH] Prevent illegal memory access when indexing into the
sym_hashes array of the elf bfd cookie structure.
PR 32636
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/binutils/plain/debian/patches/CVE-2025-1176.patch?h=applied/ubuntu/jammy-security&id=62a5cc5a49f4be036cf98d2b8fc7d618620ba672
Upstream commit https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=f9978defb6fab0bd8583942d97c112b0932ac814]
CVE: CVE-2025-1176
Signed-off-by: Ashish Sharma <asharma@mvista.com>
Index: binutils-2.38/bfd/elflink.c
===================================================================
--- binutils-2.38.orig/bfd/elflink.c
+++ binutils-2.38/bfd/elflink.c
@@ -62,15 +62,16 @@ struct elf_find_verdep_info
static bool _bfd_elf_fix_symbol_flags
(struct elf_link_hash_entry *, struct elf_info_failed *);
-asection *
-_bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
- unsigned long r_symndx,
- bool discard)
+static struct elf_link_hash_entry *
+get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
{
- if (r_symndx >= cookie->locsymcount
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
+ struct elf_link_hash_entry *h = NULL;
+
+ if ((r_symndx >= cookie->locsymcount
+ || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
+ /* Guard against corrupt input. See PR 32636 for an example. */
+ && r_symndx >= cookie->extsymoff)
{
- struct elf_link_hash_entry *h;
h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
@@ -78,6 +79,22 @@ _bfd_elf_section_for_symbol (struct elf_
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+
+ return h;
+}
+
+asection *
+_bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
+ unsigned long r_symndx,
+ bool discard)
+{
+ struct elf_link_hash_entry *h;
+
+ h = get_ext_sym_hash (cookie, r_symndx);
+
+ if (h != NULL)
+ {
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& discarded_section (h->root.u.def.section))
@@ -85,21 +102,20 @@ _bfd_elf_section_for_symbol (struct elf_
else
return NULL;
}
- else
- {
- /* It's not a relocation against a global symbol,
- but it could be a relocation against a local
- symbol for a discarded section. */
- asection *isec;
- Elf_Internal_Sym *isym;
- /* Need to: get the symbol; get the section. */
- isym = &cookie->locsyms[r_symndx];
- isec = bfd_section_from_elf_index (cookie->abfd, isym->st_shndx);
- if (isec != NULL
- && discard ? discarded_section (isec) : 1)
- return isec;
- }
+ /* It's not a relocation against a global symbol,
+ but it could be a relocation against a local
+ symbol for a discarded section. */
+ asection *isec;
+ Elf_Internal_Sym *isym;
+
+ /* Need to: get the symbol; get the section. */
+ isym = &cookie->locsyms[r_symndx];
+ isec = bfd_section_from_elf_index (cookie->abfd, isym->st_shndx);
+ if (isec != NULL
+ && discard ? discarded_section (isec) : 1)
+ return isec;
+
return NULL;
}
@@ -13642,22 +13658,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
if (r_symndx == STN_UNDEF)
return NULL;
- if (r_symndx >= cookie->locsymcount
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
+ h = get_ext_sym_hash (cookie, r_symndx);
+
+ if (h != NULL)
{
bool was_marked;
- h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
- if (h == NULL)
- {
- info->callbacks->einfo (_("%F%P: corrupt input: %pB\n"),
- sec->owner);
- return NULL;
- }
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
was_marked = h->mark;
h->mark = 1;
/* Keep all aliases of the symbol too. If an object symbol
@@ -14703,17 +14709,12 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma
if (r_symndx == STN_UNDEF)
return true;
- if (r_symndx >= rcookie->locsymcount
- || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
- {
- struct elf_link_hash_entry *h;
-
- h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
-
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ struct elf_link_hash_entry *h;
+ h = get_ext_sym_hash (rcookie, r_symndx);
+
+ if (h != NULL)
+ {
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->owner != rcookie->abfd
@@ -14737,6 +14738,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma
|| discarded_section (isec)))
return true;
}
+
return false;
}
return false;

View File

@@ -0,0 +1,38 @@
From 75086e9de1707281172cc77f178e7949a4414ed0 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 5 Feb 2025 13:26:51 +0000
Subject: [PATCH] Prevent an abort in the bfd linker when attempting to
generate dynamic relocs for a corrupt input file.
PR 32638
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=75086e9de1707281172cc77f178e7949a4414ed0]
CVE: CVE-2025-1178
Signed-off-by: Ashish Sharma <asharma@mvista.com>
bfd/elf64-x86-64.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 61334c3ab04..32db254ba6c 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -5303,6 +5303,15 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
if (generate_dynamic_reloc)
{
+ /* If the relgot section has not been created, then
+ generate an error instead of a reloc. cf PR 32638. */
+ if (relgot == NULL || relgot->size == 0)
+ {
+ info->callbacks->einfo (_("%F%pB: Unable to generate dynamic relocs because a suitable section does not exist\n"),
+ output_bfd);
+ return false;
+ }
+
if (relative_reloc_name != NULL
&& htab->params->report_relative_reloc)
_bfd_x86_elf_link_report_relative_reloc
--
2.43.5

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,269 @@
From 67e30b15212adc1502b898a1ca224fdf65dc110d Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 29 Aug 2024 08:47:00 -0700
Subject: [PATCH] x86: Check invalid TLS descriptor call TLS descriptor
call,
call *x@tlsdesc(%rax)
or
call *x@tlsdesc(%eax)
calls _dl_tlsdesc_return which expects that RAX/EAX points to the TLS
descriptor. Update x86 linker to issue an error with or without TLS
transition.
bfd/
PR ld/32123
* elf32-i386.c (elf_i386_check_tls_transition): Move
R_386_TLS_DESC_CALL to ...
(elf_i386_tls_transition): Here.
* elf64-x86-64.c (elf_x86_64_check_tls_transition): Move.
R_X86_64_TLSDESC_CALL check to ...
(elf_x86_64_tls_transition): Here.
ld/
PR ld/32123
* testsuite/ld-i386/i386.exp: Run tlsgdesc3.
* testsuite/ld-i386/tlsgdesc3.d: New file.
* testsuite/ld-x86-64/tlsdesc5.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run tlsdesc5.
(cherry picked from commit:67e30b15212adc1502b898a1ca224fdf65dc110d)
Upstream-Status: Submitted [https://sourceware.org/pipermail/binutils/2025-May/141321.html]
CVE: CVE-2025-1179
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
bfd/elf32-i386.c | 44 +++++++++++++------
bfd/elf64-x86-64.c | 71 +++++++++++++++++++------------
ld/testsuite/ld-i386/i386.exp | 1 +
ld/testsuite/ld-i386/tlsgdesc3.d | 5 +++
ld/testsuite/ld-x86-64/tlsdesc5.d | 5 +++
ld/testsuite/ld-x86-64/x86-64.exp | 1 +
6 files changed, 86 insertions(+), 41 deletions(-)
create mode 100644 ld/testsuite/ld-i386/tlsgdesc3.d
create mode 100644 ld/testsuite/ld-x86-64/tlsdesc5.d
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 18a28d2491c..9dea465f721 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1039,19 +1039,8 @@ elf_i386_check_tls_transition (asection *sec,
: elf_x86_tls_error_yes);
case R_386_TLS_DESC_CALL:
- /* Check transition from GDesc access model:
- call *x@tlsdesc(%eax)
- */
- if (offset + 2 <= sec->size)
- {
- /* Make sure that it's a call *x@tlsdesc(%eax). */
- call = contents + offset;
- return (call[0] == 0xff && call[1] == 0x10
- ? elf_x86_tls_error_none
- : elf_x86_tls_error_indirect_call);
- }
-
- return elf_x86_tls_error_yes;
+ /* It has been checked in elf_i386_tls_transition. */
+ return elf_x86_tls_error_none;
default:
abort ();
@@ -1077,6 +1066,8 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
unsigned int to_type = from_type;
bool check = true;
unsigned int to_le_type, to_ie_type;
+ bfd_vma offset;
+ bfd_byte *call;
/* Skip TLS transition for functions. */
if (h != NULL
@@ -1098,9 +1089,34 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
switch (from_type)
{
+ case R_386_TLS_DESC_CALL:
+ /* Check valid GDesc call:
+ call *x@tlsdesc(%eax)
+ */
+ offset = rel->r_offset;
+ call = NULL;
+ if (offset + 2 <= sec->size)
+ {
+ /* Make sure that it's a call *x@tlsdesc(%eax). */
+ call = contents + offset;
+ if (call[0] != 0xff || call[1] != 0x10)
+ call = NULL;
+ }
+
+ if (call == NULL)
+ {
+ _bfd_x86_elf_link_report_tls_transition_error
+ (info, abfd, sec, symtab_hdr, h, sym, rel,
+ "R_386_TLS_DESC_CALL", NULL,
+ elf_x86_tls_error_indirect_call);
+
+ return false;
+ }
+
+ /* Fall through. */
+
case R_386_TLS_GD:
case R_386_TLS_GOTDESC:
- case R_386_TLS_DESC_CALL:
case R_386_TLS_IE_32:
case R_386_TLS_IE:
case R_386_TLS_GOTIE:
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index f116e423f61..7af2e607b02 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1409,32 +1409,8 @@ elf_x86_64_check_tls_transition (bfd *abfd,
: elf_x86_tls_error_yes);
case R_X86_64_TLSDESC_CALL:
- /* Check transition from GDesc access model:
- call *x@tlsdesc(%rax) <--- LP64 mode.
- call *x@tlsdesc(%eax) <--- X32 mode.
- */
- if (offset + 2 <= sec->size)
- {
- unsigned int prefix;
- call = contents + offset;
- prefix = 0;
- if (!ABI_64_P (abfd))
- {
- /* Check for call *x@tlsdesc(%eax). */
- if (call[0] == 0x67)
- {
- prefix = 1;
- if (offset + 3 > sec->size)
- return elf_x86_tls_error_yes;
- }
- }
- /* Make sure that it's a call *x@tlsdesc(%rax). */
- return (call[prefix] == 0xff && call[1 + prefix] == 0x10
- ? elf_x86_tls_error_none
- : elf_x86_tls_error_indirect_call);
- }
-
- return elf_x86_tls_error_yes;
+ /* It has been checked in elf_x86_64_tls_transition. */
+ return elf_x86_tls_error_none;
default:
abort ();
@@ -1459,6 +1435,8 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
unsigned int from_type = *r_type;
unsigned int to_type = from_type;
bool check = true;
+ bfd_vma offset;
+ bfd_byte *call;
/* Skip TLS transition for functions. */
if (h != NULL
@@ -1468,10 +1446,49 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
switch (from_type)
{
+ case R_X86_64_TLSDESC_CALL:
+ /* Check valid GDesc call:
+ call *x@tlsdesc(%rax) <--- LP64 mode.
+ call *x@tlsdesc(%eax) <--- X32 mode.
+ */
+ offset = rel->r_offset;
+ call = NULL;
+ if (offset + 2 <= sec->size)
+ {
+ unsigned int prefix;
+ call = contents + offset;
+ prefix = 0;
+ if (!ABI_64_P (abfd))
+ {
+ /* Check for call *x@tlsdesc(%eax). */
+ if (call[0] == 0x67)
+ {
+ prefix = 1;
+ if (offset + 3 > sec->size)
+ call = NULL;
+ }
+ }
+
+ /* Make sure that it's a call *x@tlsdesc(%rax). */
+ if (call != NULL
+ && (call[prefix] != 0xff || call[1 + prefix] != 0x10))
+ call = NULL;
+ }
+
+ if (call == NULL)
+ {
+ _bfd_x86_elf_link_report_tls_transition_error
+ (info, abfd, sec, symtab_hdr, h, sym, rel,
+ "R_X86_64_TLSDESC_CALL", NULL,
+ elf_x86_tls_error_indirect_call);
+ return false;
+ }
+
+ /* Fall through. */
+
case R_X86_64_TLSGD:
case R_X86_64_GOTPC32_TLSDESC:
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
- case R_X86_64_TLSDESC_CALL:
case R_X86_64_GOTTPOFF:
case R_X86_64_CODE_4_GOTTPOFF:
case R_X86_64_CODE_6_GOTTPOFF:
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index a8db2c713f3..41e8725d059 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -543,6 +543,7 @@ run_dump_test "pr27998a"
run_dump_test "pr27998b"
run_dump_test "tlsgdesc1"
run_dump_test "tlsgdesc2"
+run_dump_test "tlsgdesc3"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
diff --git a/ld/testsuite/ld-i386/tlsgdesc3.d b/ld/testsuite/ld-i386/tlsgdesc3.d
new file mode 100644
index 00000000000..f2c29d880f2
--- /dev/null
+++ b/ld/testsuite/ld-i386/tlsgdesc3.d
@@ -0,0 +1,5 @@
+#source: tlsgdesc2.s
+#name: TLS GDesc call (indirect CALL)
+#as: --32
+#ld: -shared -melf_i386
+#error: .*: relocation R_386_TLS_DESC_CALL against `foo' must be used in indirect CALL with EAX register only
diff --git a/ld/testsuite/ld-x86-64/tlsdesc5.d b/ld/testsuite/ld-x86-64/tlsdesc5.d
new file mode 100644
index 00000000000..6a0158b44b7
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/tlsdesc5.d
@@ -0,0 +1,5 @@
+#source: tlsdesc4.s
+#name: TLS GDesc call (indirect CALL)
+#as: --64
+#ld: -shared -melf_x86_64
+#error: .*: relocation R_X86_64_TLSDESC_CALL against `foo' must be used in indirect CALL with RAX register only
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 811813466f8..82b0520c52a 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -744,6 +744,7 @@ run_dump_test "pr29820"
run_dump_test "tlsie5"
run_dump_test "tlsdesc3"
run_dump_test "tlsdesc4"
+run_dump_test "tlsdesc5"
proc undefined_weak {cflags ldflags} {
set testname "Undefined weak symbol"
--
2.49.0

View File

@@ -0,0 +1,151 @@
Backported of:
From 18cc11a2771d9e40180485da9a4fb660c03efac3 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 5 Feb 2025 14:31:10 +0000
Subject: [PATCH] Prevent illegal memory access when checking relocs in a
corrupt ELF binary.
PR 32641
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/binutils/plain/debian/patches/CVE-2025-1181-pre.patch?h=applied/ubuntu/noble-security&id=d6b5bf57cf048c42e4bcd3a4ab32116d0b809774]
Upstream commit [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=931494c9a89558acb36a03a340c01726545eef24]
CVE: CVE-2025-1181
Signed-off-by: Ashish Sharma <asharma@mvista.com>
bfd/elf-bfd.h | 3 +++
bfd/elf64-x86-64.c | 10 +++++-----
bfd/elflink.c | 24 ++++++++++++++++++++++++
bfd/elfxx-x86.c | 20 +++++++-------------
4 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3ed22fa6..07add7d0 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -3126,6 +3126,9 @@ extern bool _bfd_elf_maybe_set_textrel
extern bool _bfd_elf_add_dynamic_tags
(bfd *, struct bfd_link_info *, bool);
+extern struct elf_link_hash_entry * _bfd_elf_get_link_hash_entry
+ (struct elf_link_hash_entry **, unsigned int, Elf_Internal_Shdr *);
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index d0d3b0e5..c3fb375c 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1665,7 +1665,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
bool to_reloc_pc32;
bool abs_symbol;
bool local_ref;
- asection *tsec;
+ asection *tsec = NULL;
bfd_signed_vma raddend;
unsigned int opcode;
unsigned int modrm;
@@ -1831,6 +1831,9 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
return true;
}
+ if (tsec == NULL)
+ return false;
+
/* Don't convert GOTPCREL relocation against large section. */
if (elf_section_data (tsec) != NULL
&& (elf_section_flags (tsec) & SHF_X86_64_LARGE) != 0)
@@ -2127,10 +2130,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
else
{
isym = NULL;
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
}
/* Check invalid x32 relocations. */
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 11ec6bd9..e5521d7b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -49,6 +49,27 @@ struct elf_info_failed
static bool _bfd_elf_fix_symbol_flags
(struct elf_link_hash_entry *, struct elf_info_failed *);
+struct elf_link_hash_entry *
+_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
+ unsigned int symndx,
+ Elf_Internal_Shdr * symtab_hdr)
+{
+ if (symndx < symtab_hdr->sh_info)
+ return NULL;
+
+ struct elf_link_hash_entry *h = sym_hashes[symndx - symtab_hdr->sh_info];
+
+ /* The hash might be empty. See PR 32641 for an example of this. */
+ if (h == NULL)
+ return NULL;
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ return h;
+}
+
static struct elf_link_hash_entry *
get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
{
@@ -62,6 +83,9 @@ get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
+ if (h == NULL)
+ return NULL;
+
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 508fd771..8c261cf8 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -972,15 +972,7 @@ _bfd_x86_elf_check_relocs (bfd *abfd,
goto error_return;
}
- if (r_symndx < symtab_hdr->sh_info)
- h = NULL;
- else
- {
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
- }
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
if (X86_NEED_DYNAMIC_RELOC_TYPE_P (is_x86_64, r_type)
&& NEED_DYNAMIC_RELOCATION_P (is_x86_64, info, true, h, sec,
@@ -1205,10 +1197,12 @@ _bfd_x86_elf_link_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
else
{
/* Get H and SEC for GENERATE_DYNAMIC_RELOCATION_P below. */
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
+ if (h == NULL)
+ {
+ /* FIXMEL: Issue an error message ? */
+ continue;
+ }
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)

View File

@@ -0,0 +1,345 @@
Backported of:
From 931494c9a89558acb36a03a340c01726545eef24 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 5 Feb 2025 15:43:04 +0000
Subject: [PATCH] Add even more checks for corrupt input when processing
relocations for ELF files.
PR 32643
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/binutils/plain/debian/patches/CVE-2025-1181.patch?h=applied/ubuntu/noble-security&id=d6b5bf57cf048c42e4bcd3a4ab32116d0b809774]
Upstream commit [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=931494c9a89558acb36a03a340c01726545eef24]
CVE: CVE-2025-1181
Signed-off-by: Ashish Sharma <asharma@mvista.com>
diff --git a/bfd/elflink.c b/bfd/elflink.c
index e5521d7b..ff84229c 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -49,15 +49,17 @@ struct elf_info_failed
static bool _bfd_elf_fix_symbol_flags
(struct elf_link_hash_entry *, struct elf_info_failed *);
-struct elf_link_hash_entry *
-_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
- unsigned int symndx,
- Elf_Internal_Shdr * symtab_hdr)
+static struct elf_link_hash_entry *
+get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
+ unsigned int symndx,
+ unsigned int ext_sym_start)
{
- if (symndx < symtab_hdr->sh_info)
+ if (sym_hashes == NULL
+ /* Guard against corrupt input. See PR 32636 for an example. */
+ || symndx < ext_sym_start)
return NULL;
- struct elf_link_hash_entry *h = sym_hashes[symndx - symtab_hdr->sh_info];
+ struct elf_link_hash_entry *h = sym_hashes[symndx - ext_sym_start];
/* The hash might be empty. See PR 32641 for an example of this. */
if (h == NULL)
@@ -70,29 +72,28 @@ _bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
return h;
}
-static struct elf_link_hash_entry *
-get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
+struct elf_link_hash_entry *
+_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
+ unsigned int symndx,
+ Elf_Internal_Shdr * symtab_hdr)
{
- struct elf_link_hash_entry *h = NULL;
-
- if ((r_symndx >= cookie->locsymcount
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
- /* Guard against corrupt input. See PR 32636 for an example. */
- && r_symndx >= cookie->extsymoff)
- {
-
- h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
-
- if (h == NULL)
- return NULL;
+ if (symtab_hdr == NULL)
+ return NULL;
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ return get_link_hash_entry (sym_hashes, symndx, symtab_hdr->sh_info);
+}
- }
+static struct elf_link_hash_entry *
+get_ext_sym_hash_from_cookie (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
+{
+ if (cookie == NULL || cookie->sym_hashes == NULL)
+ return NULL;
+
+ if (r_symndx >= cookie->locsymcount
+ || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
+ return get_link_hash_entry (cookie->sym_hashes, r_symndx, cookie->extsymoff);
- return h;
+ return NULL;
}
asection *
@@ -102,7 +103,7 @@ _bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
{
struct elf_link_hash_entry *h;
- h = get_ext_sym_hash (cookie, r_symndx);
+ h = get_ext_sym_hash_from_cookie (cookie, r_symndx);
if (h != NULL)
{
@@ -8906,7 +8907,6 @@ set_symbol_value (bfd *bfd_with_globals,
size_t symidx,
bfd_vma val)
{
- struct elf_link_hash_entry **sym_hashes;
struct elf_link_hash_entry *h;
size_t extsymoff = locsymcount;
@@ -8929,12 +8929,12 @@ set_symbol_value (bfd *bfd_with_globals,
/* It is a global symbol: set its link type
to "defined" and give it a value. */
-
- sym_hashes = elf_sym_hashes (bfd_with_globals);
- h = sym_hashes [symidx - extsymoff];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ h = get_link_hash_entry (elf_sym_hashes (bfd_with_globals), symidx, extsymoff);
+ if (h == NULL)
+ {
+ /* FIXMEL What should we do ? */
+ return;
+ }
h->root.type = bfd_link_hash_defined;
h->root.u.def.value = val;
h->root.u.def.section = bfd_abs_section_ptr;
@@ -11405,10 +11405,19 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[symndx] == NULL))
{
- struct elf_link_hash_entry *h = sym_hashes[symndx - extsymoff];
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ struct elf_link_hash_entry *h;
+
+ h = get_link_hash_entry (sym_hashes, symndx, extsymoff);
+ if (h == NULL)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("error: %pB: unable to create group section symbol"),
+ input_bfd);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+
/* Arrange for symbol to be output. */
h->indx = -2;
elf_section_data (osec)->this_hdr.sh_info = -2;
@@ -11542,7 +11551,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[r_symndx] == NULL))
{
- h = sym_hashes[r_symndx - extsymoff];
+ h = get_link_hash_entry (sym_hashes, r_symndx, extsymoff);
/* Badly formatted input files can contain relocs that
reference non-existant symbols. Check here so that
@@ -11551,17 +11560,13 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
{
_bfd_error_handler
/* xgettext:c-format */
- (_("error: %pB contains a reloc (%#" PRIx64 ") for section %pA "
+ (_("error: %pB contains a reloc (%#" PRIx64 ") for section '%pA' "
"that references a non-existent global symbol"),
input_bfd, (uint64_t) rel->r_info, o);
bfd_set_error (bfd_error_bad_value);
return false;
}
- while (h->root.type == bfd_link_hash_indirect
- || h->root.type == bfd_link_hash_warning)
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
-
s_type = h->type;
/* If a plugin symbol is referenced from a non-IR file,
@@ -11777,7 +11782,6 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
&& flinfo->sections[r_symndx] == NULL))
{
struct elf_link_hash_entry *rh;
- unsigned long indx;
/* This is a reloc against a global symbol. We
have not yet output all the local symbols, so
@@ -11786,15 +11790,16 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
reloc to point to the global hash table entry
for this symbol. The symbol index is then
set at the end of bfd_elf_final_link. */
- indx = r_symndx - extsymoff;
- rh = elf_sym_hashes (input_bfd)[indx];
- while (rh->root.type == bfd_link_hash_indirect
- || rh->root.type == bfd_link_hash_warning)
- rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
-
- /* Setting the index to -2 tells
- elf_link_output_extsym that this symbol is
- used by a reloc. */
+ rh = get_link_hash_entry (elf_sym_hashes (input_bfd),
+ r_symndx, extsymoff);
+ if (rh == NULL)
+ {
+ /* FIXME: Generate an error ? */
+ continue;
+ }
+
+ /* Setting the index to -2 tells elf_link_output_extsym
+ that this symbol is used by a reloc. */
BFD_ASSERT (rh->indx < 0);
rh->indx = -2;
*rel_hash = rh;
@@ -13758,25 +13763,21 @@ _bfd_elf_gc_mark_hook (asection *sec,
struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
- if (h != NULL)
+ if (h == NULL)
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
+
+ switch (h->root.type)
{
- switch (h->root.type)
- {
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
- default:
- break;
- }
+ default:
+ return NULL;
}
- else
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
-
- return NULL;
}
/* Return the debug definition section. */
@@ -13825,46 +13826,49 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
if (r_symndx == STN_UNDEF)
return NULL;
- h = get_ext_sym_hash (cookie, r_symndx);
-
- if (h != NULL)
+ h = get_ext_sym_hash_from_cookie (cookie, r_symndx);
+ if (h == NULL)
{
- bool was_marked;
+ /* A corrup tinput file can lead to a situation where the index
+ does not reference either a local or an external symbol. */
+ if (r_symndx >= cookie->locsymcount)
+ return NULL;
- was_marked = h->mark;
- h->mark = 1;
- /* Keep all aliases of the symbol too. If an object symbol
- needs to be copied into .dynbss then all of its aliases
- should be present as dynamic symbols, not just the one used
- on the copy relocation. */
- hw = h;
- while (hw->is_weakalias)
- {
- hw = hw->u.alias;
- hw->mark = 1;
- }
+ return (*gc_mark_hook) (sec, info, cookie->rel, NULL,
+ &cookie->locsyms[r_symndx]);
+ }
- if (!was_marked && h->start_stop && !h->root.ldscript_def)
- {
- if (info->start_stop_gc)
- return NULL;
+ bool was_marked = h->mark;
- /* To work around a glibc bug, mark XXX input sections
- when there is a reference to __start_XXX or __stop_XXX
- symbols. */
- else if (start_stop != NULL)
- {
- asection *s = h->u2.start_stop_section;
- *start_stop = true;
- return s;
- }
- }
+ h->mark = 1;
+ /* Keep all aliases of the symbol too. If an object symbol
+ needs to be copied into .dynbss then all of its aliases
+ should be present as dynamic symbols, not just the one used
+ on the copy relocation. */
+ hw = h;
+ while (hw->is_weakalias)
+ {
+ hw = hw->u.alias;
+ hw->mark = 1;
+ }
- return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
+ if (!was_marked && h->start_stop && !h->root.ldscript_def)
+ {
+ if (info->start_stop_gc)
+ return NULL;
+
+ /* To work around a glibc bug, mark XXX input sections
+ when there is a reference to __start_XXX or __stop_XXX
+ symbols. */
+ else if (start_stop != NULL)
+ {
+ asection *s = h->u2.start_stop_section;
+ *start_stop = true;
+ return s;
+ }
}
- return (*gc_mark_hook) (sec, info, cookie->rel, NULL,
- &cookie->locsyms[r_symndx]);
+ return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
}
/* COOKIE->rel describes a relocation against section SEC, which is
@@ -14878,7 +14882,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
struct elf_link_hash_entry *h;
- h = get_ext_sym_hash (rcookie, r_symndx);
+ h = get_ext_sym_hash_from_cookie (rcookie, r_symndx);
if (h != NULL)
{

View File

@@ -0,0 +1,33 @@
From b425859021d17adf62f06fb904797cf8642986ad Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 5 Feb 2025 16:27:38 +0000
Subject: [PATCH] Fix another illegal memory access triggered by corrupt ELF
input files.
PR 32644
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=b425859021d17adf62f06fb904797cf8642986ad]
CVE: CVE-2025-1182
Signed-off-by: Ashish Sharma <asharma@mvista.com>
bfd/elflink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bfd/elflink.c b/bfd/elflink.c
index bf940942ec3..df6eb250961 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -15116,6 +15116,10 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
}
else
{
+ if (r_symndx >= rcookie->locsymcount)
+ /* This can happen with corrupt input. */
+ return false;
+
/* It's not a relocation against a global symbol,
but it could be a relocation against a local
symbol for a discarded section. */
--
2.43.5

View File

@@ -0,0 +1,80 @@
require binutils.inc
require binutils-${PV}.inc
# perl-native for pod2man for man page generation
DEPENDS += "zlib perl-native"
EXTRA_OECONF += "--with-sysroot=/ \
--enable-install-libbfd \
--enable-install-libiberty \
--enable-shared \
--with-system-zlib \
"
EXTRA_OEMAKE:append:libc-musl = "\
gt_cv_func_gnugettext1_libc=yes \
gt_cv_func_gnugettext2_libc=yes \
"
# libcollector/collector.c:547:15: error: no member named '__fprintf_chk' in 'struct CollectorUtilFuncs'
EXTRA_OECONF:append:toolchain-clang = " --disable-gprofng"
# | ../../../gprofng/libcollector/../src/collector_module.h:78:13: error: duplicate member 'pwrite'
# | ../../../gprofng/libcollector/dispatcher.c:578:8: error: 'struct sigevent' has no member named '_sigev_un'
EXTRA_OECONF:append:libc-musl = " --disable-gprofng"
EXTRA_OECONF:class-native = "--enable-targets=all \
--enable-64-bit-bfd \
--enable-install-libiberty \
--enable-install-libbfd \
--disable-gdb \
--disable-gdbserver \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
--disable-werror"
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils"
do_install:class-native () {
autotools_do_install
# Install the libiberty header
install -d ${D}${includedir}
install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
install -m 644 ${S}/include/libiberty.h ${D}${includedir}
# We only want libiberty, libbfd and libopcodes
rm -rf ${D}${bindir}
rm -rf ${D}${prefix}/${TARGET_SYS}
rm -rf ${D}${prefix}/lib/ldscripts
rm -rf ${D}${prefix}/share/info
rm -rf ${D}${prefix}/share/locale
rm -rf ${D}${prefix}/share/man
rmdir ${D}${prefix}/share || :
rmdir ${D}/${libdir}/gcc-lib || :
rmdir ${D}/${libdir}64/gcc-lib || :
rmdir ${D}/${libdir} || :
rmdir ${D}/${libdir}64 || :
}
# libctf races with libbfd
PARALLEL_MAKEINST:class-target = ""
PARALLEL_MAKEINST:class-nativesdk = ""
# Split out libbfd-*.so and libopcodes-*.so so including perf doesn't include
# extra stuff
PACKAGE_BEFORE_PN += "libbfd libopcodes gprofng"
FILES:libbfd = "${libdir}/libbfd-*.so.* ${libdir}/libbfd-*.so"
FILES:libopcodes = "${libdir}/libopcodes-*.so.* ${libdir}/libopcodes-*.so"
FILES:gprofng = "${sysconfdir}/gprofng.rc ${libdir}/gprofng/libgp-*.so ${libdir}/gprofng/libgprofng.so.* ${bindir}/gp-* ${bindir}/gprofng"
FILES:${PN}-dev += "${libdir}/libgprofng.so ${libdir}/libsframe.so"
SRC_URI:append:class-nativesdk = " file://0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch "
USE_ALTERNATIVES_FOR:class-nativesdk = ""
FILES:${PN}:append:class-nativesdk = " ${bindir}"
RDEPENDS:gprofng:class-nativesdk = " nativesdk-perl-module-bignum \
nativesdk-perl-module-bigint \
nativesdk-perl-module-math-bigint \
"
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,58 @@
From 41fdca818cdc7bd686c31aff4088b89280d71a42 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Wed, 17 Feb 2016 22:01:28 -0500
Subject: [PATCH] m4/bison-i18n.m4: add --with-bisonlocaledir to assign
BISON_LOCALEDIR
The variable BISON_LOCALEDIR is assigned only by the output of
'bison --print-localedir', we add option --with-bisonlocaledir
to assign it explicitly. It is helpful for user to split the
native compile and cross compile.
For backward compatibility, if option not used, it still
make use of the output of 'bison --print-localedir'.
Upstream-Status: Submitted [bison-patches@gnu.org]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
m4/bison-i18n.m4 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/m4/bison-i18n.m4 b/m4/bison-i18n.m4
index 8e57caf..c36f498 100644
--- a/m4/bison-i18n.m4
+++ b/m4/bison-i18n.m4
@@ -16,11 +16,16 @@ dnl sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files
dnl and defines YYENABLE_NLS if there are bison-runtime.mo files at all.
AC_DEFUN([BISON_I18N],
[
+ dnl Default is not to set bisonlocaledir
+ AC_ARG_WITH([bisonlocaledir],
+ [ --with-bisonlocaledir sets BISON_LOCALEDIR to indicate where to find the bison-runtime.mo files],
+ BISON_LOCALEDIR=$withval,
+ BISON_LOCALEDIR=)
+
if test -z "$USE_NLS"; then
echo "The BISON-I18N macro is used without being preceded by AM-GNU-GETTEXT." 1>&2
exit 1
fi
- BISON_LOCALEDIR=
BISON_USE_NLS=no
if test "$USE_NLS" = yes; then
dnl Determine bison's localedir.
@@ -28,9 +33,10 @@ AC_DEFUN([BISON_I18N],
dnl But even is YACC is called "yacc", it may be a script that invokes bison
dnl and accepts the --print-localedir option.
dnl YACC's default value is empty; BISON's default value is :.
- if (${YACC-${BISON-:}} --print-localedir) >/dev/null 2>&1; then
+ if test -z "$BISON_LOCALEDIR" -a ${YACC-${BISON-:}} --print-localedir >/dev/null 2>&1; then
BISON_LOCALEDIR=`${YACC-${BISON-:}} --print-localedir`
fi
+ AC_MSG_RESULT([$BISON_LOCALEDIR])
AC_SUBST([BISON_LOCALEDIR])
if test -n "$BISON_LOCALEDIR"; then
dnl There is no need to enable internationalization if the user doesn't
--
1.9.1

View File

@@ -0,0 +1,24 @@
The gnulib largefile macro needs updating to work with autoconf 2.73. Rather
than the full code:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/m4/largefile.m4?id=f91f633858cf132e50924224c50d6264a92caabb
Just tweak the exiting code to work with 2.73. The next bison upgrade should
update to new gnulib
Upstream-Status: Inappropriate
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Index: findutils-4.9.0/gl/m4/largefile.m4
===================================================================
--- findutils-4.9.0.orig/m4/largefile.m4
+++ findutils-4.9.0/m4/largefile.m4
@@ -26,7 +26,7 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE],
# with _TIME_BITS. Also, work around a problem in autoconf <= 2.69:
# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
# or configures them incorrectly in some cases.
-m4_version_prereq([2.70], [], [
+m4_version_prereq([2.73], [], [
# _AC_SYS_LARGEFILE_TEST_INCLUDES
# -------------------------------

View File

@@ -0,0 +1,55 @@
SUMMARY = "GNU Project parser generator (yacc replacement)"
DESCRIPTION = "Bison is a general-purpose parser generator that converts an annotated context-free grammar into \
an LALR(1) or GLR parser for that grammar. Bison is upward compatible with Yacc: all properly-written Yacc \
grammars ought to work with Bison with no change. Anyone familiar with Yacc should be able to use Bison with \
little trouble."
HOMEPAGE = "http://www.gnu.org/software/bison/"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464"
SECTION = "devel"
DEPENDS = "bison-native flex-native"
SRC_URI = "${GNU_MIRROR}/bison/bison-${PV}.tar.xz \
file://autoconf-2.73.patch \
file://add-with-bisonlocaledir.patch \
"
SRC_URI[sha256sum] = "9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2"
inherit autotools gettext texinfo
# No point in hardcoding path to m4, just use PATH
CACHED_CONFIGUREVARS = "ac_cv_path_M4=m4"
PACKAGECONFIG ??= "readline ${@ 'textstyle' if d.getVar('USE_NLS') == 'yes' else ''}"
PACKAGECONFIG:class-native ??= ""
# Make readline and textstyle optional. There are recipie for these, but leave them
# disabled for the native recipe. This prevents host contamination of the native tool.
PACKAGECONFIG[readline] = "--with-libreadline-prefix,--without-libreadline-prefix,readline"
PACKAGECONFIG[textstyle] = "--with-libtextstyle-prefix,--without-libtextstyle-prefix,gettext"
# Include the cached configure variables, configure is really good at finding
# libreadline, even if we don't want it.
CACHED_CONFIGUREVARS += "${@bb.utils.contains('PACKAGECONFIG', 'readline', '', ' \
ac_cv_header_readline_history_h=no \
ac_cv_header_readline_readline_h=no \
gl_cv_lib_readline=no', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'textstyle', '', ' \
ac_cv_libtextstyle=no', d)}"
# The automatic m4 path detection gets confused, so force the right value
acpaths = "-I ./m4"
do_compile:prepend() {
for i in mfcalc calc++ rpcalc; do mkdir -p ${B}/examples/$i; done
}
do_install:append:class-native() {
create_wrapper ${D}/${bindir}/bison \
BISON_PKGDATADIR=${STAGING_DATADIR_NATIVE}/bison
}
do_install:append:class-nativesdk() {
create_wrapper ${D}/${bindir}/bison \
BISON_PKGDATADIR=${datadir}/bison
}
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,31 @@
From 8591c1e3edaea8f17396e3d2819d9064b2818cfb Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 6 Aug 2022 20:39:01 -0700
Subject: [PATCH] Do not include linux/fs.h
This header is not needed to be included anymore, moreover it conflicts
with sys/mount.h from glibc 2.36+ see [1]
[1] https://sourceware.org/glibc/wiki/Release/2.36
Upstream-Status: Submitted [https://github.com/xrmx/bootchart/pull/99]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
collector/collector.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/collector/collector.c b/collector/collector.c
index 5055181..12738ff 100644
--- a/collector/collector.c
+++ b/collector/collector.c
@@ -34,7 +34,6 @@
#include <sys/mount.h>
#include <sys/sysmacros.h>
-#include <linux/fs.h>
#include <linux/genetlink.h>
#include <linux/taskstats.h>
#include <linux/cgroupstats.h>
--
2.37.1

View File

@@ -0,0 +1,68 @@
From 988ca784d4840c87509e770a21d5d22105af8668 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Fri, 5 Nov 2021 11:18:07 +0800
Subject: [PATCH] bootchartd.in: make sure only one bootchartd process
When boot with "init=/sbin/bootchartd" as below:
# runqemu qemux86 bootparams="init=/sbin/bootchartd"
There are two bootchartd process after boot [1].
# ps -ef | grep bootchart
root 101 1 0 03:27 ? 00:00:00 /bin/sh /sbin/bootchartd
root 103 101 8 03:27 ? 00:00:02 /lib64/bootchart/bootchart-collector 50
root 106 1 0 03:27 ? 00:00:00 /bin/sh /sbin/bootchartd
root 792 106 0 03:27 ? 00:00:00 /lib64/bootchart/bootchart-collector --usleep 1000000
root 794 725 0 03:27 ttyS0 00:00:00 grep bootchart
# /sbin/bootchartd stop
[bootchart] bootchart-collector started as pid 596 with 2 args:
[bootchart] '--dump'
[bootchart] '/tmp/bootchart.3lXpVDAq3v'
[bootchart] Extracting profile data from pid 204
[bootchart] map 0xbed9a000 -> 0xbedbb000 size: 132k from 'bed9a000' 'bedbb000'
[bootchart] read 135168 bytes of 135168
[bootchart] reading 150 chunks (of 150) ...
[bootchart] wrote 18760 kbB
[bootchart] bootchart-collector pid: 596 unmounted proc / clean exit
But there still one process exist after the above stop command finish.
# ps -ef | grep bootchartd
root 202 1 0 09:09 ? 00:00:00 /bin/sh /sbin/bootchartd
root 629 516 0 09:10 ? 00:00:00 grep bootchartd
Remove the wait_boot which used to wait the boot process to finish to
make sure only one bootchartd process and meanwhile we don't need the
wait_boot logic because we either use "/sbin/bootchartd stop" to stop
the bootchartd manually or install package bootchartd-stop-initscript
altogether with bootchart2 to stop bootchartd automatically after boot.
After patch:
# ps -ef | grep bootchart
root 101 1 0 03:36 ? 00:00:00 /bin/sh /sbin/bootchartd
root 103 101 6 03:36 ? 00:00:04 /lib64/bootchart/bootchart-collector 50
root 596 592 0 03:37 ttyS0 00:00:00 grep bootchart
[1] https://github.com/xrmx/bootchart/issues/94
Upstream-Status: Submitted [https://github.com/xrmx/bootchart/pull/95]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
bootchartd.in | 1 -
1 file changed, 1 deletion(-)
diff --git a/bootchartd.in b/bootchartd.in
index 7979ef9..f0e466d 100755
--- a/bootchartd.in
+++ b/bootchartd.in
@@ -183,7 +183,6 @@ if [ $$ -eq 1 ]; then
else # running inside the main system
echo "bootchart: no initrd used; starting"
start &
- wait_boot &
# wait a little, until the collector is going, before allowing
# the rest of the system to charge ahead, so we catch it
$USLEEP 250000
--
2.17.1

View File

@@ -0,0 +1,45 @@
From 09505532b49573663fb4ff4dad424dc2ef4c1f84 Mon Sep 17 00:00:00 2001
From: Kyle Russell <bkylerussell@gmail.com>
Date: Wed, 13 Jul 2016 17:30:00 -0400
Subject: [PATCH] collector: Allocate space on heap for chunks
Nicer for embedded devices which may have smaller stack limitations.
Upstream-Status: Submitted [https://github.com/xrmx/bootchart/pull/74]
Signed-off-by: Kyle Russell <bkylerussell@gmail.com>
---
collector/dump.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/collector/dump.c b/collector/dump.c
index e673b5b..2f094b4 100644
--- a/collector/dump.c
+++ b/collector/dump.c
@@ -184,12 +184,12 @@ static void dump_buffers (DumpState *s)
log ("reading %d chunks (of %d) ...\n", max_chunk, s->map.max_chunk);
for (i = 0; i < max_chunk; i++) {
FILE *output;
- char buffer[CHUNK_SIZE];
- Chunk *c = (Chunk *)&buffer;
+ char *buffer = malloc(CHUNK_SIZE);
+ Chunk *c = (Chunk *)buffer;
size_t addr = (size_t) s->map.chunks[i];
lseek (s->mem, addr, SEEK_SET);
- read (s->mem, &buffer, CHUNK_SIZE);
+ read (s->mem, buffer, CHUNK_SIZE);
/* log ("type: '%s' len %d\n",
c->dest_stream, (int)c->length); */
@@ -197,6 +197,7 @@ static void dump_buffers (DumpState *s)
fwrite (c->data, 1, c->length, output);
bytes_dumped += c->length;
fclose (output);
+ free(buffer);
}
log ("wrote %ld kb\n", (long)(bytes_dumped+1023)/1024);
}
--
2.7.4

View File

@@ -0,0 +1,18 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: bootchartd_stop
# Required-Start: $remote_fs $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Stop bootchartd collection
# Description: This script accompanies bootchartd from bootchart2.
# bootchartd should stop detect the end of the boot process
# automatically if a window manager is launched, but for
# command-line only operating systems, this script should be
# used instead.
### END INIT INFO
/sbin/bootchartd stop
: exit 0

View File

@@ -0,0 +1,162 @@
# Copyright (c) 2013 LG Electronics, Inc.
# Copyright (C) 2014 Intel Corp.
# This recipe creates packages for the bootchart2 system-wide profiler daemon
# and related utilities. Depending on the images you're building, additional
# configuration may be needed in order to use it.
#
# Packages:
# * bootchart2 - The daemon itself.
# * pybootchartgui - Python program to visualize and display the data
# collected by bootchart2 or compatible daemons such as the original
# bootchart.
# * bootchartd-stop-initscript - A SysV init script to stop data collection
# when booting completes (see below for details.)
#
# While bootchart2 is designed to stop collecting data roughly when the boot
# process completes, it is not exactly a stopwatch. It has a list of programs
# which are supposed signify that the boot process has completed (for example,
# openbox or gnome-shell,) but it waits a full 20 seconds after such a program
# is launched before stopping itself, to collect additional data.
#
# If you are using a window manager or GUI which isn't included in bootchart2's
# default configuration file, you should write bbappend file to amend
# bootchartd.conf and add it to EXIT_PROC. An example of this is shown in this
# recipe, where the Matchbox window manager (used by Sato) is added.
#
# If you want data collection to end at a certain point exactly, you should
# arrange for the following command to be run:
# bootchartd stop
# You might set this command to be launched by the desktop environment shipped
# on the image you're building after the other startup programs are complete.
# This will not incur the 20 second wait period and will cause bootchart2 to
# behave a bit more like a stopwatch. An example of this is shown in this
# recipe, specifically the bootchartd-stop-initscript package, which stops data
# collection as the last action when switching to runlevels 2 through 5. You can
# add bootchartd-stop-initscript to IMAGE_INSTALL if you need to use it.
#
# Unless you're doing something special, if your image does not launch an X
# window manager, you will need to add bootchartd-stop-initscript to your image.
#
# Bootchart2 can be started in two ways. Data collection can be initiated by
# running the following command:
# bootchartd start
# However, for the most complete data, the bootchart2 developers recommend
# running it as PID 1. This can be done by adding the following to the kernel
# command line parameters in the bootloader setup:
# init=/sbin/bootchartd
# When invoked this way, bootchart2 will set itself up and then automatically
# run /sbin/init. For example, when booting the default qemux86 image, one might
# use a command like this:
# runqemu qemux86 bootparams="initcall_debug printk.time=y quiet \
# init=/sbin/bootchartd"
#
# Neither method is actually implemented here, choose what works for you.
#
# If you are building your image with systemd instead of SysV init, bootchart2
# includes systemd service files to begin collection automatically at boot and
# end collection automatically 20 seconds after the boot process has completed.
# However, be aware that systemd tends to start bootchart2 relatively late into
# the boot process, so it's highly recommended to use bootchart2 as PID 1. If
# you're using systemd and you wish to use another method to stop data
# collection at a time of your choosing, you may do so as long as you get to it
# before the 20 second timeout of the systemd service files. Also, you may write
# a bbappend to patch bootchart2-done.timer.in to increase or decrease the
# timeout. Decreasing it to 0 will make it behave like
# bootchartd-stop-initscript.
#
# By default, when data collection is stopped, a file named bootchart.tgz will
# be created in /var/log. If pybootchartgui is included in your image,
# bootchart.png will also be created at the same time. However, this results in
# a noticeable hitch or pause at boot time, which may not be what you want on an
# embedded device. So you may prefer to omit pybootchartgui from your image. In
# that case, copy bootchart.tgz over to your development system and generate
# bootchart.png there. To get pybootchartgui on your development system, you can
# either install it directly from some other source, or build bootchart2-native
# and find pybootchartgui in the native sysroot:
# bitbake bootchart2-native
# ./tmp/sysroots/x86_64-linux/usr/bin/pybootchartgui /path/to/bootchart.tgz
# Note that, whether installed on your build system or on your image, the
# pybootchartgui provided by this recipe does not support the -i option. You
# will need to install pybootchartgui by other means in order to run it in
# interactive mode.
SUMMARY = "Booting sequence and CPU,I/O usage monitor"
DESCRIPTION = "Monitors where the system spends its time at start, creating a graph of all processes, disk utilization, and wait time."
HOMEPAGE = "https://github.com/mmeeks/bootchart"
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=44ac4678311254db62edf8fd39cb8124"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)"
SRC_URI = "git://github.com/xrmx/bootchart.git;branch=master;protocol=https \
file://bootchartd_stop.sh \
file://0001-collector-Allocate-space-on-heap-for-chunks.patch \
file://0001-bootchartd.in-make-sure-only-one-bootchartd-process.patch \
file://0001-Do-not-include-linux-fs.h.patch \
"
S = "${WORKDIR}/git"
SRCREV = "868a2afab9da34f32c007d773b77253c93104636"
inherit systemd update-rc.d python3native update-alternatives
ALTERNATIVE:${PN} = "bootchartd"
ALTERNATIVE_LINK_NAME[bootchartd] = "${base_sbindir}/bootchartd"
ALTERNATIVE_PRIORITY = "100"
# The only reason to build bootchart2-native is for a native pybootchartgui.
BBCLASSEXTEND = "native"
SYSTEMD_SERVICE:${PN} = "bootchart2.service bootchart2-done.service bootchart2-done.timer"
UPDATERCPN = "bootchartd-stop-initscript"
INITSCRIPT_NAME = "bootchartd_stop.sh"
INITSCRIPT_PARAMS = "start 99 2 3 4 5 ."
do_compile:prepend () {
export PY_LIBDIR="${libdir}/${PYTHON_DIR}"
export BINDIR="${bindir}"
export LIBDIR="/${baselib}"
export EARLY_PREFIX="${root_prefix}"
}
do_install () {
install -d ${D}${sysconfdir} # needed for -native
export PY_LIBDIR="${libdir}/${PYTHON_DIR}"
export BINDIR="${bindir}"
export DESTDIR="${D}"
export LIBDIR="/${baselib}"
export EARLY_PREFIX="${root_prefix}"
oe_runmake install NO_PYTHON_COMPILE=1
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/bootchartd_stop.sh ${D}${sysconfdir}/init.d
echo 'EXIT_PROC="$EXIT_PROC matchbox-window-manager"' >> ${D}${sysconfdir}/bootchartd.conf
# Use python 3 instead of python 2
sed -i -e '1s,#!.*python.*,#!${USRBINPATH}/env python3,' ${D}${bindir}/pybootchartgui
# The timestamps embedded in compressed man pages is not reproducible
gzip -d ${D}${mandir}/man1/*.gz
}
PACKAGES =+ "pybootchartgui"
FILES:pybootchartgui += "${PYTHON_SITEPACKAGES_DIR}/pybootchartgui ${bindir}/pybootchartgui"
RDEPENDS:pybootchartgui = "python3-pycairo python3-compression python3-image python3-math python3-shell python3-compression python3-codecs"
RDEPENDS:${PN}:class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}"
RDEPENDS:${PN}:class-target += "lsb-release"
DEPENDS:append:class-native = " python3-pycairo-native"
PACKAGES =+ "bootchartd-stop-initscript"
FILES:bootchartd-stop-initscript += "${sysconfdir}/init.d ${sysconfdir}/rc*.d"
RDEPENDS:bootchartd-stop-initscript = "${PN}"
FILES:${PN} += "${base_libdir}/bootchart/bootchart-collector"
FILES:${PN} += "${base_libdir}/bootchart/tmpfs"
FILES:${PN} += "${libdir}"
FILES:${PN}-doc += "${datadir}/docs"
RCONFLICTS:${PN} = "bootchart"

View File

@@ -0,0 +1,25 @@
From 980f6edc269fa3ef8d4d4b9cd1aada2328131c19 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Wed, 23 May 2018 21:20:35 +0300
Subject: [PATCH] Add a possibility to specify where python modules are
installed
Upstream-Status: Inappropriate [oe-core specific to solve multilib use case]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 374f59b9..ed083f6b 100644
--- a/Makefile
+++ b/Makefile
@@ -959,7 +959,7 @@ endif
ifeq ($(PYTHON_BINDINGS),1)
install_python: libbtrfsutil_python
$(Q)cd libbtrfsutil/python; \
- $(PYTHON) setup.py install --skip-build $(if $(DESTDIR),--root $(DESTDIR)) --prefix $(prefix)
+ $(PYTHON) setup.py install --skip-build $(if $(DESTDIR),--root $(DESTDIR)) --prefix $(prefix) --install-lib=$(PYTHON_SITEPACKAGES_DIR)
.PHONY: install_python
endif

View File

@@ -0,0 +1,72 @@
SUMMARY = "Checksumming Copy on Write Filesystem utilities"
DESCRIPTION = "Btrfs is a new copy on write filesystem for Linux aimed at \
implementing advanced features while focusing on fault tolerance, repair and \
easy administration. \
This package contains utilities (mkfs, fsck, btrfsctl) used to work with \
btrfs and an utility (btrfs-convert) to make a btrfs filesystem from an ext3."
HOMEPAGE = "https://btrfs.wiki.kernel.org"
LICENSE = "GPL-2.0-only & LGPL-2.1-or-later"
LIC_FILES_CHKSUM = " \
file://COPYING;md5=fcb02dc552a041dee27e4b85c7396067 \
file://libbtrfsutil/COPYING;md5=4fbd65380cdd255951079008b364516c \
"
SECTION = "base"
DEPENDS = "util-linux zlib"
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master;protocol=https \
file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
"
SRCREV = "60abf7a90776c2405f616182ef6129474bbcb109"
S = "${WORKDIR}/git"
PACKAGECONFIG ??= " \
programs \
convert \
python \
crypto-builtin \
"
PACKAGECONFIG[manpages] = "--enable-documentation, --disable-documentation, python3-sphinx-native python3-sphinx-rtd-theme-native"
PACKAGECONFIG[programs] = "--enable-programs,--disable-programs"
PACKAGECONFIG[convert] = "--enable-convert --with-convert=ext2,--disable-convert --without-convert,e2fsprogs"
PACKAGECONFIG[zoned] = "--enable-zoned,--disable-zoned"
PACKAGECONFIG[python] = "--enable-python,--disable-python,python3-setuptools-native"
PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd"
PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev"
# Pick only one crypto provider
PACKAGECONFIG[crypto-builtin] = "--with-crypto=builtin"
PACKAGECONFIG[crypto-libgcrypt] = "--with-crypto=libgcrypt,,libgcrypt"
PACKAGECONFIG[crypto-libsodium] = "--with-crypto=libsodium,,libsodium"
PACKAGECONFIG[crypto-libkcapi] = "--with-crypto=libkcapi,,libkcapi"
inherit autotools-brokensep pkgconfig manpages
inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'setuptools3-base', '', d)}
CLEANBROKEN = "1"
EXTRA_OECONF = "--enable-largefile"
EXTRA_OECONF:append:libc-musl = " --disable-backtrace "
EXTRA_PYTHON_CFLAGS = "${DEBUG_PREFIX_MAP}"
EXTRA_PYTHON_CFLAGS:class-native = ""
EXTRA_PYTHON_LDFLAGS = "${LDFLAGS}"
EXTRA_OEMAKE = "V=1 'EXTRA_PYTHON_CFLAGS=${EXTRA_PYTHON_CFLAGS}' 'EXTRA_PYTHON_LDFLAGS=${EXTRA_PYTHON_LDFLAGS}'"
do_configure:prepend() {
# Upstream doesn't ship this and autoreconf won't install it as automake isn't used.
mkdir -p ${S}/config
cp -f $(automake --print-libdir)/install-sh ${S}/config/
}
do_install:append() {
if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
oe_runmake 'DESTDIR=${D}' 'PYTHON_SITEPACKAGES_DIR=${PYTHON_SITEPACKAGES_DIR}' install_python
fi
}
RDEPENDS:${PN} = "libgcc"
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,26 @@
SUMMARY = "a fast C/C++ compiler cache"
DESCRIPTION = "ccache is a compiler cache. It speeds up recompilation \
by caching the result of previous compilations and detecting when the \
same compilation is being done again. Supported languages are C, C\+\+, \
Objective-C and Objective-C++."
HOMEPAGE = "http://ccache.samba.org"
SECTION = "devel"
LICENSE = "GPL-3.0-or-later"
LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=9896d6f0aee4d89b9e5ff0afaae0af06"
DEPENDS = "zstd"
SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \
file://0001-xxhash.h-Fix-build-with-gcc-12.patch \
"
SRC_URI[sha256sum] = "12834ecaaaf2db069dda1d1d991f91c19e3274cc04a471af5b64195def17e90f"
inherit cmake github-releases
PATCHTOOL = "patch"
BBCLASSEXTEND = "native nativesdk"
PACKAGECONFIG[docs] = "-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF,asciidoc"
PACKAGECONFIG[redis] = "-DREDIS_STORAGE_BACKEND=ON,-DREDIS_STORAGE_BACKEND=OFF,hiredis"

View File

@@ -0,0 +1,37 @@
From d17fdacf4892a15fafb56b0890ece05b485e89fb Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Mon, 6 Jun 2022 17:53:20 +0800
Subject: [PATCH] xxhash.h: Fix build with gcc-12
Remove inline attribute to fix below build failure:
| /buildarea/tmp/work/core2-64-poky-linux/ccache/4.6.1-r0/ccache-4.6.1/src/third_party/xxhash.h:3932:1: error: inlining failed in call to 'always_inline' 'XXH3_accumulate_512_sse2': function not considered for inlining
3932 | XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc,
| ^~~~~~~~~~~~~~~~~~~~~~~~
/buildarea/tmp/work/core2-64-poky-linux/ccache/4.6.1-r0/ccache-4.6.1/src/third_party/xxhash.h:4369:9: note: called from here
4369 | f_acc512(acc,
| ^~~~~~~~~~~~~
4370 | in,
| ~~~
4371 | secret + n*XXH_SECRET_CONSUME_RATE);
Upstream-Status: Submitted [https://github.com/Cyan4973/xxHash/pull/720]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
src/third_party/xxhash.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/third_party/xxhash.h b/src/third_party/xxhash.h
index a18e8c7..1b72307 100644
--- a/src/third_party/xxhash.h
+++ b/src/third_party/xxhash.h
@@ -2107,7 +2107,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size)
# define XXH_NO_INLINE static
/* enable inlining hints */
#elif defined(__GNUC__) || defined(__clang__)
-# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused))
+# define XXH_FORCE_INLINE static
# define XXH_NO_INLINE static __attribute__((noinline))
#elif defined(_MSC_VER) /* Visual Studio */
# define XXH_FORCE_INLINE static __forceinline

View File

@@ -0,0 +1,45 @@
# cdrtools-native OE build file
# Copyright (C) 2004-2006, Advanced Micro Devices, Inc. All Rights Reserved
# Released under the MIT license (see packages/COPYING)
SUMMARY = "A set of tools for CD recording, including cdrecord"
HOMEPAGE = "http://sourceforge.net/projects/cdrtools/"
DESCRIPTION = "cdrecord tool is Highly portable CD/DVD/BluRay command line recording software."
SECTION = "console/utils"
LICENSE = "GPL-2.0-only & CDDL-1.0 & LGPL-2.1-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=32f68170be424c2cd64804337726b312"
DEPENDS += "gnu-config-native"
SRC_URI = " \
${SOURCEFORGE_MIRROR}/project/cdrtools/cdrtools-${PV}.tar.bz2 \
file://0001-Don-t-set-uid-gid-during-install.patch \
file://riscv64-linux-gcc.rul \
file://gcc14-fix.patch \
"
SRC_URI[md5sum] = "7d45c5b7e1f78d85d1583b361aee6e8b"
SRC_URI[sha256sum] = "ed282eb6276c4154ce6a0b5dee0bdb81940d0cbbfc7d03f769c4735ef5f5860f"
EXTRA_OEMAKE = "-e MAKEFLAGS= CPPOPTX='${CPPFLAGS}' COPTX='${CFLAGS}' C++OPTX='${CXXFLAGS}' LDOPTX='${LDFLAGS}' GMAKE_NOWARN='true'"
# Stop failures when 'cc' can't be found
export ac_cv_prog_CC = "${CC}"
inherit native
# Use -std=gnu89 to build with gcc-14 (https://bugs.gentoo.org/903876)
# this needs to be after native inherit (which sets CFLAGS to BUILD_CFLAGS)
CFLAGS += "-std=gnu89"
do_configure() {
# cdda2wav does not build with GCC 14
rm -f ${S}/TARGETS/55cdda2wav
install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/autoconf
install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/autoconf
install -m 0644 ${WORKDIR}/riscv64-linux-gcc.rul ${S}/RULES/
}
do_install() {
make install GMAKE_NOWARN=true INS_BASE=${prefix} DESTDIR=${D}
}

View File

@@ -0,0 +1,27 @@
From 529cd5b007aa681c3ca14e5ab1e30469dd51646b Mon Sep 17 00:00:00 2001
From: Paul Barker <paul@betafive.co.uk>
Date: Tue, 12 Nov 2019 22:17:19 +0000
Subject: [PATCH] Don't set uid/gid during install
Signed-off-by: Paul Barker <paul@betafive.co.uk>
Upstream-Status: Inappropriate [native]
---
RULES/rules.prg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RULES/rules.prg b/RULES/rules.prg
index 023555c..f70f1a7 100644
--- a/RULES/rules.prg
+++ b/RULES/rules.prg
@@ -94,7 +94,7 @@ INSGRP= $(__DEFINSGRP:$(_UNIQ)%=%)
LD= @echo " ==> LINKING \"$@\""; ld
LOCALIZE= @echo " ==> LOCALIZING \"$@\""; $(RM_F) $@; cp
-INSTALL= @echo " ==> INSTALLING \"$@\""; sh $(SRCROOT)/conf/install-sh -c -m $(INSMODEINS) -o $(INSUSR) -g $(INSGRP)
+INSTALL= @echo " ==> INSTALLING \"$@\""; sh $(SRCROOT)/conf/install-sh -c -m $(INSMODEINS)
CHMOD= @echo " ==> SETTING PERMISSIONS ON \"$@\""; chmod
CHOWN= @echo " ==> SETTING OWNER ON \"$@\""; chown
CHGRP= @echo " ==> SETTING GROUP ON \"$@\""; chgrp
--
2.24.0

View File

@@ -0,0 +1,13 @@
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Upstream-Status: Inappropriate [native]
--- cdrtools-3.01/autoconf/configure~ 2015-07-06 23:41:27.000000000 +0200
+++ cdrtools-3.01/autoconf/configure 2024-05-01 09:37:40.897253690 +0200
@@ -1205,7 +1205,7 @@
#line 1206 "configure"
#include "confdefs.h"
-main(){return(0);}
+int main(){return(0);}
EOF
if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes

View File

@@ -0,0 +1,65 @@
#ident "@(#)i586-linux-gcc.rul 1.18 18/11/07 "
###########################################################################
# Written 1996-2018 by J. Schilling
###########################################################################
#
# Platform dependent MACROS for Linux
#
###########################################################################
# Copyright (c) J. Schilling
###########################################################################
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# See the file CDDL.Schily.txt in this distribution for details.
# A copy of the CDDL is also available via the Internet at
# http://www.opensource.org/licenses/cddl1.txt
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file CDDL.Schily.txt from this distribution.
###########################################################################
include $(SRCROOT)/$(RULESDIR)/rules.prg
###########################################################################
include $(SRCROOT)/$(RULESDIR)/cc-$(C_ARCH).rul
#
# LINUX_SRC_INCLUDE is defined in DEFAULTS/Defaults.linux
#
INCDIRSX += $(LINUX_SRC_INCLUDE)
OSDEFS +=
KDEFINES= -DKERNEL -D_KERNEL
LIB_PREFIX= lib
LIB_SUFFIX= .a
SHL_SUFFIX= .so.$(DYNMAJOR).$(DYNMINOR)
LIB_SOCKET=
LIB_MATH= -lm
LIB_KVM=
#
# Sunpro C/C++ run on Solaris and Linux and both have linkers
# that support mapfiles
#
MAPVERS= $(_MAPVERS) # This enables to use mapfiles
#
# The GNU linker is buggy and does not like the official order in linker map
# files for symbol versioning. The following command reverses the order of
# the version names in the linker map file.
#
MAPFILE_POST= | sed 's/^SCHILY/+SCHILY/' | tr '\012' '@' | tr '+' '\012' | sort -V | tr '@' '\012'
#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH:-R%=-Wl,-R%)
#
# Uncomment the next line in case you are on an old Linux version that
# does not support the -R linker flag.
#
#LDOPTS= $(LIBS_PATH) $(LDPATH)
LDOPTMAP= $(PMAPVERS:%=-Wl,--version-script=%)
LDOPTDYN= -shared -Wl,-soname,$(TARGET) $(LDOPTMAP)
LORDER= echo
TSORT= cat

View File

@@ -0,0 +1,32 @@
From 285b5fbf1d6b25ff55d305c17edf4d327bf19dd3 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Tue, 5 Jul 2011 23:42:29 +0100
Subject: [PATCH] chrpath: Ensure the package respects the docdir variable
autoconf/automake set docdir automatically, use their value ensuring
doc files are placed into $datadir/doc, not $prefix/doc.
RP 5/7/2011
Upstream-Status: Submitted [ http://lists.alioth.debian.org/pipermail/chrpath-devel/Week-of-Mon-20170710/000013.html ]
Signed-off-by: Dengke Du <dengke.du@windriver.com>
---
Makefile.am | 2 --
1 file changed, 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b50ad21..5f7e861 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,5 @@
SUBDIRS = testsuite deb
-docdir = $(prefix)/doc/$(PACKAGE)-$(VERSION)
-
doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README
bin_PROGRAMS = chrpath
--
2.8.1

View File

@@ -0,0 +1,24 @@
SUMMARY = "Tool to edit rpath in ELF binaries"
DESCRIPTION = "chrpath allows you to change the rpath (where the \
application looks for libraries) in an application. It does not \
(yet) allow you to add an rpath if there isn't one already."
HOMEPAGE = "https://tracker.debian.org/pkg/chrpath"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
SRC_URI = "${DEBIAN_MIRROR}/main/c/${BPN}/${BPN}_${PV}.orig.tar.gz \
file://standarddoc.patch"
SRC_URI[md5sum] = "2bf8d1d1ee345fc8a7915576f5649982"
SRC_URI[sha256sum] = "bb0d4c54bac2990e1bdf8132f2c9477ae752859d523e141e72b3b11a12c26e7b"
inherit autotools
# We don't have a staged chrpath-native for ensuring our binary is
# relocatable, so use the one we've just built
CHRPATH_BIN:class-native = "${B}/chrpath"
PROVIDES:append:class-native = " chrpath-replacement-native"
NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}"
BBCLASSEXTEND = "native nativesdk"

View File

@@ -0,0 +1,67 @@
require cmake.inc
inherit native
DEPENDS += "bzip2-replacement-native xz-native zlib-native ncurses-native zstd-native openssl-native"
SRC_URI += "file://OEToolchainConfig.cmake \
file://environment.d-cmake.sh \
file://0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch \
file://0001-CMakeLists.txt-disable-USE_NGHTTP2.patch \
"
LICENSE:append = " & BSD-1-Clause & MIT & BSD-2-Clause & curl"
LIC_FILES_CHKSUM:append = " \
file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \
file://Utilities/cmlibarchive/COPYING;md5=d499814247adaee08d88080841cb5665 \
file://Utilities/cmexpat/COPYING;md5=9e2ce3b3c4c0f2670883a23bbd7c37a9 \
file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \
file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \
file://Utilities/cmcurl/COPYING;md5=db8448a1e43eb2125f7740fc397db1f6 \
"
B = "${WORKDIR}/build"
do_configure[cleandirs] = "${B}"
CMAKE_EXTRACONF = "\
-DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \
-DBUILD_CursesDialog=1 \
-DCMAKE_USE_SYSTEM_LIBRARIES=1 \
-DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_CPPDAP=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_EXPAT=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_CURL=0 \
-DENABLE_ACL=0 -DHAVE_ACL_LIBACL_H=0 \
-DHAVE_SYS_ACL_H=0 \
"
do_configure () {
${S}/bootstrap --verbose --prefix=${prefix} \
${@oe.utils.parallel_make_argument(d, '--parallel=%d')} \
${@bb.utils.contains('CCACHE', 'ccache ', '--enable-ccache', '', d)} \
-- ${CMAKE_EXTRACONF}
}
do_compile() {
oe_runmake
}
do_install() {
oe_runmake 'DESTDIR=${D}' install
# The following codes are here because eSDK needs to provide compatibility
# for SDK. That is, eSDK could also be used like traditional SDK.
mkdir -p ${D}${datadir}/cmake
install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/
mkdir -p ${D}${base_prefix}/environment-setup.d
install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${base_prefix}/environment-setup.d/cmake.sh
# Help docs create tons of files in the native sysroot and aren't needed there
rm -rf ${D}${datadir}/cmake-*/Help
}
do_compile[progress] = "percent"
SYSROOT_DIRS_NATIVE += "${datadir}/cmake ${base_prefix}/environment-setup.d"

View File

@@ -0,0 +1,27 @@
# Copyright (C) 2005, Koninklijke Philips Electronics NV. All Rights Reserved
# Released under the MIT license (see packages/COPYING)
SUMMARY = "Cross-platform, open-source make system"
DESCRIPTION = "CMake is used to control the software compilation process \
using simple platform and compiler independent configuration files. CMake \
generates native makefiles and workspaces that can be used in the compiler \
environment of your choice."
HOMEPAGE = "http://www.cmake.org/"
BUGTRACKER = "http://public.kitware.com/Bug/my_view_page.php"
SECTION = "console/utils"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://Copyright.txt;md5=9d3d12c5f3b4c1f83650adcc65b59c06 \
file://Source/cmake.h;beginline=1;endline=2;md5=a5f70e1fef8614734eae0d62b4f5891b \
"
CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \
file://0001-CMakeDetermineCompilerABI-Strip-pipe-from-compile-fl.patch \
"
SRC_URI[sha256sum] = "72b7570e5c8593de6ac4ab433b73eab18c5fb328880460c86ce32608141ad5c1"
UPSTREAM_CHECK_REGEX = "cmake-(?P<pver>\d+(\.\d+)+)\.tar"
CVE_STATUS[CVE-2016-10642] = "cpe-incorrect: This is specific to the npm package that installs cmake, so isn't relevant to OpenEmbedded"

View File

@@ -0,0 +1,52 @@
From bd94bbdc35a9da4c73d538e0cc55bc95944f620d Mon Sep 17 00:00:00 2001
From: Philip Lorenz <philip.lorenz@bmw.de>
Date: Mon, 3 Jun 2024 13:19:24 +0200
Subject: [PATCH] CMakeDetermineCompilerABI: Strip -pipe from compile flags
When `-pipe` is enabled, GCC passes data between its different
executables using pipes instead of temporary files. This leads to issues
when cmake attempts to infer compiler internals via the `-v` parameter
as each executable will print to `stderr` in parallel.
For example we have observed the following outputs in our builds which
sporadically lead to build failures as system include directories were
not detected reliably:
Parsed CXX implicit include dir info from above output: rv=done
found start of include info
found start of implicit include info
add: [.../usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/11.4.0/include]
add: [.../usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/11.4.0/include-fixed]
add: [.../usr/include/c++/11.4.0]
add: [.../usr/include/c++/11.4.0/x86_64-poky-linux]
add: [.../usr/include/c++/11.4.0/backward]
add: [.../usr/lib/x86_64-poky-linux/11.4.0/include]
add: [...GNU assembler version 2.38 (x86_64-poky-linux) using BFD version (GNU Binutils) 2.38.20220708]
add: [/usr/include]
end of search list found
Fix this issue by stripping the `-pipe` parameter from the compilation
flag when determining the toolchain configuration.
Upstream-Status: Backport [3.32.0, 71be059f3f32b6791427893a48ba4815a19e2e78]
Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
---
Modules/CMakeDetermineCompilerABI.cmake | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index efc18f93c2..f2e40479b1 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -43,6 +43,11 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# Avoid failing ABI detection on warnings.
string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
+ # Avoid passing of "-pipe" when determining the compiler internals. With
+ # "-pipe" GCC will use pipes to pass data between the involved
+ # executables. This may lead to issues when their stderr output (which
+ # contains the relevant compiler internals) becomes interweaved.
+ string(REGEX REPLACE "(^| )-pipe( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
# and set them to "C" that way GCC's "search starts here" text is in

View File

@@ -0,0 +1,35 @@
From d33d8a5e9f3b25a80d47b72b1a8a6624a85563c1 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Wed, 28 Dec 2022 17:51:27 +0800
Subject: [PATCH] CMakeLists.txt: disable USE_NGHTTP2
nghttp2 depends on cmake-native to build, to break circular
dependency, disable nghttp2.
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Adjust the patch to apply on top of v3.28.3.
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
Utilities/cmcurl/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 9387247366..d3de01f4e8 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -88,7 +88,7 @@ set(HTTP_ONLY OFF CACHE INTERNAL "Curl is not http-only")
set(PICKY_COMPILER OFF CACHE INTERNAL "Enable picky compiler options")
set(SHARE_LIB_OBJECT OFF)
set(USE_LIBIDN2 ON)
-set(USE_NGHTTP2 ON)
+set(USE_NGHTTP2 OFF)
set(USE_NGTCP2 OFF)
set(USE_QUICHE OFF)
set(USE_WIN32_IDN OFF)
--
2.43.0

View File

@@ -0,0 +1,205 @@
From 49576cf1df618609be4aa1000749ad087c143df0 Mon Sep 17 00:00:00 2001
From: John Drouhard <john@drouhard.dev>
Date: Thu, 9 Jan 2025 20:34:42 -0600
Subject: [PATCH] ctest: Allow arbitrary characters in test names of
CTestCostData.txt
This changes the way lines in CTestCostData.txt are parsed to allow for
spaces in the test name.
It does so by looking for space characters from the end; and once two
have been found, assumes everything from the beginning up to that
second-to-last-space is the test name.
Additionally, parsing the file should be much more efficient since there
is no string or vector heap allocation per line. The std::string used by
the parse function to convert the int and float should be within most
standard libraries' small string optimization.
Fixes: #26594
Upstream-Status: Backport [4.0.0, 040da7d83216ace59710407e8ce35d5fd38e1340]
Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
---
Source/CTest/cmCTestMultiProcessHandler.cxx | 80 +++++++++++++++------
Source/CTest/cmCTestMultiProcessHandler.h | 3 +-
Tests/CTestTestScheduler/CMakeLists.txt | 4 +-
3 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index ca07a081eafced40697d82b08c0e2a504939fc4d..59a101454b84367d219e79a01ff72702df0dfa7f 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -20,6 +20,7 @@
#include <cm/memory>
#include <cm/optional>
+#include <cm/string_view>
#include <cmext/algorithm>
#include <cm3p/json/value.h>
@@ -43,6 +44,51 @@
#include "cmUVSignalHackRAII.h" // IWYU pragma: keep
#include "cmWorkingDirectory.h"
+namespace {
+
+struct CostEntry
+{
+ cm::string_view name;
+ int prevRuns;
+ float cost;
+};
+
+cm::optional<CostEntry> splitCostLine(cm::string_view line)
+{
+ std::string part;
+ cm::string_view::size_type pos1 = line.size();
+ cm::string_view::size_type pos2 = line.find_last_of(' ', pos1);
+ auto findNext = [line, &part, &pos1, &pos2]() -> bool {
+ if (pos2 != cm::string_view::npos) {
+ cm::string_view sub = line.substr(pos2 + 1, pos1 - pos2 - 1);
+ part.assign(sub.begin(), sub.end());
+ pos1 = pos2;
+ if (pos1 > 0) {
+ pos2 = line.find_last_of(' ', pos1 - 1);
+ }
+ return true;
+ }
+ return false;
+ };
+
+ // parse the cost
+ if (!findNext()) {
+ return cm::nullopt;
+ }
+ float cost = static_cast<float>(atof(part.c_str()));
+
+ // parse the previous runs
+ if (!findNext()) {
+ return cm::nullopt;
+ }
+ int prev = atoi(part.c_str());
+
+ // from start to the last found space is the name
+ return CostEntry{ line.substr(0, pos1), prev, cost };
+}
+
+}
+
namespace cmsys {
class RegularExpression;
}
@@ -697,24 +743,21 @@ void cmCTestMultiProcessHandler::UpdateCostData()
if (line == "---") {
break;
}
- std::vector<std::string> parts = cmSystemTools::SplitString(line, ' ');
// Format: <name> <previous_runs> <avg_cost>
- if (parts.size() < 3) {
+ cm::optional<CostEntry> entry = splitCostLine(line);
+ if (!entry) {
break;
}
- std::string name = parts[0];
- int prev = atoi(parts[1].c_str());
- float cost = static_cast<float>(atof(parts[2].c_str()));
-
- int index = this->SearchByName(name);
+ int index = this->SearchByName(entry->name);
if (index == -1) {
// This test is not in memory. We just rewrite the entry
- fout << name << " " << prev << " " << cost << "\n";
+ fout << entry->name << " " << entry->prevRuns << " " << entry->cost
+ << "\n";
} else {
// Update with our new average cost
- fout << name << " " << this->Properties[index]->PreviousRuns << " "
- << this->Properties[index]->Cost << "\n";
+ fout << entry->name << " " << this->Properties[index]->PreviousRuns
+ << " " << this->Properties[index]->Cost << "\n";
temp.erase(index);
}
}
@@ -750,28 +793,25 @@ void cmCTestMultiProcessHandler::ReadCostData()
break;
}
- std::vector<std::string> parts = cmSystemTools::SplitString(line, ' ');
+ // Format: <name> <previous_runs> <avg_cost>
+ cm::optional<CostEntry> entry = splitCostLine(line);
// Probably an older version of the file, will be fixed next run
- if (parts.size() < 3) {
+ if (!entry) {
fin.close();
return;
}
- std::string name = parts[0];
- int prev = atoi(parts[1].c_str());
- float cost = static_cast<float>(atof(parts[2].c_str()));
-
- int index = this->SearchByName(name);
+ int index = this->SearchByName(entry->name);
if (index == -1) {
continue;
}
- this->Properties[index]->PreviousRuns = prev;
+ this->Properties[index]->PreviousRuns = entry->prevRuns;
// When not running in parallel mode, don't use cost data
if (this->ParallelLevel > 1 && this->Properties[index] &&
this->Properties[index]->Cost == 0) {
- this->Properties[index]->Cost = cost;
+ this->Properties[index]->Cost = entry->cost;
}
}
// Next part of the file is the failed tests
@@ -784,7 +824,7 @@ void cmCTestMultiProcessHandler::ReadCostData()
}
}
-int cmCTestMultiProcessHandler::SearchByName(std::string const& name)
+int cmCTestMultiProcessHandler::SearchByName(cm::string_view name)
{
int index = -1;
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 3b4e9c59ad1871168d8528be0586831e2416ae36..8d33dabcf0d9fc6e11459105c65eadaa1de33e42 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -12,6 +12,7 @@
#include <vector>
#include <cm/optional>
+#include <cm/string_view>
#include <cm3p/uv.h>
@@ -113,7 +114,7 @@ protected:
void UpdateCostData();
void ReadCostData();
// Return index of a test based on its name
- int SearchByName(std::string const& name);
+ int SearchByName(cm::string_view name);
void CreateTestCostList();
diff --git a/Tests/CTestTestScheduler/CMakeLists.txt b/Tests/CTestTestScheduler/CMakeLists.txt
index 91d565d4020aafda6d49462cd8616d168d5844b6..daf6ce2b23d8c048334ae1047759130b246dccef 100644
--- a/Tests/CTestTestScheduler/CMakeLists.txt
+++ b/Tests/CTestTestScheduler/CMakeLists.txt
@@ -1,9 +1,9 @@
-cmake_minimum_required (VERSION 3.5)
+cmake_minimum_required(VERSION 3.19)
project (CTestTestScheduler)
include (CTest)
add_executable (Sleep sleep.c)
foreach (time RANGE 1 4)
- add_test (TestSleep${time} Sleep ${time})
+ add_test ("TestSleep ${time}" Sleep ${time})
endforeach ()

View File

@@ -0,0 +1,39 @@
From fd9a04c1434e12f21c043385e306e0b52d38d749 Mon Sep 17 00:00:00 2001
From: Otavio Salvador <otavio@ossystems.com.br>
Date: Thu, 5 Jul 2018 10:28:04 -0300
Subject: [PATCH] Disable use of ext2fs/ext2_fs.h by cmake's internal
libarchive copy
Organization: O.S. Systems Software LTDA.
We don't want to add a dependency on e2fsprogs-native for cmake-native,
and we don't use CPack so just disable this functionality.
Upstream-Status: Inappropriate [config]
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Utilities/cmlibarchive/CMakeLists.txt | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index bfcaf30..2960683 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -682,12 +682,8 @@ LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H)
LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H)
LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
-LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H)
-
-CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
-#include <ext2fs/ext2_fs.h>
-int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS)
-
+SET(HAVE_EXT2FS_EXT2_FS_H 0)
+SET(HAVE_WORKING_EXT2_IOC_GETFLAGS 0)
LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H)
LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)

View File

@@ -0,0 +1,23 @@
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE )
set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE )
set( CMAKE_SYSROOT $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}")
set( CMAKE_SYSTEM_PROCESSOR $ENV{OECORE_TARGET_ARCH} )
# Include the toolchain configuration subscripts
file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_FILE}.d/*.cmake" )
foreach(config ${toolchain_config_files})
include(${config})
endforeach()
unset(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)
unset(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES)

View File

@@ -0,0 +1,31 @@
set(SDK_INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
set(HOST_SYSROOT "${SDK_INSTALL_DIR}/sysroots/@OECORE_SDK_SYS")
set(TARGET_SYSROOT "${SDK_INSTALL_DIR}/sysroots/@OECORE_TARGET_SYS")
set(HOST_BIN "${HOST_SYSROOT}/usr/bin")
set(TOOLCHAIN_NAME "@OECORE_TARGET_ALIAS")
set(GCC_DIR "${HOST_BIN}/${TOOLCHAIN_NAME}")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR "@OECORE_TARGET_ARCH")
set(CMAKE_C_COMPILER "${GCC_DIR}/${TOOLCHAIN_NAME}-gcc")
set(CMAKE_CXX_COMPILER "${GCC_DIR}/${TOOLCHAIN_NAME}-g++")
set(ARCH_FLAGS "@OECORE_TUNE_CCARGS")
set(CMAKE_C_FLAGS "${ARCH_FLAGS}" CACHE STRING "" FORCE )
set(CMAKE_CXX_FLAGS "${ARCH_FLAGS}" CACHE STRING "" FORCE )
set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE )
set(CMAKE_LDFLAGS_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE )
set(CMAKE_SYSROOT "${TARGET_SYSROOT}")
set(CMAKE_FIND_ROOT_PATH "${TARGET_SYSROOT}" )
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "")
set(CMAKE_PROGRAM_PATH "${HOST_SYSROOT}/usr/bin" CACHE STRING "" FORCE)

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
import os
import string
import sys
class Template(string.Template):
delimiter = "@"
class Environ():
def __getitem__(self, name):
if name == "OECORE_SDK_SYS":
return os.path.basename(os.environ["OECORE_NATIVE_SYSROOT"])
elif name == "OECORE_TARGET_SYS":
return os.path.basename(os.environ["OECORE_TARGET_SYSROOT"])
elif name == "OECORE_TARGET_ALIAS":
return os.path.basename(os.environ["TARGET_PREFIX"].strip("-"))
else:
return os.environ[name]
try:
sysroot = os.environ['OECORE_NATIVE_SYSROOT']
except KeyError:
print("Not in environment setup, bailing")
sys.exit(1)
template_file = os.path.join(sysroot, 'usr/share/cmake/SDKToolchainConfig.cmake.template')
cross_file = os.path.join(sysroot, 'usr/share/cmake/%s-toolchain.cmake' % (os.path.basename(os.environ["OECORE_TARGET_SYSROOT"])))
with open(template_file) as in_file:
template = in_file.read()
output = Template(template).substitute(Environ())
with open(cross_file, "w") as out_file:
out_file.write(output)

View File

@@ -0,0 +1,2 @@
export CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake"
export OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX="`echo $OECORE_BASELIB | sed -e s/lib//`"

View File

@@ -0,0 +1,69 @@
require cmake.inc
inherit cmake bash-completion
DEPENDS += "curl expat zlib libarchive xz ncurses bzip2"
SRC_URI:append:class-nativesdk = " \
file://0001-ctest-Allow-arbitrary-characters-in-test-names-of-CT.patch \
file://OEToolchainConfig.cmake \
file://SDKToolchainConfig.cmake.template \
file://cmake-setup.py \
file://environment.d-cmake.sh \
"
LICENSE:append = " & BSD-1-Clause & MIT"
LIC_FILES_CHKSUM:append = " \
file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \
file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \
file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \
"
# Strip ${prefix} from ${docdir}, set result into docdir_stripped
python () {
prefix=d.getVar("prefix")
docdir=d.getVar("docdir")
if not docdir.startswith(prefix):
bb.fatal('docdir must contain prefix as its prefix')
docdir_stripped = docdir[len(prefix):]
if len(docdir_stripped) > 0 and docdir_stripped[0] == '/':
docdir_stripped = docdir_stripped[1:]
d.setVar("docdir_stripped", docdir_stripped)
}
EXTRA_OECMAKE=" \
-DCMAKE_DOC_DIR=${docdir_stripped}/cmake-${CMAKE_MAJOR_VERSION} \
-DCMAKE_USE_SYSTEM_LIBRARIES=1 \
-DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_CPPDAP=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \
-DKWSYS_CHAR_IS_SIGNED=1 \
-DBUILD_CursesDialog=0 \
-DKWSYS_LFS_WORKS=1 \
-DCMake_ENABLE_DEBUGGER=0 \
"
do_install:append:class-nativesdk() {
mkdir -p ${D}${datadir}/cmake
install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/
mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${SDKPATHNATIVE}/environment-setup.d/cmake.sh
# install cmake-setup.py to create arch-specific toolchain cmake file from template
install -m 0644 ${WORKDIR}/SDKToolchainConfig.cmake.template ${D}${datadir}/cmake/
install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
install -m 0755 ${WORKDIR}/cmake-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
}
FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}"
FILES:${PN} += "${datadir}/cmake-${CMAKE_MAJOR_VERSION} ${datadir}/cmake ${datadir}/aclocal ${datadir}/emacs ${datadir}/vim"
FILES:${PN}-doc += "${docdir}/cmake-${CMAKE_MAJOR_VERSION}"
FILES:${PN}-dev = ""
BBCLASSEXTEND = "nativesdk"

Some files were not shown because too many files have changed in this diff Show More