Merge branch 'freebsd/current/main' into hardened/current/master

This commit is contained in:
HardenedBSD Sync Services 2024-11-08 12:01:23 -07:00
commit 6722c4435b
No known key found for this signature in database
54 changed files with 536 additions and 137 deletions

View File

@ -25,10 +25,12 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <new>
#include <optional>
#include <utility>
@ -326,29 +328,49 @@ struct LazyOffsetPtr {
///
/// If the low bit is clear, a pointer to the AST node. If the low
/// bit is set, the upper 63 bits are the offset.
mutable uint64_t Ptr = 0;
static constexpr size_t DataSize = std::max(sizeof(uint64_t), sizeof(T *));
alignas(uint64_t) alignas(T *) mutable unsigned char Data[DataSize] = {};
unsigned char GetLSB() const {
return Data[llvm::sys::IsBigEndianHost ? DataSize - 1 : 0];
}
template <typename U> U &As(bool New) const {
unsigned char *Obj =
Data + (llvm::sys::IsBigEndianHost ? DataSize - sizeof(U) : 0);
if (New)
return *new (Obj) U;
return *std::launder(reinterpret_cast<U *>(Obj));
}
T *&GetPtr() const { return As<T *>(false); }
uint64_t &GetU64() const { return As<uint64_t>(false); }
void SetPtr(T *Ptr) const { As<T *>(true) = Ptr; }
void SetU64(uint64_t U64) const { As<uint64_t>(true) = U64; }
public:
LazyOffsetPtr() = default;
explicit LazyOffsetPtr(T *Ptr) : Ptr(reinterpret_cast<uint64_t>(Ptr)) {}
explicit LazyOffsetPtr(T *Ptr) : Data() { SetPtr(Ptr); }
explicit LazyOffsetPtr(uint64_t Offset) : Ptr((Offset << 1) | 0x01) {
explicit LazyOffsetPtr(uint64_t Offset) : Data() {
assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
if (Offset == 0)
Ptr = 0;
SetPtr(nullptr);
else
SetU64((Offset << 1) | 0x01);
}
LazyOffsetPtr &operator=(T *Ptr) {
this->Ptr = reinterpret_cast<uint64_t>(Ptr);
SetPtr(Ptr);
return *this;
}
LazyOffsetPtr &operator=(uint64_t Offset) {
assert((Offset << 1 >> 1) == Offset && "Offsets must require < 63 bits");
if (Offset == 0)
Ptr = 0;
SetPtr(nullptr);
else
Ptr = (Offset << 1) | 0x01;
SetU64((Offset << 1) | 0x01);
return *this;
}
@ -356,15 +378,15 @@ public:
/// Whether this pointer is non-NULL.
///
/// This operation does not require the AST node to be deserialized.
explicit operator bool() const { return Ptr != 0; }
explicit operator bool() const { return isOffset() || GetPtr() != nullptr; }
/// Whether this pointer is non-NULL.
///
/// This operation does not require the AST node to be deserialized.
bool isValid() const { return Ptr != 0; }
bool isValid() const { return isOffset() || GetPtr() != nullptr; }
/// Whether this pointer is currently stored as an offset.
bool isOffset() const { return Ptr & 0x01; }
bool isOffset() const { return GetLSB() & 0x01; }
/// Retrieve the pointer to the AST node that this lazy pointer points to.
///
@ -375,9 +397,9 @@ public:
if (isOffset()) {
assert(Source &&
"Cannot deserialize a lazy pointer without an AST source");
Ptr = reinterpret_cast<uint64_t>((Source->*Get)(OffsT(Ptr >> 1)));
SetPtr((Source->*Get)(OffsT(GetU64() >> 1)));
}
return reinterpret_cast<T*>(Ptr);
return GetPtr();
}
/// Retrieve the address of the AST node pointer. Deserializes the pointee if
@ -385,7 +407,7 @@ public:
T **getAddressOfPointer(ExternalASTSource *Source) const {
// Ensure the integer is in pointer form.
(void)get(Source);
return reinterpret_cast<T**>(&Ptr);
return &GetPtr();
}
};

View File

@ -311,7 +311,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
switch (Triple.getEnvironment()) {
case llvm::Triple::Android:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIT64:
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABIHFT64:
case llvm::Triple::MuslEABI:
case llvm::Triple::MuslEABIHF:
case llvm::Triple::OpenHOS:

View File

@ -337,6 +337,10 @@ protected:
Builder.defineMacro("_GNU_SOURCE");
if (this->HasFloat128)
Builder.defineMacro("__FLOAT128__");
if (Triple.isTime64ABI()) {
Builder.defineMacro("_FILE_OFFSET_BITS", "64");
Builder.defineMacro("_TIME_BITS", "64");
}
}
public:

View File

@ -1001,6 +1001,24 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
// Can't find the field referenced by the "counted_by" attribute.
return nullptr;
if (isa<DeclRefExpr>(Base))
// The whole struct is specificed in the __bdos. The calculation of the
// whole size of the structure can be done in two ways:
//
// 1) sizeof(struct S) + count * sizeof(typeof(fam))
// 2) offsetof(struct S, fam) + count * sizeof(typeof(fam))
//
// The first will add additional padding after the end of the array,
// allocation while the second method is more precise, but not quite
// expected from programmers. See
// https://lore.kernel.org/lkml/ZvV6X5FPBBW7CO1f@archlinux/ for a
// discussion of the topic.
//
// GCC isn't (currently) able to calculate __bdos on a pointer to the whole
// structure. Therefore, because of the above issue, we'll choose to match
// what GCC does for consistency's sake.
return nullptr;
// Build a load of the counted_by field.
bool IsSigned = CountedByFD->getType()->isSignedIntegerType();
Value *CountedByInst = EmitCountedByFieldExpr(Base, FAMDecl, CountedByFD);
@ -1031,32 +1049,9 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
CharUnits Size = Ctx.getTypeSizeInChars(ArrayTy->getElementType());
llvm::Constant *ElemSize =
llvm::ConstantInt::get(ResType, Size.getQuantity(), IsSigned);
Value *FAMSize =
Value *Res =
Builder.CreateMul(CountedByInst, ElemSize, "", !IsSigned, IsSigned);
FAMSize = Builder.CreateIntCast(FAMSize, ResType, IsSigned);
Value *Res = FAMSize;
if (isa<DeclRefExpr>(Base)) {
// The whole struct is specificed in the __bdos.
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(OuterRD);
// Get the offset of the FAM.
llvm::Constant *FAMOffset = ConstantInt::get(ResType, Offset, IsSigned);
Value *OffsetAndFAMSize =
Builder.CreateAdd(FAMOffset, Res, "", !IsSigned, IsSigned);
// Get the full size of the struct.
llvm::Constant *SizeofStruct =
ConstantInt::get(ResType, Layout.getSize().getQuantity(), IsSigned);
// max(sizeof(struct s),
// offsetof(struct s, array) + p->count * sizeof(*p->array))
Res = IsSigned
? Builder.CreateBinaryIntrinsic(llvm::Intrinsic::smax,
OffsetAndFAMSize, SizeofStruct)
: Builder.CreateBinaryIntrinsic(llvm::Intrinsic::umax,
OffsetAndFAMSize, SizeofStruct);
}
Res = Builder.CreateIntCast(Res, ResType, IsSigned);
// A negative \p IdxInst or \p CountedByInst means that the index lands
// outside of the flexible array member. If that's the case, we want to

