sync with OpenBSD -current

This commit is contained in:
purplerain 2023-11-21 08:46:51 +00:00
parent c22b8a6120
commit 1abf3d5d6c
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
31 changed files with 490 additions and 161 deletions

View file

@ -1572,7 +1572,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
options::OPT_mbranch_protection_EQ)
: Args.getLastArg(options::OPT_mbranch_protection_EQ);
if (!A) {
if (Triple.isOSOpenBSD()) {
if (Triple.isOSOpenBSD() && isAArch64) {
CmdArgs.push_back("-msign-return-address=non-leaf");
CmdArgs.push_back("-msign-return-address-key=a_key");
CmdArgs.push_back("-mbranch-target-enforce");
@ -1594,7 +1594,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getSpelling() << Scope;
Key = "a_key";
if (Triple.isOSOpenBSD())
if (Triple.isOSOpenBSD() && isAArch64)
IndirectBranches = true;
else
IndirectBranches = false;

View file

@ -144,7 +144,7 @@ uint32_t RISCV::calcEFlags() const {
target |= EF_RISCV_RVC;
if ((eflags & EF_RISCV_FLOAT_ABI) != (target & EF_RISCV_FLOAT_ABI))
error(
warn(
toString(f) +
": cannot link object files with different floating-point ABI from " +
toString(ctx.objectFiles[0]));

View file

@ -104,7 +104,7 @@ static StringRef getOutputSectionName(const InputSectionBase *s) {
{".data.rel.ro", ".data", ".rodata", ".bss.rel.ro", ".bss",
".gcc_except_table", ".init_array", ".fini_array", ".tbss", ".tdata",
".ARM.exidx", ".ARM.extab", ".ctors", ".dtors",
".openbsd.randomdata.", ".openbsd.mutable."})
".openbsd.randomdata", ".openbsd.mutable"})
if (isSectionPrefix(v, s->name))
return v;

View file

@ -832,6 +832,13 @@ static bool maybeReportUndefined(Undefined &sym, InputSectionBase &sec,
if (sym.discardedSecIdx != 0 && (sec.name == ".got2" || sec.name == ".toc"))
return false;
#ifdef __OpenBSD__
// GCC (at least 8 and 11) can produce a ".gcc_except_table" with relocations
// to discarded sections on riscv64
if (sym.discardedSecIdx != 0 && sec.name == ".gcc_except_table")
return false;
#endif
bool isWarning =
(config->unresolvedSymbols == UnresolvedPolicy::Warn && canBeExternal) ||
config->noinhibitExec;