Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -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)
@@ -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)
@@ -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);
}
@@ -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
@@ -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
@@ -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");
@@ -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);
@@ -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>
@@ -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
+728
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
+142
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-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
}
@@ -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"
@@ -0,0 +1,138 @@
From 7a3bbca81b803ba116b83c82de378e840cc35f81 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 1 Sep 2022 16:19:50 -0500
Subject: [PATCH] Port to compilers that moan about K&R func decls
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY):
Use '(void)' rather than '()' in function prototypes, as the latter
provokes fatal errors in some compilers nowadays.
* lib/autoconf/functions.m4 (AC_FUNC_STRTOD):
* tests/fortran.at (AC_F77_DUMMY_MAIN usage):
* tests/semantics.at (AC_CHECK_DECLS):
Dont use () in a function decl.
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=8b5e2016c7ed2d67f31b03a3d2e361858ff5299b]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
doc/autoconf.texi | 7 +++----
lib/autoconf/c.m4 | 6 +++---
lib/autoconf/functions.m4 | 3 ---
tests/fortran.at | 8 ++++----
tests/semantics.at | 2 +-
5 files changed, 11 insertions(+), 15 deletions(-)
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -5465,9 +5465,7 @@ the @samp{#undef malloc}):
#include <config.h>
#undef malloc
-#include <sys/types.h>
-
-void *malloc ();
+#include <stdlib.h>
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
@@ -8295,7 +8293,7 @@ needed:
# ifdef __cplusplus
extern "C"
# endif
- int F77_DUMMY_MAIN () @{ return 1; @}
+ int F77_DUMMY_MAIN (void) @{ return 1; @}
#endif
@end example
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -127,7 +127,7 @@ m4_if([$2], [main], ,
[/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
-char $2 ();])], [return $2 ();])])
+char $2 (void);])], [return $2 ();])])
# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
@@ -151,7 +151,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
#define $1 innocuous_$1
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $1 (); below. */
+ which can conflict with char $1 (void); below. */
#include <limits.h>
#undef $1
@@ -162,7 +162,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
#ifdef __cplusplus
extern "C"
#endif
-char $1 ();
+char $1 (void);
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1601,9 +1601,6 @@ AC_DEFUN([AC_FUNC_STRTOD],
AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod,
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
]AC_INCLUDES_DEFAULT[
-#ifndef strtod
-double strtod ();
-#endif
int
main (void)
{
--- a/tests/fortran.at
+++ b/tests/fortran.at
@@ -233,7 +233,7 @@ void FOOBAR_F77 (double *x, double *y);
# ifdef __cplusplus
extern "C"
# endif
- int F77_DUMMY_MAIN () { return 1; }
+ int F77_DUMMY_MAIN (void) { return 1; }
#endif
int main(int argc, char *argv[])
@@ -315,7 +315,7 @@ void FOOBAR_FC(double *x, double *y);
# ifdef __cplusplus
extern "C"
# endif
- int FC_DUMMY_MAIN () { return 1; }
+ int FC_DUMMY_MAIN (void) { return 1; }
#endif
int main (int argc, char *argv[])
@@ -561,7 +561,7 @@ void @foobar@ (int *x);
# ifdef __cplusplus
extern "C"
# endif
- int F77_DUMMY_MAIN () { return 1; }
+ int F77_DUMMY_MAIN (void) { return 1; }
#endif
int main(int argc, char *argv[])
@@ -637,7 +637,7 @@ void @foobar@ (int *x);
# ifdef __cplusplus
extern "C"
# endif
- int FC_DUMMY_MAIN () { return 1; }
+ int FC_DUMMY_MAIN (void) { return 1; }
#endif
int main(int argc, char *argv[])
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -207,7 +207,7 @@ AT_CHECK_MACRO([AC_CHECK_DECLS],
[[extern int yes;
enum { myenum };
extern struct mystruct_s { int x[20]; } mystruct;
- extern int myfunc();
+ extern int myfunc (int);
#define mymacro1(arg) arg
#define mymacro2]])
# Ensure we can detect missing declarations of functions whose
@@ -0,0 +1,123 @@
From 0071d28e304745a16871561f23117fdb00dd2559 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 4/7] 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 bb9f316d..7da3005b 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -82,6 +82,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 [syntax]
@@ -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);
+ }
}
@@ -687,9 +698,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
{
@@ -726,8 +740,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
{
@@ -765,7 +782,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);
+ }
# -------------------- #
@@ -786,7 +806,10 @@ sub autoreconf_current_directory ($)
}
else
{
+ @ex = grep (/^autoheader$/, @exclude);
+ if ($#ex == -1) {
xsystem ($autoheader);
+ }
}
@@ -803,7 +826,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);
+ }
}
# ---------------------------------------------------- #
--
2.25.1
@@ -0,0 +1,129 @@
From 8c0f24404bebffdaf3132d81e2b9560d34ff1677 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 6/7] 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 0c0e3c5b..17590e96 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -412,6 +412,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.
@@ -525,6 +528,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"])
@@ -713,10 +720,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
@@ -742,6 +749,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
@@ -1129,7 +1137,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"
}
@@ -1155,42 +1165,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
--
2.25.1
@@ -0,0 +1,24 @@
Don't use the target perl when regenerating the man pages.
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@arm.com>
diff --git a/man/local.mk b/man/local.mk
index e69858b1..78c68ab5 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -67,13 +67,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 \
@@ -0,0 +1,21 @@
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>
diff --git a/Makefile.in b/Makefile.in
index 146e8e3..a1827c1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -763,10 +762,0 @@ dist_buildaux_SCRIPTS = \
-dist_man_MANS = \
- man/autoconf.1 \
- man/autoheader.1 \
- man/autom4te.1 \
- man/autoreconf.1 \
- man/autoscan.1 \
- man/autoupdate.1 \
- man/ifnames.1
-
-
@@ -0,0 +1,38 @@
From 0aac3047cd7681d610b22d79501c297fa3433148 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 2/7] 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 9d543952..84ef84a9 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -230,7 +230,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"; } &&
--
2.25.1
@@ -0,0 +1,27 @@
From f4f19a5c03e8ae3b9cc93d24b76694f4b7b2eb76 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 3/7] 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 16f0d074..4c5e0b36 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2070,7 +2070,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
--
2.25.1
@@ -0,0 +1,34 @@
From a08643ac3fef884900d6cfa161f0acec3ef104d1 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 1/7] 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 12f60b99..07da7941 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -801,15 +801,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, [],
--
2.25.1
@@ -0,0 +1,82 @@
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 = "${GNU_MIRROR}/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 \
file://0001-Port-to-compilers-that-moan-about-K-R-func-decls.patch \
"
SRC_URI:append:class-native = " file://no-man.patch"
SRC_URI[sha256sum] = "431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c"
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 \
"
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"
@@ -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*"
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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: Pending
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,/*$,,;
}
@@ -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
])
@@ -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"
@@ -0,0 +1,40 @@
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.41, please make sure there is no trailing .0, so
# that upstream version check can work correctly.
PV = "2.40"
CVE_VERSION = "2.40"
SRCBRANCH ?= "binutils-2_40-branch"
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
SRCREV ?= "4671be001eb5a899ecac3e2686a92934000f8262"
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://0015-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \
file://0016-CVE-2023-25586.patch \
file://fix-time64.patch \
file://0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch \
"
S = "${WORKDIR}/git"
@@ -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 = ""
@@ -0,0 +1,3 @@
require binutils.inc
require binutils-${PV}.inc
require binutils-cross-canadian.inc
@@ -0,0 +1,81 @@
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}"'))
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
@@ -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} || :
}
@@ -0,0 +1,3 @@
require binutils.inc
require binutils-${PV}.inc
require binutils-cross.inc
@@ -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
}
@@ -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")
}
@@ -0,0 +1,43 @@
From c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Thu, 30 Mar 2023 10:10:09 +0100
Subject: [PATCH] Fix an illegal memory access when an accessing a
zer0-lengthverdef table.
PR 30285
* elf.c (_bfd_elf_slurp_version_tables): Fail if no version definitions are allocated.
CVE: CVE-2023-1972
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
bfd/ChangeLog | 6 ++++++
bfd/elf.c | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/bfd/elf.c b/bfd/elf.c
index 027d0143735..185028cbd97 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9030,6 +9030,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
bfd_set_error (bfd_error_file_too_big);
goto error_return_verdef;
}
+
+ if (amt == 0)
+ goto error_return_verdef;
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return_verdef;
@@ -9133,6 +9136,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
bfd_set_error (bfd_error_file_too_big);
goto error_return;
}
+ if (amt == 0)
+ goto error_return;
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;
--
2.34.1
@@ -0,0 +1,75 @@
From 4bdab425bdd7dc52c95bfd62e035c1b9abe9595e 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 899d4af0707..7c31b1bef6e 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -5083,7 +5083,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 382bd07ffe2..9fbd0c4cb8a 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -304,6 +304,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
@@ -312,10 +313,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 5d3b0d31b1b..2163909cd56 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -148,8 +148,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) }"
@@ -0,0 +1,59 @@
From c79005d4d9991593557766ad569f48c26482399f 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 9fbd0c4cb8a..6be07038c9b 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -235,31 +235,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
@@ -0,0 +1,95 @@
From 70da8b91026c5381d430194910fc15e3b6c5ec7f 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 b3195b4be68..fc6460317a7 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -42,7 +42,8 @@ ZLIBINC = @zlibinc@
ELF_CLFAGS=-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_CLFAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
diff --git a/ld/Makefile.in b/ld/Makefile.in
index fe422569228..4a4c851b44a 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -566,7 +566,8 @@ ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
ELF_CLFAGS = -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_CLFAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
diff --git a/ld/ldelf.c b/ld/ldelf.c
index eff6693e052..95787012b89 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -936,7 +936,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, "/etc/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 9290a189b0d..ceaca2d85d0 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -70,6 +70,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 dda124b96e8..ba06a7d7be2 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;
@@ -0,0 +1,39 @@
From fa477bb947fa17543f4550bc0e7e715c8355649c 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 fc6460317a7..1b875904b8d 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -51,7 +51,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(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 4a4c851b44a..08dcd7b75fc 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -574,7 +574,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(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
@@ -0,0 +1,32 @@
From 7912f5a918e612950feb04d845934f26160e85da 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 f9fbba23e2c..93495e45d6f 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); \
@@ -0,0 +1,288 @@
From 725ca09ee1041f64589f26ba815ef11da687c608 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 | 16 ++++++++++++++++
9 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/ld/config.in b/ld/config.in
index ad0dc6a106c..d21edaddce7 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -58,6 +58,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 995708089fd..6406a42c442 100755
--- a/ld/configure
+++ b/ld/configure
@@ -839,6 +839,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1521,6 +1522,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)
@@ -15483,6 +15486,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 77edac3258c..a74dac63038 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 05649ff61b8..1818c227473 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -163,6 +163,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 db3a9f09b45..77037399cb9 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2960,6 +2960,18 @@ creation of the metadata note, if one had been enabled by an earlier
occurrence of the --package-metdata 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 b8fd4e5d8e0..1f1d8e23bc9 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -117,6 +117,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 0538f0a06a1..f94a71875d8 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -170,6 +170,8 @@ enum option_values
OPTION_NO_WARN_EXECSTACK,
OPTION_WARN_RWX_SEGMENTS,
OPTION_NO_WARN_RWX_SEGMENTS,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index ceaca2d85d0..62e7b4e5341 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -322,6 +322,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
@@ -1454,7 +1456,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]);
@@ -1475,7 +1477,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 a1c6140100d..d47ba4f977d 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -613,6 +613,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)
@@ -1737,6 +1745,14 @@ parse_args (unsigned argc, char **argv)
config.print_map_discarded = true;
break;
+ 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:
config.dependency_file = optarg;
break;
@@ -0,0 +1,37 @@
From 4e9d4ace8a340399aeaa8332e2cfbfcc7d2d14d7 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 37f1aeb780c..45774c7cf79 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
@@ -0,0 +1,49 @@
From ff2754e302d06df51f8dd8ef877afb65eb30fcab 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 70e856e0659..11ee684cccf 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"
@@ -0,0 +1,86 @@
From 039b4afd7d3b5a599aebee97410809276a622ccd 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 11ee684cccf..3b19ac15328 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
@@ -0,0 +1,45 @@
From 4eb24605fb2012c0f02883d1f560d5d852c0705e 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 9cb953a197e..b63b5cd3de0 100755
--- a/configure
+++ b/configure
@@ -5460,7 +5460,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 e95a9ed116e..2df870b86af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1444,7 +1444,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() {}])],
@@ -0,0 +1,38 @@
From 9613e47bfdea18d2764eec130676e3e0b40c676f 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 95787012b89..bc29909386f 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1127,6 +1127,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))
@@ -1801,6 +1804,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)
@@ -0,0 +1,48 @@
From 8af01d85c4e5a5558d770291b7df86acfd59827c 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 6c71e3ebb41..a2caf947d31 100644
--- a/libiberty/sha1.c
+++ b/libiberty/sha1.c
@@ -229,7 +229,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)
@@ -0,0 +1,32 @@
From 9599d7d48913fca4c2bf0d0012f9655353ca6f6c 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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index de04a44b812..f80c84ab13c 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -1056,7 +1056,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"
@@ -0,0 +1,34 @@
From 5830876a0cca17bef3b2d54908928e72cca53502 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Tue, 6 Dec 2022 08:37:52 +1030
Subject: [PATCH] PR29855, ch_type in bfd_init_section_decompress_status can be
uninitialized
PR 29855
* compress.c (bfd_init_section_decompress_status): Set ch_type
to zero for zlib-gnu case.
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5830876a0cca17bef3b2d54908928e72cca53502]
CVE: CVE-2023-25586
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
---
bfd/compress.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/bfd/compress.c b/bfd/compress.c
index 3d8c1d769f1..6b083468ca8 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -1012,7 +1012,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
return false;
}
uncompressed_size = bfd_getb64 (header + 4);
- ch_type = ch_none;
+ ch_type = 0;
}
else if (!bfd_check_compression_header (abfd, header, sec,
&ch_type,
--
2.31.1
@@ -0,0 +1,94 @@
From f6f19a39ecfe962cb8a05522c27f513308687a74 Mon Sep 17 00:00:00 2001
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date: Thu, 16 Feb 2023 19:00:47 -0800
Subject: [PATCH] gprofng: PR30036 Build failure on aarch64 w/ glibc: symbol
`pwrite64' is already defined
gprofng/ChangeLog
2023-02-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/30036
* libcollector/iotrace.c: Define creat64 and pwrite64 only when
__USE_LARGEFILE64 and __USE_FILE_OFFSET64 are not defined.
* libcollector/mmaptrace.c: Likewise for mmap64.
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=f6f19a39ecfe962cb8a05522c27f513308687a74]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
gprofng/libcollector/iotrace.c | 15 ++++++++-------
gprofng/libcollector/mmaptrace.c | 2 +-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c
index af90cc31f1a..d8439b02b3a 100644
--- a/gprofng/libcollector/iotrace.c
+++ b/gprofng/libcollector/iotrace.c
@@ -1441,7 +1441,7 @@ creat (const char *path, mode_t mode)
}
/*------------------------------------------------------------- creat64 */
-#if WSIZE(32)
+#if WSIZE(32) && !defined(__USE_LARGEFILE64)
int
creat64 (const char *path, mode_t mode)
{
@@ -2476,7 +2476,7 @@ __collector_pwrite_2_1 (int fildes, const void *buf, size_t nbyte, off_t offset)
return ret;
}
-#else
+#endif
ssize_t
pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
{
@@ -2497,11 +2497,10 @@ pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
POP_REENTRANCE (guard);
return ret;
}
-#endif
/*------------------------------------------------------------- pwrite64 */
-#if WSIZE(32)
-#if !defined(__MUSL_LIBC) && ARCH(Intel)
+#if WSIZE(32) && ARCH(Intel)
+#if !defined(__MUSL_LIBC)
// map interposed symbol versions
SYMVER_ATTRIBUTE (__collector_pwrite64_2_2, pwrite64@GLIBC_2.2)
@@ -2547,8 +2546,9 @@ __collector_pwrite64_2_1 (int fildes, const void *buf, size_t nbyte, off64_t off
POP_REENTRANCE (guard);
return ret;
}
+#endif
-#else
+#if !defined(__USE_FILE_OFFSET64)
ssize_t
pwrite64 (int fildes, const void *buf, size_t nbyte, off64_t offset)
{
@@ -2570,7 +2570,8 @@ pwrite64 (int fildes, const void *buf, size_t nbyte, off64_t offset)
return ret;
}
#endif
-#endif /* SIZE(32) */
+
+#endif /* SIZE(32) && ARCH(Intel) */
/*------------------------------------------------------------- fgets */
char*
diff --git a/gprofng/libcollector/mmaptrace.c b/gprofng/libcollector/mmaptrace.c
index 61613c21560..221b4e2d176 100644
--- a/gprofng/libcollector/mmaptrace.c
+++ b/gprofng/libcollector/mmaptrace.c
@@ -1494,7 +1494,7 @@ mmap (void *start, size_t length, int prot, int flags, int fd, off_t offset)
}
/*------------------------------------------------------------- mmap64 */
-#if WSIZE(32) /* mmap64 only defined for non-64-bit */
+#if WSIZE(32) && !defined(__USE_FILE_OFFSET64)
void *
mmap64 (void *start, size_t length, int prot, int flags, int fd, off64_t offset)
--
2.31.1
@@ -0,0 +1,75 @@
require binutils.inc
require binutils-${PV}.inc
DEPENDS += "zlib"
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}"
BBCLASSEXTEND = "native nativesdk"
@@ -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
@@ -0,0 +1,54 @@
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://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"
@@ -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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,164 @@
# 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."
AUTHOR = "Wonhong Kwon <wonhong.kwon@lge.com>"
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"
PR = "r1"
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"
@@ -0,0 +1,25 @@
From d3adfc21c9cc264bd191722f102963cbc4794259 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 1697794c..8ab38818 100644
--- a/Makefile
+++ b/Makefile
@@ -651,7 +651,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
@@ -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 = "9d2c8c364a6b8df4b1a47ad384cd75fd4ba53e12"
S = "${WORKDIR}/git"
PACKAGECONFIG ??= " \
programs \
convert \
python \
crypto-builtin \
"
PACKAGECONFIG[manpages] = "--enable-documentation, --disable-documentation, python3-sphinx-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 ${@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"
@@ -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=cd54b7abfc462470b0f505273c38f0ff"
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] = "75eef15b8b9da48db9c91e1d0ff58b3645fc70c0e4ca2ef1b6825a12f21f217d"
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"
@@ -0,0 +1,37 @@
From 550834a3ec2e05e379be63b084e7fa06a1723f84 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 08ab794..c754e99 100644
--- a/src/third_party/xxhash.h
+++ b/src/third_party/xxhash.h
@@ -1501,7 +1501,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
@@ -0,0 +1,28 @@
# 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"
SRC_URI = " \
${SOURCEFORGE_MIRROR}/project/cdrtools/cdrtools-${PV}.tar.bz2 \
file://0001-Don-t-set-uid-gid-during-install.patch \
"
SRC_URI[md5sum] = "7d45c5b7e1f78d85d1583b361aee6e8b"
SRC_URI[sha256sum] = "ed282eb6276c4154ce6a0b5dee0bdb81940d0cbbfc7d03f769c4735ef5f5860f"
EXTRA_OEMAKE = "-e MAKEFLAGS="
# Stop failures when 'cc' can't be found
export ac_cv_prog_CC = "${CC}"
inherit native
do_install() {
make install GMAKE_NOWARN=true INS_BASE=${prefix} DESTDIR=${D}
}
@@ -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
@@ -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
@@ -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"
@@ -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://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \
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=190c514872597083303371684954f238 \
"
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_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 compatibilty
# 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"
@@ -0,0 +1,26 @@
# 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 \
"
SRC_URI[sha256sum] = "313b6880c291bd4fe31c0aa51d6e62659282a521e695f30d5cc0d25abbd5c208"
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"
@@ -0,0 +1,44 @@
From 5acfcb2aba1a5641d390558fdf288373f5e39cb5 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Thu, 27 Apr 2017 11:35:05 -0400
Subject: [PATCH] CMakeDetermineSystem: use oe environment vars to load default
toolchain file in sdk
Passing the toolchain by:
- shell aliases does not work if cmake is called by a script
- unconditionally by a wrapper script causes cmake to believe it is
configuring things when it is not (for example, `cmake --build` breaks).
The OE_CMAKE_TOOLCHAIN_FILE variable is only used as a default if no
toolchain is explicitly specified.
Setting the CMAKE_TOOLCHAIN_FILE cmake variable is marked as cached
because '-D' options are cache entries themselves.
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Cody P Schafer <dev@codyps.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Modules/CMakeDetermineSystem.cmake | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 2c2c2ac3..fae4f97f 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -112,6 +112,13 @@ else()
endif()
endif()
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
+ if(DEFINED ENV{OE_CMAKE_TOOLCHAIN_FILE})
+ set(CMAKE_TOOLCHAIN_FILE "$ENV{OE_CMAKE_TOOLCHAIN_FILE}" CACHE FILEPATH "toolchain file")
+ message(STATUS "Toolchain file defaulted to '${CMAKE_TOOLCHAIN_FILE}'")
+ endif()
+endif()
+
# if a toolchain file is used, the user wants to cross compile.
# in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_*
# variables around so they can be used in CMakeLists.txt.
@@ -0,0 +1,31 @@
From 3fd6082c52a8140db5995afb59fb391f7d5c19d7 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>
---
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 f842270b..17b1ce19 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -68,7 +68,7 @@ set(ENABLE_UNIX_SOCKETS OFF CACHE INTERNAL "No curl Unix domain sockets support"
set(HTTP_ONLY OFF CACHE INTERNAL "Curl is not http-only")
set(PICKY_COMPILER OFF CACHE INTERNAL "Enable picky compiler options")
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.25.1
@@ -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)
@@ -0,0 +1,20 @@
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()
@@ -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)
+33
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)
@@ -0,0 +1,2 @@
export OE_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//`"
@@ -0,0 +1,67 @@
require cmake.inc
inherit cmake bash-completion
DEPENDS += "curl expat zlib libarchive xz ncurses bzip2"
SRC_URI:append:class-nativesdk = " \
file://OEToolchainConfig.cmake \
file://SDKToolchainConfig.cmake.template \
file://cmake-setup.py \
file://environment.d-cmake.sh \
file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \
"
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_LIBUV=0 \
-DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \
-DKWSYS_CHAR_IS_SIGNED=1 \
-DBUILD_CursesDialog=0 \
-DKWSYS_LFS_WORKS=1 \
"
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"
@@ -0,0 +1,28 @@
From 6f8f6d151b831b60f6e7892aa9294a6361353c72 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 30 Dec 2016 18:31:02 +0200
Subject: [PATCH] Do not set PYTHON_INSTALL_DIR by running python
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
---
src/python/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index a31b14d..01fd8ca 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -14,7 +14,7 @@ if (NOT SKBUILD)
FIND_PACKAGE(PythonLibs 3 REQUIRED)
endif (NOT SKBUILD)
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+#EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})
MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}")
--
2.25.1
@@ -0,0 +1,30 @@
From eb66326c3fc6e942282d01ddd56659c78ed7400b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 13 Jan 2023 13:21:51 -0800
Subject: [PATCH] include rpm/rpmstring.h
Its needed for rasprintf declaration
Fixes
src/xml_file.c:341:36: error: call to undeclared functi
on 'rasprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
Upstream-Status: Submitted [https://github.com/rpm-software-management/createrepo_c/pull/340]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/xml_file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/xml_file.c b/src/xml_file.c
index d2400b8..871109c 100644
--- a/src/xml_file.c
+++ b/src/xml_file.c
@@ -19,6 +19,7 @@
#include <glib.h>
#include <glib/gstdio.h>
+#include <rpm/rpmstring.h>
#include <assert.h>
#include <rpm/rpmstring.h>
#include "xml_file.h"
@@ -0,0 +1,39 @@
From 970b901e1999f415da8bac205f526c808ddad0ba Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Mon, 8 May 2023 10:40:43 +0200
Subject: [PATCH] src/cmd_parser.c: add a missing parameter name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This resolves the following error with older versions of gcc:
| /srv/storage/alex/yocto/build-32/tmp/work/x86_64-linux/createrepo-c-native/0.21.1-r0/git/src/cmd_parser.c: In function duplicated_nevra_option_parser:
| /srv/storage/alex/yocto/build-32/tmp/work/x86_64-linux/createrepo-c-native/0.21.1-r0/git/src/cmd_parser.c:76:32: error: parameter name omitted
| 76 | duplicated_nevra_option_parser(const gchar *,
| | ^~~~~~~~~~~~~
| /srv/storage/alex/yocto/build-32/tmp/work/x86_64-linux/createrepo-c-native/0.21.1-r0/git/src/cmd_parser.c:78:32: error: parameter name omitted
| 78 | gpointer,
| | ^~~~~~~~
Upstream-Status: Submitted [https://github.com/rpm-software-management/createrepo_c/pull/366]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
src/cmd_parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cmd_parser.c b/src/cmd_parser.c
index 97c9ea7..63af7ea 100644
--- a/src/cmd_parser.c
+++ b/src/cmd_parser.c
@@ -73,9 +73,9 @@ struct CmdOptions _cmd_options = {
gboolean
-duplicated_nevra_option_parser(const gchar *,
+duplicated_nevra_option_parser(const gchar *option_name,
const gchar *value,
- gpointer,
+ gpointer data,
GError **error)
{
if (!g_strcmp0(value, "keep"))
@@ -0,0 +1,42 @@
SUMMARY = "C implementation of createrepo."
HOMEPAGE = "https://github.com/rpm-software-management/createrepo_c/wiki"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/rpm-software-management/createrepo_c;branch=master;protocol=https \
file://0001-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \
file://0001-include-rpm-rpmstring.h.patch \
file://0001-src-cmd_parser.c-add-a-missing-parameter-name.patch \
"
SRCREV = "0652d7303ce236e596c83c29ccc9bee7868fce6e"
S = "${WORKDIR}/git"
DEPENDS = "expat curl glib-2.0 libxml2 openssl bzip2 zlib file sqlite3 xz rpm"
DEPENDS:append:class-native = " file-replacement-native"
inherit cmake pkgconfig bash-completion setuptools3-base
EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3 -DWITH_ZCHUNK=OFF -DENABLE_DRPM=OFF -DWITH_LIBMODULEMD=OFF"
BBCLASSEXTEND = "native nativesdk"
# Direct createrepo to read rpm configuration from our sysroot, not the one it was compiled in
do_install:append:class-native() {
create_wrapper ${D}/${bindir}/createrepo_c \
RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc
create_wrapper ${D}/${bindir}/modifyrepo_c \
MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc
}
do_install:append:class-nativesdk() {
create_wrapper ${D}/${bindir}/createrepo_c \
RPM_CONFIGDIR=${SDKPATHNATIVE}${libdir_nativesdk}/rpm \
MAGIC=${datadir}/misc/magic.mgc
create_wrapper ${D}/${bindir}/modifyrepo_c \
MAGIC=${datadir}/misc/magic.mgc
rm -rf ${D}/etc
}
@@ -0,0 +1,28 @@
SUMMARY = "Tools for creating debuginfo and source file distributions"
DESCRIPTION = "debugedit provides programs and scripts for creating \
debuginfo and source file distributions, collect build-ids and rewrite \
source paths in DWARF data for debugging, tracing and profiling."
HOMEPAGE = "https://sourceware.org/debugedit/"
LICENSE = "GPL-2.0-only & GPL-3.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504"
SRC_URI = "https://sourceware.org/ftp/debugedit/${PV}/debugedit-${PV}.tar.xz"
SRC_URI:append:libc-musl = " \
file://0001-tools-Add-error.h-for-non-glibc-case.patch \
file://0002-sepdebugcrcfix.c-do-not-use-64bit-variants.patch \
file://0003-Makefile.am-do-not-update-manual.patch \
"
SRC_URI[sha256sum] = "e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e"
DEPENDS = "elfutils"
inherit pkgconfig autotools
RDEPENDS:${PN} += "bash elfutils-binutils"
BBCLASSEXTEND = "native nativesdk"
@@ -0,0 +1,102 @@
From 4c797d3b559ba51bd9ccd9a2036245819acce843 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 23 Mar 2023 10:54:21 +0800
Subject: [PATCH] tools: Add error.h for non-glibc case
error is glibc specific API, so this patch will mostly not accepted
upstream given that elfutils has been closely tied to glibc
This is a OE specific workaround for musl.
Upstream-Status: Inappropriate [OE Specific]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
tools/debugedit.c | 7 ++++++-
tools/error.h | 27 +++++++++++++++++++++++++++
tools/sepdebugcrcfix.c | 7 ++++++-
3 files changed, 39 insertions(+), 2 deletions(-)
create mode 100644 tools/error.h
diff --git a/tools/debugedit.c b/tools/debugedit.c
index 668777a..a72c3c0 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -25,7 +25,6 @@
#include <byteswap.h>
#include <endian.h>
#include <errno.h>
-#include <error.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
@@ -40,6 +39,12 @@
#include <gelf.h>
#include <dwarf.h>
+#ifdef __GLIBC__
+#include <error.h>
+#else
+#include "error.h"
+#endif
+
#ifndef MAX
#define MAX(m, n) ((m) < (n) ? (n) : (m))
#endif
diff --git a/tools/error.h b/tools/error.h
new file mode 100644
index 0000000..9b24418
--- /dev/null
+++ b/tools/error.h
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+}
+
+#endif /* _ERROR_H_ */
diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
index da50e6c..c4a9d56 100644
--- a/tools/sepdebugcrcfix.c
+++ b/tools/sepdebugcrcfix.c
@@ -29,10 +29,15 @@
#include <endian.h>
#include <stdio.h>
#include <stdlib.h>
-#include <error.h>
#include <libelf.h>
#include <gelf.h>
+#ifdef __GLIBC__
+#include <error.h>
+#else
+#include "error.h"
+#endif
+
#ifndef _
#define _(x) x
#endif
--
2.17.1
@@ -0,0 +1,56 @@
From 3e05bbc1f7909ab6f529e66f0d0f70fb1e60583a Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 23 Mar 2023 11:55:53 +0800
Subject: [PATCH 2/2] sepdebugcrcfix.c: do not use 64bit variants
configure.ac checks for largefile support via AC_SYS_LARGEFILE
already, therefore use off_t, open and lseek instead of 64bit
variants. Musl e.g. does not define them without _LARGEFILE64_SOURCE
and error is not seen on glibc because _GNU_SOURCE defines
_LARGEFILE64_SOURCE.
This patch is marked as inappropriate as debugedit obviously only
wants to support glibc or some glibc compatible libcs. We can see
this from the error() usage. And this patch is only for musl.
Upstream-Status: Inappropriate [OE Specific]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
tools/sepdebugcrcfix.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
index c4a9d56..882e5f5 100644
--- a/tools/sepdebugcrcfix.c
+++ b/tools/sepdebugcrcfix.c
@@ -144,7 +144,7 @@ crc32 (const char *fname, const char *base_fname, uint32_t *crcp)
error (0, errno, _("cannot open \"%s\""), debugname);
return false;
}
- off64_t size = lseek64 (fd, 0, SEEK_END);
+ off_t size = lseek (fd, 0, SEEK_END);
if (size == -1)
{
error (0, errno, _("cannot get size of \"%s\""), debugname);
@@ -289,7 +289,7 @@ process (Elf *elf, int fd, const char *fname)
return true;
}
updated_count++;
- off64_t seekto = (shdr->sh_offset + data->d_off
+ off_t seekto = (shdr->sh_offset + data->d_off
+ (crcp - (const uint8_t *) data->d_buf));
uint32_t crc_targetendian = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
? htole32 (crc) : htobe32 (crc));
@@ -361,7 +361,7 @@ main (int argc, char **argv)
error (0, errno, _("cannot chmod \"%s\" to make sure we can read and write"), fname);
bool failed = false;
- int fd = open64 (fname, O_RDWR);
+ int fd = open (fname, O_RDWR);
if (fd == -1)
{
error (0, errno, _("cannot open \"%s\""), fname);
--
2.17.1
@@ -0,0 +1,65 @@
From 4f0d7d2f4900ce8555e09854dc681278b7a3d9a9 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 23 Mar 2023 13:09:23 +0800
Subject: [PATCH 3/3] Makefile.am: do not update manual
The tarball ships these manuals, no need to re-generate them.
We have local patches for debugedit.c and sepdebugcrcfix.c,
this will triger re-generation of the manuals, which causes
error of missing help2man.
This is an OE specific patch. If we don't have local patches
patching debugedit.c and sepdebugcrcfix.c, this patch is also
not needed.
Upstream-Status: Inappropriate [OE Specific]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
Makefile.am | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 98b2f20..f91deea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,36 +52,6 @@ sepdebugcrcfix_LDADD = @LIBELF_LIBS@
# Manual pages are generated for dist
dist_man_MANS = debugedit.1 sepdebugcrcfix.1 find-debuginfo.1
-# The 'case' ensures the man pages are only generated if the corresponding
-# source script (the first prerequisite) or configure.ac (for the version)
-# has been changed. The executable prerequisite is solely meant to force
-# these docs to be made only after the executable has been compiled.
-# This makes sure help2man is not normally necessary (since the generated
-# man pages are distributed).
-debugedit.1: tools/debugedit.c configure.ac debugedit$(EXEEXT)
- @case '$?' in \
- *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \
- --name='debug source path manipulation tool' \
- ./debugedit$(EXEEXT) ;; \
- * ) : ;; \
- esac
-
-sepdebugcrcfix.1: tools/sepdebugcrcfix.c configure.ac sepdebugcrcfix$(EXEEXT)
- @case '$?' in \
- *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \
- --name='fixes CRC for separate .debug files' \
- ./sepdebugcrcfix$(EXEEXT) ;;\
- * ) : ;; \
- esac
-
-find-debuginfo.1: $(top_srcdir)/scripts/find-debuginfo.in configure.ac find-debuginfo
- @case '$?' in \
- *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \
- --name='finds debuginfo and processes it' \
- ./find-debuginfo ;;\
- * ) : ;; \
- esac
-
noinst_HEADERS= tools/ansidecl.h \
tools/hashtab.h \
tools/md5.h \
--
2.17.1
@@ -0,0 +1,18 @@
SUMMARY = "GNU unit testing framework, written in Expect and Tcl"
DESCRIPTION = "DejaGnu is a framework for testing other programs. Its purpose \
is to provide a single front end for all tests."
HOMEPAGE = "https://www.gnu.org/software/dejagnu/"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
SECTION = "devel"
DEPENDS += "expect-native"
RDEPENDS:${PN} = "expect"
inherit autotools
SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz"
SRC_URI[sha256sum] = "87daefacd7958b4a69f88c6856dbd1634261963c414079d0c371f589cd66a2e3"
BBCLASSEXTEND = "native"
@@ -0,0 +1,25 @@
SUMMARY = "Command line utilities for working with *.desktop files"
DESCRIPTION = "desktop-file-utils contains a few command line utilities for working with desktop entries"
HOMEPAGE = "http://www.freedesktop.org/wiki/Software/desktop-file-utils"
SECTION = "console/utils"
LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://src/validator.c;beginline=4;endline=27;md5=281e1114ee6c486a1a0a4295986b9416"
SRC_URI = "http://freedesktop.org/software/${BPN}/releases/${BP}.tar.xz"
SRC_URI[md5sum] = "29739e005f5887cf41639b8450f3c23f"
SRC_URI[sha256sum] = "b26dbde79ea72c8c84fb7f9d870ffd857381d049a86d25e0038c4cef4c747309"
DEPENDS = "glib-2.0"
inherit autotools pkgconfig
EXTRA_OECONF += "ac_cv_prog_EMACS=no"
BBCLASSEXTEND = "native nativesdk"
do_install:append() {
rm -rf ${D}${datadir}/emacs
}
@@ -0,0 +1,23 @@
SUMMARY = "Sets up distcc for compilation on the target device"
DESCRIPTION = "${SUMMARY}"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "file://distcc.sh"
S = "${WORKDIR}"
# Default to the host machine for a running qemu session
DISTCC_HOSTS ?= "192.168.7.1"
do_configure() {
sed -i "s%@DISTCC_HOSTS@%${DISTCC_HOSTS}%" distcc.sh
}
do_install() {
install -d ${D}${sysconfdir}/profile.d
install -m 0755 distcc.sh ${D}${sysconfdir}/profile.d/
}
RDEPENDS:${PN} = "distcc"
@@ -0,0 +1,4 @@
DISTCC_HOSTS="@DISTCC_HOSTS@"
#DISTCC_VERBOSE="1"
export DISTCC_HOSTS
@@ -0,0 +1,17 @@
SUMMARY = "Configuration script to export target rootfs filesystem"
DESCRIPTION = "Enables NFS access from any host to the entire filesystem (for development purposes)."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
PR = "r1"
SRC_URI = "file://exports"
S = "${WORKDIR}"
do_install() {
install -d ${D}${sysconfdir}
install -m 0644 exports ${D}${sysconfdir}/
}
RDEPENDS:${PN} = "packagegroup-core-nfs-server"
@@ -0,0 +1 @@
/ *(rw,no_root_squash,async,no_subtree_check)
@@ -0,0 +1,32 @@
From 1046593aacb74ff888a0d68c0ff89b20c4bc9ed4 Mon Sep 17 00:00:00 2001
From: Kai Kang <kai.kang@windriver.com>
Date: Tue, 15 May 2018 17:17:01 +0800
Subject: [PATCH] diffstat: fix wrong evaluation of CC
Upstream-Status: Inappropriate [oe specific]
m4 function CF_CC_ENV_FLAGS checks whether variable CC contains options '-I', '-U'
and '-D'. It is not suitable for oe that option such as '-D_FORTIFY_SOURCE=2' may
be included in CC. And then CC will be wrongly filtered.
So comment out CF_CC_ENV_FLAGS from function CF_PROG_CC.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
aclocal.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 9281aa8..dd57b7a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1239,7 +1239,7 @@ CF_GCC_VERSION
CF_ACVERSION_CHECK(2.52,
[AC_PROG_CC_STDC],
[CF_ANSI_CC_REQD])
-CF_CC_ENV_FLAGS
+dnl CF_CC_ENV_FLAGS
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19
@@ -0,0 +1,5 @@
#!/bin/sh
./testing/run_test.sh ./testing/case*.pat |sed \
-e 's|** ok|PASS|' \
-e 's|?? fail|FAIL|'
@@ -0,0 +1,27 @@
SUMMARY = "Tool to produce a statistics based on a diff"
DESCRIPTION = "diffstat reads the output of diff and displays a histogram of \
the insertions, deletions, and modifications per-file. It is useful for \
reviewing large, complex patch files."
HOMEPAGE = "http://invisible-island.net/diffstat/"
SECTION = "devel"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=6450594049f0eed1052e634ddcbeec28"
SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \
file://run-ptest \
file://avoid-check-user-break-cc.patch \
"
SRC_URI[sha256sum] = "8cf27424926debcd85921755c3915559288244bd103f62d740dc6b83b557a28a"
inherit autotools gettext ptest
EXTRA_AUTORECONF += "--exclude=aclocal"
LDFLAGS += "${TOOLCHAIN_OPTIONS}"
do_install_ptest() {
cp -r ${S}/testing ${D}${PTEST_PATH}
}
BBCLASSEXTEND = "nativesdk"
@@ -0,0 +1,88 @@
SUMMARY = "A parallel build system"
DESCRIPTION = "distcc is a parallel build system that distributes \
compilation of C/C++/ObjC code across machines on a network."
HOMEPAGE = "https://github.com/distcc/distcc"
SECTION = "devel"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
DEPENDS = "avahi binutils"
PACKAGECONFIG ??= "popt"
PACKAGECONFIG[gtk] = "--with-gtk,--without-gtk --without-gnome,gtk+"
# use system popt by default
PACKAGECONFIG[popt] = "--without-included-popt,--with-included-popt,popt"
RRECOMMENDS:${PN}-server = "avahi-daemon"
SRC_URI = "git://github.com/distcc/distcc.git;branch=master;protocol=https \
file://default \
file://distcc \
file://distcc.service \
"
SRCREV = "50d821efe99cae82c05be0a4ab3b4035ef0d3883"
S = "${WORKDIR}/git"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
inherit autotools pkgconfig update-rc.d useradd systemd
ASNEEDED = ""
EXTRA_OECONF += "--disable-Werror PYTHON='' --disable-pump-mode"
PACKAGE_BEFORE_PN = "${PN}-distmon-gnome ${PN}-server"
USERADD_PACKAGES = "${PN}-server"
USERADD_PARAM:${PN}-server = "--system \
--home /dev/null \
--no-create-home \
--gid nogroup \
distcc"
UPDATERCPN = "${PN}-server"
INITSCRIPT_NAME = "distcc"
SYSTEMD_PACKAGES = "${PN}-server"
SYSTEMD_SERVICE:${PN}-server = "distcc.service"
do_install() {
# Improve reproducibility: compress w/o timestamps
oe_runmake 'DESTDIR=${D}' "GZIP_BIN=gzip -n" install
install -d ${D}${sysconfdir}/init.d/
install -d ${D}${sysconfdir}/default
install -m 0755 ${WORKDIR}/distcc ${D}${sysconfdir}/init.d/
install -m 0755 ${WORKDIR}/default ${D}${sysconfdir}/default/distcc
install -d ${D}${systemd_system_unitdir}/
install -m 0644 ${WORKDIR}/distcc.service ${D}${systemd_system_unitdir}
sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/distcc.service
}
FILES:${PN}-server = "${sysconfdir} \
${bindir}/distccd \
${sbindir}"
FILES:${PN}-distmon-gnome = "${bindir}/distccmon-gnome \
${datadir}/applications \
${datadir}/pixmaps"
#
# distcc upstream dropped the 3.2 branch which we reference in older project releases
# the revisions are there, just the branch is not. In order to be able to continue
# to build those old releases, adjust any mirror tarball to contain the missing branch
#
fixup_distcc_mirror_tarball () {
TBALL=${DL_DIR}/git2_github.com.distcc.distcc.git.tar.gz
if [ -f $TBALL ]; then
TDIR=`mktemp -d`
cd $TDIR
tar -xzf $TBALL
set +e
git rev-parse --verify 3.2
if [ "$?" != "0" ]; then
git branch 3.2 d8b18df3e9dcbe4f092bed565835d3975e99432c
tar -czf $TBALL *
fi
set -e
rm -rf $TDIR/*
fi
}
do_fetch[postfuncs] += "fixup_distcc_mirror_tarball"
@@ -0,0 +1,24 @@
# Defaults for distcc initscript
# sourced by /etc/init.d/distcc
#
# should distcc be started on boot?
#
# STARTDISTCC="true"
STARTDISTCC="true"
#
# Which networks/hosts should be allowed to connect to the daemon?
# You can list multiple hosts/networks separated by spaces.
# Networks have to be in CIDR notation, f.e. 192.168.1.0/24
# Hosts are represented by a single IP Adress
#
# ALLOWEDNETS="127.0.0.1"
ALLOWEDNETS="127.0.0.1"
#
# OPTIONS is used for the systemd service file
#
OPTIONS="--allow 127.0.0.1 --enable-tcp-insecure"

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