View File

@ -177,10 +177,7 @@ createTargetCodeGenInfo(CodeGenModule &CGM) {
else if (ABIStr == "aapcs16")
Kind = ARMABIKind::AAPCS16_VFP;
else if (CodeGenOpts.FloatABI == "hard" ||
(CodeGenOpts.FloatABI != "soft" &&
(Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
Triple.getEnvironment() == llvm::Triple::MuslEABIHF ||
Triple.getEnvironment() == llvm::Triple::EABIHF)))
(CodeGenOpts.FloatABI != "soft" && Triple.isHardFloatABI()))
Kind = ARMABIKind::AAPCS_VFP;
return createARMTargetCodeGenInfo(CGM, Kind);
@ -1137,6 +1134,11 @@ void CodeGenModule::Release() {
CodeGenOpts.SanitizeCfiCanonicalJumpTables);
}
if (CodeGenOpts.SanitizeCfiICallNormalizeIntegers) {
getModule().addModuleFlag(llvm::Module::Override, "cfi-normalize-integers",
1);
}
if (LangOpts.Sanitize.has(SanitizerKind::KCFI)) {
getModule().addModuleFlag(llvm::Module::Override, "kcfi", 1);
// KCFI assumes patchable-function-prefix is the same for all indirectly

View File

@ -35,7 +35,9 @@ public:
case llvm::Triple::EABI:
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIT64:
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABIHFT64:
case llvm::Triple::MuslEABI:
case llvm::Triple::MuslEABIHF:
return true;
@ -48,6 +50,7 @@ public:
switch (getTarget().getTriple().getEnvironment()) {
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABIHFT64:
case llvm::Triple::MuslEABIHF:
return true;
default:

View File

@ -602,7 +602,8 @@ static llvm::Triple computeTargetTriple(const Driver &D,
if (A->getOption().matches(options::OPT_m64) ||
A->getOption().matches(options::OPT_maix64)) {
AT = Target.get64BitArchVariant().getArch();
if (Target.getEnvironment() == llvm::Triple::GNUX32)
if (Target.getEnvironment() == llvm::Triple::GNUX32 ||
Target.getEnvironment() == llvm::Triple::GNUT64)
Target.setEnvironment(llvm::Triple::GNU);
else if (Target.getEnvironment() == llvm::Triple::MuslX32)
Target.setEnvironment(llvm::Triple::Musl);
@ -665,11 +666,13 @@ static llvm::Triple computeTargetTriple(const Driver &D,
} else if (ABIName == "n32") {
Target = Target.get64BitArchVariant();
if (Target.getEnvironment() == llvm::Triple::GNU ||
Target.getEnvironment() == llvm::Triple::GNUT64 ||
Target.getEnvironment() == llvm::Triple::GNUABI64)
Target.setEnvironment(llvm::Triple::GNUABIN32);
} else if (ABIName == "64") {
Target = Target.get64BitArchVariant();
if (Target.getEnvironment() == llvm::Triple::GNU ||
Target.getEnvironment() == llvm::Triple::GNUT64 ||
Target.getEnvironment() == llvm::Triple::GNUABIN32)
Target.setEnvironment(llvm::Triple::GNUABI64);
}

View File

@ -327,6 +327,11 @@ void arm::setFloatABIInTriple(const Driver &D, const ArgList &Args,
Triple.setEnvironment(isHardFloat ? llvm::Triple::GNUEABIHF
: llvm::Triple::GNUEABI);
break;
case llvm::Triple::GNUEABIT64:
case llvm::Triple::GNUEABIHFT64:
Triple.setEnvironment(isHardFloat ? llvm::Triple::GNUEABIHFT64
: llvm::Triple::GNUEABIT64);
break;
case llvm::Triple::EABI:
case llvm::Triple::EABIHF:
Triple.setEnvironment(isHardFloat ? llvm::Triple::EABIHF
@ -414,10 +419,12 @@ arm::FloatABI arm::getDefaultFloatABI(const llvm::Triple &Triple) {
return FloatABI::Soft;
switch (Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABIHFT64:
case llvm::Triple::MuslEABIHF:
case llvm::Triple::EABIHF:
return FloatABI::Hard;
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIT64:
case llvm::Triple::MuslEABI:
case llvm::Triple::EABI:
// EABI is always AAPCS, and if it was not marked 'hard', it's softfp

View File

@ -2694,6 +2694,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
case llvm::Triple::thumb:
LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHFT64 ||
TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == llvm::Triple::EABIHF) {
TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
@ -2705,6 +2706,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
case llvm::Triple::thumbeb:
LibDirs.append(begin(ARMebLibDirs), end(ARMebLibDirs));
if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHFT64 ||
TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == llvm::Triple::EABIHF) {
TripleAliases.append(begin(ARMebHFTriples), end(ARMebHFTriples));

View File

@ -508,6 +508,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
case llvm::Triple::thumbeb: {
const bool HF =
Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
Triple.getEnvironment() == llvm::Triple::GNUEABIHFT64 ||
tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard;
LibDir = "lib";

View File

@ -2500,6 +2500,11 @@ bool UnwrappedLineParser::parseBracedList(bool IsAngleBracket, bool IsEnum) {
// Assume there are no blocks inside a braced init list apart
// from the ones we explicitly parse out (like lambdas).
FormatTok->setBlockKind(BK_BracedInit);
if (!IsAngleBracket) {
auto *Prev = FormatTok->Previous;
if (Prev && Prev->is(tok::greater))
Prev->setFinalizedType(TT_TemplateCloser);
}
nextToken();
parseBracedList();
break;

View File

@ -1508,10 +1508,13 @@ StmtResult Parser::ParseIfStatement(SourceLocation *TrailingElseLoc) {
SourceLocation ConstevalLoc;
if (Tok.is(tok::kw_constexpr)) {
Diag(Tok, getLangOpts().CPlusPlus17 ? diag::warn_cxx14_compat_constexpr_if
: diag::ext_constexpr_if);
IsConstexpr = true;
ConsumeToken();
// C23 supports constexpr keyword, but only for object definitions.
if (getLangOpts().CPlusPlus) {
Diag(Tok, getLangOpts().CPlusPlus17 ? diag::warn_cxx14_compat_constexpr_if
: diag::ext_constexpr_if);
IsConstexpr = true;
ConsumeToken();
}
} else {
if (Tok.is(tok::exclaim)) {
NotLocation = ConsumeToken();

View File

@ -69,8 +69,8 @@ public:
ExtractTypeForDeductionGuide(
Sema &SemaRef,
llvm::SmallVectorImpl<TypedefNameDecl *> &MaterializedTypedefs,
ClassTemplateDecl *NestedPattern,
const MultiLevelTemplateArgumentList *OuterInstantiationArgs)
ClassTemplateDecl *NestedPattern = nullptr,
const MultiLevelTemplateArgumentList *OuterInstantiationArgs = nullptr)
: Base(SemaRef), MaterializedTypedefs(MaterializedTypedefs),
NestedPattern(NestedPattern),
OuterInstantiationArgs(OuterInstantiationArgs) {
@ -1263,10 +1263,25 @@ FunctionTemplateDecl *DeclareAggregateDeductionGuideForTypeAlias(
getRHSTemplateDeclAndArgs(SemaRef, AliasTemplate).first;
if (!RHSTemplate)
return nullptr;
llvm::SmallVector<TypedefNameDecl *> TypedefDecls;
llvm::SmallVector<QualType> NewParamTypes;
ExtractTypeForDeductionGuide TypeAliasTransformer(SemaRef, TypedefDecls);
for (QualType P : ParamTypes) {
QualType Type = TypeAliasTransformer.TransformType(P);
if (Type.isNull())
return nullptr;
NewParamTypes.push_back(Type);
}
auto *RHSDeductionGuide = SemaRef.DeclareAggregateDeductionGuideFromInitList(
RHSTemplate, ParamTypes, Loc);
RHSTemplate, NewParamTypes, Loc);
if (!RHSDeductionGuide)
return nullptr;
for (TypedefNameDecl *TD : TypedefDecls)
TD->setDeclContext(RHSDeductionGuide->getTemplatedDecl());
return BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate,
RHSDeductionGuide, Loc);
}

View File

@ -2665,7 +2665,8 @@ void ASTDeclReader::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
D->setDeclaredWithTypename(Record.readInt());
if (D->hasTypeConstraint()) {
const bool TypeConstraintInitialized = Record.readBool();
if (TypeConstraintInitialized && D->hasTypeConstraint()) {
ConceptReference *CR = nullptr;
if (Record.readBool())
CR = Record.readConceptReference();

View File

@ -1880,7 +1880,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
Record.push_back(D->wasDeclaredWithTypename());
const TypeConstraint *TC = D->getTypeConstraint();
assert((bool)TC == D->hasTypeConstraint());
Record.push_back(/*TypeConstraintInitialized=*/TC != nullptr);
if (TC) {
auto *CR = TC->getConceptReference();
Record.push_back(CR != nullptr);
@ -1898,7 +1898,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
if (OwnsDefaultArg)
Record.AddTemplateArgumentLoc(D->getDefaultArgument());
if (!TC && !OwnsDefaultArg &&
if (!D->hasTypeConstraint() && !OwnsDefaultArg &&
D->getDeclContext() == D->getLexicalDeclContext() &&
!D->isInvalidDecl() && !D->hasAttrs() &&
!D->isTopLevelDeclInObjCContainer() && !D->isImplicit() &&
@ -2561,6 +2561,7 @@ void ASTWriter::WriteDeclAbbrevs() {
// TemplateTypeParmDecl
Abv->Add(
BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
Abv->Add(BitCodeAbbrevOp(0)); // TypeConstraintInitialized
Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));

View File

@ -11,6 +11,10 @@
// Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
#undef _FILE_OFFSET_BITS
// Avoid conflict between `_TIME_BITS` defined vs. `_FILE_OFFSET_BITS`
// undefined in some Linux configurations.
#undef _TIME_BITS
#include "sanitizer_platform.h"
#if SANITIZER_SOLARIS
# include <fcntl.h>

View File

@ -27,7 +27,7 @@
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
// defined to XXYYZZ.
# define _LIBCPP_VERSION 190102
# define _LIBCPP_VERSION 190103
# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)

View File

@ -294,7 +294,11 @@ public:
PAuthTest,
LastEnvironmentType = PAuthTest
GNUT64,
GNUEABIT64,
GNUEABIHFT64,
LastEnvironmentType = GNUEABIHFT64
};
enum ObjectFormatType {
UnknownObjectFormat,
@ -605,11 +609,12 @@ public:
bool isGNUEnvironment() const {
EnvironmentType Env = getEnvironment();
return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
Env == Triple::GNUEABIHF || Env == Triple::GNUF32 ||
Env == Triple::GNUF64 || Env == Triple::GNUSF ||
Env == Triple::GNUX32;
return Env == Triple::GNU || Env == Triple::GNUT64 ||
Env == Triple::GNUABIN32 || Env == Triple::GNUABI64 ||
Env == Triple::GNUEABI || Env == Triple::GNUEABIT64 ||
Env == Triple::GNUEABIHF || Env == Triple::GNUEABIHFT64 ||
Env == Triple::GNUF32 || Env == Triple::GNUF64 ||
Env == Triple::GNUSF || Env == Triple::GNUX32;
}
/// Tests whether the OS is Haiku.
@ -866,9 +871,11 @@ public:
return (isARM() || isThumb()) &&
(getEnvironment() == Triple::EABI ||
getEnvironment() == Triple::GNUEABI ||
getEnvironment() == Triple::GNUEABIT64 ||
getEnvironment() == Triple::MuslEABI ||
getEnvironment() == Triple::EABIHF ||
getEnvironment() == Triple::GNUEABIHF ||
getEnvironment() == Triple::GNUEABIHFT64 ||
getEnvironment() == Triple::OpenHOS ||
getEnvironment() == Triple::MuslEABIHF || isAndroid()) &&
isOSBinFormatELF();
@ -1046,6 +1053,22 @@ public:
return getArch() == Triple::bpfel || getArch() == Triple::bpfeb;
}
/// Tests if the target forces 64-bit time_t on a 32-bit architecture.
bool isTime64ABI() const {
EnvironmentType Env = getEnvironment();
return Env == Triple::GNUT64 || Env == Triple::GNUEABIT64 ||
Env == Triple::GNUEABIHFT64;
}
/// Tests if the target forces hardfloat.
bool isHardFloatABI() const {
EnvironmentType Env = getEnvironment();
return Env == llvm::Triple::GNUEABIHF ||
Env == llvm::Triple::GNUEABIHFT64 ||
Env == llvm::Triple::MuslEABIHF ||
Env == llvm::Triple::EABIHF;
}
/// Tests whether the target supports comdat
bool supportsCOMDAT() const {
return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||

View File

@ -1784,8 +1784,8 @@ Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V,
}
#if defined(HAS_IEE754_FLOAT128) && defined(HAS_LOGF128)
Constant *ConstantFoldFP128(long double (*NativeFP)(long double),
const APFloat &V, Type *Ty) {
Constant *ConstantFoldFP128(float128 (*NativeFP)(float128), const APFloat &V,
Type *Ty) {
llvm_fenv_clearexcept();
float128 Result = NativeFP(V.convertToQuad());
if (llvm_fenv_testexcept()) {

View File

@ -325,7 +325,9 @@ public:
}
bool isTargetGNUAEABI() const {
return (TargetTriple.getEnvironment() == Triple::GNUEABI ||
TargetTriple.getEnvironment() == Triple::GNUEABIHF) &&
TargetTriple.getEnvironment() == Triple::GNUEABIT64 ||
TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == Triple::GNUEABIHFT64) &&
!isTargetDarwin() && !isTargetWindows();
}
bool isTargetMuslAEABI() const {

View File

@ -241,7 +241,9 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
Options.EABIVersion == EABI::Unknown) {
// musl is compatible with glibc with regard to EABI version
if ((TargetTriple.getEnvironment() == Triple::GNUEABI ||
TargetTriple.getEnvironment() == Triple::GNUEABIT64 ||
TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == Triple::GNUEABIHFT64 ||
TargetTriple.getEnvironment() == Triple::MuslEABI ||
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == Triple::OpenHOS) &&

View File

@ -64,6 +64,7 @@ public:
bool isTargetHardFloat() const {
return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
TargetTriple.getEnvironment() == Triple::GNUEABIHFT64 ||
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
TargetTriple.getEnvironment() == Triple::EABIHF ||
(TargetTriple.isOSBinFormatMachO() &&

View File

@ -88,15 +88,15 @@ static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
/// Adjusts the value of a relative branch target before fixup application.
static void adjustRelativeBranch(unsigned Size, const MCFixup &Fixup,
uint64_t &Value, MCContext *Ctx = nullptr) {
// Jumps are relative to the current instruction.
Value -= 2;
// We have one extra bit of precision because the value is rightshifted by
// one.
signed_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
// Rightshifts the value by one.
AVR::fixups::adjustBranchTarget(Value);
// Jumps are relative to the current instruction.
Value -= 1;
}
/// 22-bit absolute fixup.

View File

@ -202,8 +202,7 @@ public:
bool runOnModule(Module &M) override {
FeatureBitset Features = coalesceFeatures(M);
std::string FeatureStr =
getFeatureString(Features, WasmTM->getTargetFeatureString());
std::string FeatureStr = getFeatureString(Features);
WasmTM->setTargetFeatureString(FeatureStr);
for (auto &F : M)
replaceFeatures(F, FeatureStr);
@ -241,17 +240,14 @@ private:
return Features;
}
static std::string getFeatureString(const FeatureBitset &Features,
StringRef TargetFS) {
static std::string getFeatureString(const FeatureBitset &Features) {
std::string Ret;
for (const SubtargetFeatureKV &KV : WebAssemblyFeatureKV) {
if (Features[KV.Value])
Ret += (StringRef("+") + KV.Key + ",").str();
else
Ret += (StringRef("-") + KV.Key + ",").str();
}
SubtargetFeatures TF{TargetFS};
for (std::string const &F : TF.getFeatures())
if (!SubtargetFeatures::isEnabled(F))
Ret += F + ",";
return Ret;
}

View File

@ -554,7 +554,9 @@ StringRef ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) {
switch (TT.getEnvironment()) {
case Triple::Android:
case Triple::GNUEABI:
case Triple::GNUEABIT64:
case Triple::GNUEABIHF:
case Triple::GNUEABIHFT64:
case Triple::MuslEABI:
case Triple::MuslEABIHF:
case Triple::OpenHOS:
@ -635,6 +637,7 @@ StringRef ARM::getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch) {
switch (Triple.getEnvironment()) {
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABIHFT64:
case llvm::Triple::MuslEABIHF:
return "arm1176jzf-s";
default:

View File

@ -317,10 +317,13 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
case EABI: return "eabi";
case EABIHF: return "eabihf";
case GNU: return "gnu";
case GNUT64: return "gnut64";
case GNUABI64: return "gnuabi64";
case GNUABIN32: return "gnuabin32";
case GNUEABI: return "gnueabi";
case GNUEABIT64: return "gnueabit64";
case GNUEABIHF: return "gnueabihf";
case GNUEABIHFT64: return "gnueabihft64";
case GNUF32: return "gnuf32";
case GNUF64: return "gnuf64";
case GNUSF: return "gnusf";
@ -693,7 +696,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
.StartsWith("eabi", Triple::EABI)
.StartsWith("gnuabin32", Triple::GNUABIN32)
.StartsWith("gnuabi64", Triple::GNUABI64)
.StartsWith("gnueabihft64", Triple::GNUEABIHFT64)
.StartsWith("gnueabihf", Triple::GNUEABIHF)
.StartsWith("gnueabit64", Triple::GNUEABIT64)
.StartsWith("gnueabi", Triple::GNUEABI)
.StartsWith("gnuf32", Triple::GNUF32)
.StartsWith("gnuf64", Triple::GNUF64)
@ -701,6 +706,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
.StartsWith("gnux32", Triple::GNUX32)
.StartsWith("gnu_ilp32", Triple::GNUILP32)
.StartsWith("code16", Triple::CODE16)
.StartsWith("gnut64", Triple::GNUT64)
.StartsWith("gnu", Triple::GNU)
.StartsWith("android", Triple::Android)
.StartsWith("musleabihf", Triple::MuslEABIHF)

View File

@ -1395,7 +1395,7 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB,
if (!Arg)
continue;
if (AL.hasParamAttr(I, Attribute::ByVal))
if (NewInnerCB->paramHasAttr(I, Attribute::ByVal))
// It's unsound to propagate memory attributes to byval arguments.
// Even if CalledFunction doesn't e.g. write to the argument,
// the call to NewInnerCB may write to its by-value copy.

View File

@ -161,11 +161,13 @@ void llvm::setKCFIType(Module &M, Function &F, StringRef MangledType) {
// Matches CodeGenModule::CreateKCFITypeId in Clang.
LLVMContext &Ctx = M.getContext();
MDBuilder MDB(Ctx);
F.setMetadata(
LLVMContext::MD_kcfi_type,
MDNode::get(Ctx, MDB.createConstant(ConstantInt::get(
Type::getInt32Ty(Ctx),
static_cast<uint32_t>(xxHash64(MangledType))))));
std::string Type = MangledType.str();
if (M.getModuleFlag("cfi-normalize-integers"))
Type += ".normalized";
F.setMetadata(LLVMContext::MD_kcfi_type,
MDNode::get(Ctx, MDB.createConstant(ConstantInt::get(
Type::getInt32Ty(Ctx),
static_cast<uint32_t>(xxHash64(Type))))));
// If the module was compiled with -fpatchable-function-entry, ensure
// we use the same patchable-function-prefix.
if (auto *MD = mdconst::extract_or_null<ConstantInt>(

View File

@ -1,8 +1,8 @@
#define LLVM_REVISION "llvmorg-19.1.2-0-g7ba7d8e2f7b6"
#define LLVM_REVISION "llvmorg-19.1.3-0-gab51eccf88f5"
#define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"
#define CLANG_REVISION "llvmorg-19.1.2-0-g7ba7d8e2f7b6"
#define CLANG_REVISION "llvmorg-19.1.3-0-gab51eccf88f5"
#define CLANG_REPOSITORY "https://github.com/llvm/llvm-project.git"
#define LLDB_REVISION "llvmorg-19.1.2-0-g7ba7d8e2f7b6"
#define LLDB_REVISION "llvmorg-19.1.3-0-gab51eccf88f5"
#define LLDB_REPOSITORY "https://github.com/llvm/llvm-project.git"

View File

@ -1,8 +1,8 @@
#define CLANG_VERSION 19.1.2
#define CLANG_VERSION_STRING "19.1.2"
#define CLANG_VERSION 19.1.3
#define CLANG_VERSION_STRING "19.1.3"
#define CLANG_VERSION_MAJOR 19
#define CLANG_VERSION_MAJOR_STRING "19"
#define CLANG_VERSION_MINOR 1
#define CLANG_VERSION_PATCHLEVEL 2
#define CLANG_VERSION_PATCHLEVEL 3
#define CLANG_VENDOR "FreeBSD "

View File

@ -1,4 +1,4 @@
// Local identifier in __FreeBSD_version style
#define LLD_FREEBSD_VERSION 1500001
#define LLD_VERSION_STRING "19.1.2 (FreeBSD llvmorg-19.1.2-0-g7ba7d8e2f7b6-" __XSTRING(LLD_FREEBSD_VERSION) ")"
#define LLD_VERSION_STRING "19.1.3 (FreeBSD llvmorg-19.1.3-0-gab51eccf88f5-" __XSTRING(LLD_FREEBSD_VERSION) ")"

View File

@ -1,6 +1,6 @@
#define LLDB_VERSION 19.1.2
#define LLDB_VERSION_STRING "19.1.2"
#define LLDB_VERSION 19.1.3
#define LLDB_VERSION_STRING "19.1.3"
#define LLDB_VERSION_MAJOR 19
#define LLDB_VERSION_MINOR 1
#define LLDB_VERSION_PATCH 2
#define LLDB_VERSION_PATCH 3
/* #undef LLDB_FULL_VERSION_STRING */

View File

@ -338,10 +338,10 @@
#define PACKAGE_NAME "LLVM"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "LLVM 19.1.2"
#define PACKAGE_STRING "LLVM 19.1.3"
/* Define to the version of this package. */
#define PACKAGE_VERSION "19.1.2"
#define PACKAGE_VERSION "19.1.3"
/* Define to the vendor of this package. */
/* #undef PACKAGE_VENDOR */

View File

@ -176,10 +176,10 @@
#define LLVM_VERSION_MINOR 1
/* Patch version of the LLVM API */
#define LLVM_VERSION_PATCH 2
#define LLVM_VERSION_PATCH 3
/* LLVM version string */
#define LLVM_VERSION_STRING "19.1.2"
#define LLVM_VERSION_STRING "19.1.3"
/* Whether LLVM records statistics for use with GetStatistics(),
* PrintStatistics() or PrintStatisticsJSON()

View File

@ -1,2 +1,2 @@
#define LLVM_REVISION "llvmorg-19.1.2-0-g7ba7d8e2f7b6"
#define LLVM_REVISION "llvmorg-19.1.3-0-gab51eccf88f5"
#define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"

View File

@ -26,7 +26,8 @@
# if __has_builtin(__builtin_verbose_trap)
// AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream
// version before upstream Clang actually got the builtin.
# if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 17000
// TODO: Remove once AppleClang supports the two-arguments version of the builtin.
# if defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1700
# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap(message)
# else
# define _LIBCPP_ASSERTION_HANDLER(message) __builtin_verbose_trap("libc++", message)

View File

@ -148,7 +148,7 @@
#define ENABLE_LIBOMPTARGET OPENMP_ENABLE_LIBOMPTARGET
// Configured cache line based on architecture
#if KMP_ARCH_PPC64
#if KMP_ARCH_PPC64 || KMP_ARCH_PPC
# define CACHE_LINE 128
#elif KMP_ARCH_AARCH64_A64FX
# define CACHE_LINE 256

View File

@ -7,14 +7,16 @@
# memstick: Builds memory stick image (memstick.img)
# mini-memstick: Builds minimal memory stick image (mini-memstick.img)
# ftp: Sets up FTP distribution area (ftp)
# release: Invokes real-release, vm-release, and cloudware-release targets
# release: Invokes real-release, vm-release, cloudware-release and oci-release targets
# real-release: Build all media and FTP distribution area
# vm-release: Build all virtual machine image targets
# cloudware-release: Build all cloud hosting provider targets
# install: Invokes the release-install and vm-install targets
# oci-release: Build all OCI container images
# install: Invokes the release-install, vm-install and oci-install targets
# release-install: Copies all release installation media into ${DESTDIR}
# vm-install: Copies all virtual machine images into ${DESTDIR}
# cloud-install: Copies non-uploaded cloud images into ${DESTDIR}
# oci-install: Copies all OCI container images into ${DESTDIR}
#
# Variables affecting the build process:
# WORLDDIR: location of src tree -- must have built world and default kernel
@ -330,7 +332,7 @@ ftp: packagesystem
mkdir -p ftp
cp *.txz MANIFEST ftp
release: real-release vm-release cloudware-release
release: real-release vm-release cloudware-release oci-release
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} release-done
true
@ -341,7 +343,7 @@ real-release:
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
install: release-install vm-install .WAIT cloud-install
install: release-install vm-install oci-install .WAIT cloud-install
release-install:
.if defined(DESTDIR) && !empty(DESTDIR)
@ -361,3 +363,4 @@ release-install:
.include "${.CURDIR}/Makefile.inc1"
.include "${.CURDIR}/Makefile.vm"
.include "${.CURDIR}/Makefile.oci"

34
release/Makefile.oci Normal file
View File

@ -0,0 +1,34 @@
#
#
#
# Makefile for building OCI container images.
#
.if defined(WITH_OCIIMAGES) && !empty(WITH_OCIIMAGES)
OCI_IMAGES= static dynamic minimal
.endif
oci-install:
.if defined(WITH_OCIIMAGES) && !empty(WITH_OCIIMAGES)
mkdir -p ${DESTDIR}/ociimages
. for _IMG in ${OCI_IMAGES}
cp -p ${.OBJDIR}/container-image-${_IMG}.txz ${DESTDIR}/ociimages
. endfor
.endif
OCI_TARGETS=
OCI_DEPS_static=
OCI_DEPS_dynamic= container-image-static.txz
OCI_DEPS_minimal= container-image-dynamic.txz
.for _IMG in ${OCI_IMAGES}
OCI_TARGETS+= container-image-${_IMG}.txz
container-image-${_IMG}.txz: ${OCI_DEPS_${_IMG}}
sh ${.CURDIR}/scripts/make-oci-image.sh ${.CURDIR} ${REVISION} ${BRANCH} ${TARGET_ARCH} ${_IMG}
skopeo copy \
containers-storage:localhost/freebsd${REVISION:R}-${_IMG}:latest \
oci-archive:${.OBJDIR}/container-image-${_IMG}.tar:freebsd${REVISION:R}-${_IMG}:${REVISION}-${BRANCH}-${TARGET_ARCH}
${XZ_CMD} < ${.OBJDIR}/container-image-${_IMG}.tar > ${.OBJDIR}/container-image-${_IMG}.txz
.endfor
oci-release: ${OCI_TARGETS}

View File

@ -114,3 +114,7 @@ PORTBRANCH="main"
## If WITH_CLOUDWARE is set to a non-empty value, this is a list of providers
## to create disk images.
#CLOUDWARE="EC2 GCE ORACLE VAGRANT-VIRTUALBOX VAGRANT-VMWARE"
## If WITH_OCIIMAGES is set to a non-empty value, build Open Container
## Initiative (OCI) base images as part of the release.
#WITH_OCIIMAGES=

View File

@ -120,6 +120,9 @@ env_setup() {
# cloud providers as part of the release.
WITH_CLOUDWARE=
# Set to non-empty to build OCI images as part of the release
WITH_OCIIMAGES=
return 0
} # env_setup()
@ -195,7 +198,8 @@ env_check() {
RELEASE_RMAKEFLAGS="${ARCH_FLAGS} ${RELEASE_FLAGS} \
KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${SRCPORTS} \
WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \
WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}"
WITH_CLOUDWARE=${WITH_CLOUDWARE} WITH_OCIIMAGES=${WITH_OCIIMAGES} \
XZ_THREADS=${XZ_THREADS}"
return 0
} # env_check()
@ -288,6 +292,44 @@ extra_chroot_setup() {
fi
fi
if [ ! -z "${WITH_OCIIMAGES}" ]; then
# Install buildah and skopeo from ports if the ports tree is available;
# otherwise install the pkg.
if [ -d ${CHROOTDIR}/usr/ports ]; then
# Trick the ports 'run-autotools-fixup' target to do the right
# thing.
_OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
UNAME_r=${REVISION}-${BRANCH}
GITUNSETOPTS="CONTRIB CURL CVS GITWEB GUI HTMLDOCS"
GITUNSETOPTS="${GITUNSETOPTS} ICONV NLS P4 PERL"
GITUNSETOPTS="${GITUNSETOPTS} SEND_EMAIL SUBTREE SVN"
GITUNSETOPTS="${GITUNSETOPTS} PCRE PCRE2"
PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes"
PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}"
PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}"
PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports"
PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles"
for _PORT in sysutils/buildah sysutils/skopeo; do
eval chroot ${CHROOTDIR} env ${PBUILD_FLAGS} make -C \
/usr/ports/${_PORT} \
FORCE_PKG_REGISTER=1 deinstall install clean distclean
done
else
eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \
pkg install -y sysutils/buildah sysutils/skopeo
eval chroot ${CHROOTDIR} env ASSUME_ALWAYS_YES=yes \
pkg clean -y
fi
# Use the vfs storage driver so that this works whether or not
# the build directory is on ZFS. The images are small so the
# performance difference is negligible.
eval chroot ${CHROOTDIR} sed -I .bak -e '/^driver/s/zfs/vfs/' /usr/local/etc/containers/storage.conf
# Remove any stray images from previous builds
eval chroot ${CHROOTDIR} buildah rmi -af
fi
if [ ! -z "${EMBEDDEDPORTS}" ]; then
_OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
@ -323,6 +365,9 @@ chroot_build_target() {
fi
eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld
eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel
if [ ! -z "${WITH_OCIIMAGES}" ]; then
eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} packages
fi
return 0
} # chroot_build_target

View File

@ -0,0 +1,63 @@
#! /bin/sh
# Build an Open Container Initiative (OCI) container image
curdir=$1; shift
rev=$1; shift
branch=$1; shift
arch=$1; shift
image=$1; shift
major=${rev%.*}
minor=${rev#*.}
abi=FreeBSD:${major}:${arch}
echo "Building OCI freebsd${major}-${image} image for ${abi}"
. ${curdir}/tools/oci-image-${image}.conf
init_workdir() {
local abi=$1; shift
local workdir=$(mktemp -d -t oci-images)
mkdir ${workdir}/repos
cat > ${workdir}/repos/base.conf <<EOF
FreeBSD-base: {
url: "file:///usr/obj/usr/src/repo/${abi}/latest"
signature_type: "none"
fingerprints: "none"
}
EOF
cp /etc/pkg/FreeBSD.conf ${workdir}/repos
echo ${workdir}
}
install_packages() {
local abi=$1; shift
local workdir=$1; shift
local rootdir=$1; shift
if [ ! -d ${rootdir}/usr/share/keys/pkg/trusted ]; then
mkdir -p ${rootdir}/usr/share/keys/pkg/trusted
fi
cp /usr/share/keys/pkg/trusted/* ${rootdir}/usr/share/keys/pkg/trusted
# We install the packages and then remove repository metadata (keeping the
# metadata for what was installed). This trims more than 40Mb from the
# resulting image.
env IGNORE_OSVERSION=yes ABI=${abi} pkg --rootdir ${rootdir} --repo-conf-dir ${workdir}/repos \
install -yq "$@" || exit $?
rm -rf ${rootdir}/var/db/pkg/repos
}
workdir=$(init_workdir ${abi})
if [ -n "${OCI_BASE_IMAGE}" ]; then
base_image=freebsd${major}-${OCI_BASE_IMAGE}
else
base_image=scratch
fi
c=$(buildah from ${base_image})
m=$(buildah mount $c)
oci_image_build
buildah unmount $c
buildah commit --rm $c freebsd${major}-${image}:latest

View File

@ -0,0 +1,11 @@
#! /bin/sh
# Build Open Container Initiative (OCI) container image suitable as a base for
# dynamic-linked workloads. This adds libraries from the FreeBSD-clibs and
# FreeBSD-openssl-lib packages.
OCI_BASE_IMAGE=static
oci_image_build() {
install_packages ${abi} ${workdir} $m FreeBSD-clibs FreeBSD-openssl-lib
}

View File

@ -0,0 +1,19 @@
#! /bin/sh
# Build Open Container Initiative (OCI) container image suitable as a base for
# shell-based workloads. This adds FreeBSD-runtime, FreeBSD-pkg-bootstrap and a
# handful of others packages to create a small image which can be easily
# extended by installing packages.
OCI_BASE_IMAGE=dynamic
oci_image_build() {
install_packages ${abi} ${workdir} $m \
FreeBSD-runtime \
FreeBSD-certctl \
FreeBSD-kerberos-lib \
FreeBSD-libexecinfo \
FreeBSD-rc \
FreeBSD-pkg-bootstrap \
FreeBSD-mtree
}

View File

@ -0,0 +1,42 @@
#! /bin/sh
# Build Open Container Initiative (OCI) container image suitable as a base for
# static-linked workloads. This contains mtree directories, SSL certificates and
# a few other config files.
OCI_BASE_IMAGE=
oci_image_build() {
mtree -deU -p $m/ -f /etc/mtree/BSD.root.dist > /dev/null
mtree -deU -p $m/var -f /etc/mtree/BSD.var.dist > /dev/null
mtree -deU -p $m/usr -f /etc/mtree/BSD.usr.dist > /dev/null
mtree -deU -p $m/usr/include -f /etc/mtree/BSD.include.dist > /dev/null
mtree -deU -p $m/usr/lib -f /etc/mtree/BSD.debug.dist > /dev/null
install_packages ${abi} ${workdir} $m FreeBSD-caroot FreeBSD-zoneinfo
cp /etc/master.passwd $m/etc
pwd_mkdb -p -d $m/etc $m/etc/master.passwd || return $?
cp /etc/group $m/etc || return $?
cp /etc/termcap.small $m/etc/termcap.small || return $?
cp /etc/termcap.small $m/usr/share/misc/termcap || return $?
env DESTDIR=$m /usr/sbin/certctl rehash
# Generate a suitable repo config for pkgbase
case ${branch} in
CURRENT|STABLE|BETA*)
repo=base_latest
;;
*)
repo=base_release_${minor}
;;
esac
mkdir -p $m/usr/local/etc/pkg/repos
cat > $m/usr/local/etc/pkg/repos/base.conf <<EOF
FreeBSD-base: {
url: "https://pkg.FreeBSD.org/\${ABI}/${repo}",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
}
EOF
}

View File

@ -22,6 +22,7 @@ LDIRS= BSD_daemon \
libvgl \
mdoc \
netgraph \
oci \
perfmon \
ppi \
ppp \
@ -203,6 +204,11 @@ SE_NETGRAPH= \
virtual.chain \
virtual.lan \
SE_DIRS+= oci
SE_OCI= \
README \
Containerfile.pkg
SE_DIRS+= perfmon
SE_PERFMON= \
Makefile \

View File

@ -0,0 +1,27 @@
# This is an example showing how to extend the freebsd-minimal OCI image by
# installing additional packages while keeping the resulting image as small as
# possible.
# The OS version matching the desired freebsd-minimal image
ARG version=15.0-CURRENT-amd64
# Select freebsd-minimal as our starting point.
FROM localhost/freebsd-minimal:${version}
# A list of package(s) to install
ARG packages
# Install package management tools. We specify 'FreeBSD' as the repository to
# use for downloading pkg since the freebsd-minimal image has both FreeBSD and
# FreeBSD-base pkg repo configs installed and FreeBSD-base does not contain the
# pkg package.
RUN env ASSUME_ALWAYS_YES=yes pkg bootstrap -r FreeBSD && pkg update
# Install some package(s).
RUN pkg install -y ${packages}
# Clean up and remove package management overhead. We delete downloaded
# packages, uninstall pkg and delete the repository metadata downloaded by 'pkg
# install'. This retains the record of which packages are installed in the
# image.
RUN pkg clean -ay && pkg delete -fy pkg && rm -rf /var/db/pkg/repos

View File

@ -0,0 +1,7 @@
This example Containerfile shows how to add packages to freebsd-minimal while
minimising the package metadata overhead.
For instance, To build a new image called 'my-new-image:latest' containing the
nginx package:
# podman build --squash --build-arg packages=nginx --tag my-new-image:latest -f Containerfile.pkg

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd August 6, 2023
.Dd September 26, 2024
.Dt RELEASE 7
.Os
.Sh NAME
@ -443,6 +443,18 @@ values, run:
cd /usr/src
make -C release list-cloudware
.Ed
.Sh OCI IMAGES
The
.Fx
release build tools have experimental support for building
Open Container Initiative (OCI) format container base images.
This is enabled using a
.Fa release.conf
variable:
.Bl -tag -width Ev
.It Va WITH_OCIIMAGES
Set to a non-null value to build OCI base images.
.El
.Sh MAKEFILE TARGETS
The release makefile
.Pq Pa src/release/Makefile

View File

@ -155,11 +155,11 @@ list_fw()
vn=$(echo ${fx} | awk '{ gsub(".ucode$", ""); gsub("^.*-", ""); print; }')
#echo "BN ${bn} VN ${vn}"
# Single digits are not zero-padded so just ${i} will be fine.
for i in `jot ${vn} 1`; do
for i in `jot ${vn} ${vn} 1`; do
xn="${bn}-${i}.ucode"
if test -e ${LFWDIR}/${xn}; then
lx="${lx} ${xn}"
break 2;
break
fi
done
;;

View File

@ -263,6 +263,11 @@ rtwn_start(struct rtwn_softc *sc)
struct mbuf *m;
RTWN_ASSERT_LOCKED(sc);
/* Ensure no work is scheduled during reset/teardown */
if ((sc->sc_flags & RTWN_RUNNING) == 0)
return;
while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
if (sc->qfullmsk != 0) {
mbufq_prepend(&sc->sc_snd, m);

View File

@ -2184,9 +2184,8 @@ in_pcblookup_wild_match(const struct inpcb *inp, struct in_addr laddr,
#define INP_LOOKUP_AGAIN ((struct inpcb *)(uintptr_t)-1)
static struct inpcb *
in_pcblookup_hash_wild_smr(struct inpcbinfo *pcbinfo, struct in_addr faddr,
u_short fport, struct in_addr laddr, u_short lport,
const inp_lookup_t lockflags)
in_pcblookup_hash_wild_smr(struct inpcbinfo *pcbinfo, struct in_addr laddr,
u_short lport, const inp_lookup_t lockflags)
{
struct inpcbhead *head;
struct inpcb *inp;
@ -2222,8 +2221,8 @@ in_pcblookup_hash_wild_smr(struct inpcbinfo *pcbinfo, struct in_addr faddr,
}
static struct inpcb *
in_pcblookup_hash_wild_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr,
u_short fport, struct in_addr laddr, u_short lport)
in_pcblookup_hash_wild_locked(struct inpcbinfo *pcbinfo, struct in_addr laddr,
u_short lport)
{
struct inpcbhead *head;
struct inpcb *inp, *local_wild, *local_exact, *jail_wild;
@ -2324,8 +2323,8 @@ in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr,
inp = in_pcblookup_lbgroup(pcbinfo, &faddr, fport,
&laddr, lport, numa_domain);
if (inp == NULL) {
inp = in_pcblookup_hash_wild_locked(pcbinfo, faddr,
fport, laddr, lport);
inp = in_pcblookup_hash_wild_locked(pcbinfo, laddr,
lport);
}
}
@ -2407,8 +2406,8 @@ in_pcblookup_hash_smr(struct inpcbinfo *pcbinfo, struct in_addr faddr,
}
inp = INP_LOOKUP_AGAIN;
} else {
inp = in_pcblookup_hash_wild_smr(pcbinfo, faddr, fport,
laddr, lport, lockflags);
inp = in_pcblookup_hash_wild_smr(pcbinfo, laddr, lport,
lockflags);
}
if (inp == INP_LOOKUP_AGAIN) {
return (in_pcblookup_hash(pcbinfo, faddr, fport, laddr,

View File

@ -1002,8 +1002,7 @@ in6_pcblookup_wild_match(const struct inpcb *inp, const struct in6_addr *laddr,
static struct inpcb *
in6_pcblookup_hash_wild_smr(struct inpcbinfo *pcbinfo,
const struct in6_addr *faddr, u_short fport, const struct in6_addr *laddr,
u_short lport, const inp_lookup_t lockflags)
const struct in6_addr *laddr, u_short lport, const inp_lookup_t lockflags)
{
struct inpcbhead *head;
struct inpcb *inp;
@ -1040,8 +1039,7 @@ in6_pcblookup_hash_wild_smr(struct inpcbinfo *pcbinfo,
static struct inpcb *
in6_pcblookup_hash_wild_locked(struct inpcbinfo *pcbinfo,
const struct in6_addr *faddr, u_short fport, const struct in6_addr *laddr,
u_short lport)
const struct in6_addr *laddr, u_short lport)
{
struct inpcbhead *head;
struct inpcb *inp, *jail_wild, *local_exact, *local_wild;
@ -1123,8 +1121,8 @@ in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo,
inp = in6_pcblookup_lbgroup(pcbinfo, faddr, fport, laddr,
lport, numa_domain);
if (inp == NULL) {
inp = in6_pcblookup_hash_wild_locked(pcbinfo, faddr,
fport, laddr, lport);
inp = in6_pcblookup_hash_wild_locked(pcbinfo,
laddr, lport);
}
}
return (inp);
@ -1200,8 +1198,8 @@ in6_pcblookup_hash_smr(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
}
inp = INP_LOOKUP_AGAIN;
} else {
inp = in6_pcblookup_hash_wild_smr(pcbinfo, faddr, fport,
laddr, lport, lockflags);
inp = in6_pcblookup_hash_wild_smr(pcbinfo, laddr, lport,
lockflags);
}
if (inp == INP_LOOKUP_AGAIN) {
return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr,

48
usr.sbin/fwget/fwget.sh Normal file → Executable file
View File

@ -38,7 +38,8 @@ Supported subsystems
pci
Options:
-n -- Do not install package, only print the results
-n -- Do not install packages, only print the results
-q -- Quiet mode. If used with -n only prints a package a line
-v -- More verbose
EOF
exit 1
@ -75,22 +76,27 @@ addpkg()
}
DRY_RUN=n
QUIET=n
VERBOSE=n
while [ $# -gt 0 ]; do
case $1 in
-n)
DRY_RUN=y
;;
-v)
VERBOSE=y
;;
*)
subsystems="${subsystems} $1"
;;
while getopts ":nqv" _arg; do
case ${_arg} in
n)
DRY_RUN=y
;;
q)
QUIET=y
;;
v)
VERBOSE=y
;;
?)
usage
;;
esac
shift
done
shift $(($OPTIND - 1))
subsystems="$@"
# Default searching PCI subsystem
if [ -z "${subsystems}" ]; then
@ -112,13 +118,25 @@ done
case "${packages}" in
""|^[[:space:]]*$)
echo "No firmware packages to install."
if [ "${QUIET}" != "y" ]; then
echo "No firmware packages to install."
fi
exit 0
;;
esac
echo "Needed firmware packages: '${packages}'"
if [ "${QUIET}" != "y" ]; then
echo "Needed firmware packages: '${packages}'"
fi
if [ "${DRY_RUN}" = "y" ]; then
if [ "${QUIET}" = "y" ]; then
for pkg in ${packages}; do
case "${pkg}" in
""|^[[:space:]]*$) continue ;;
esac
echo "${pkg}"
done
fi
exit 0
fi