Skip to content

Commit b280a8f

Browse files
committed
[LLD][ELF][RISCV][Zicfilp][Zicfiss] Support -z <zicfilp-unlabeled|zicfilp-func-sig|zicfiss>-report-dynamic=<none|warning|error> options
+ If `-z zicfilp-unlabeled-report-dynamic=<warning|error>` and the output object file has the ZICFILP-unlabeled feature, the linker warns/errors when any of the immediately linked dynamic object files (i.e. those explicitly passed to the linker) lacks the ZICFILP-unlabeled feature. + A similar report for checking relocatable files can be enabled by `-z zicfilp-unlabeled-report=<warning|error>`, which reports if any relocatable file lacks the ZICFILP-unlabeled feature. + `-z zicfilp-unlabeled-report=<warning|error>` implies `-z zicfilp-unlabeled-report-dynamic=warning`. + This is probably desired when the user wishes to enable ZICFILP-unlabeled. + The report level of dynamic object files is downgraded to `warning` in this implied case, since this allows the user to avoid rebuilding dynamic object files in the build environment. + This patch also implements the above mentioned `-z xxx-report-dynamic` option for the ZICFILP-func-sig/ZICFISS feature.
1 parent 9adde28 commit b280a8f

File tree

6 files changed

+180
-36
lines changed

6 files changed

+180
-36
lines changed

lld/ELF/Config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,11 @@ struct Config {
259259
ReportPolicy zGcsReportDynamic = ReportPolicy::None;
260260
ReportPolicy zExecuteOnlyReport = ReportPolicy::None;
261261
ReportPolicy zZicfilpUnlabeledReport = ReportPolicy::None;
262+
ReportPolicy zZicfilpUnlabeledReportDynamic = ReportPolicy::None;
262263
ReportPolicy zZicfilpFuncSigReport = ReportPolicy::None;
264+
ReportPolicy zZicfilpFuncSigReportDynamic = ReportPolicy::None;
263265
ReportPolicy zZicfissReport = ReportPolicy::None;
266+
ReportPolicy zZicfissReportDynamic = ReportPolicy::None;
264267
bool ltoBBAddrMap;
265268
llvm::StringRef ltoBasicBlockSections;
266269
std::pair<llvm::StringRef, llvm::StringRef> thinLTOObjectSuffixReplace;

lld/ELF/Driver.cpp

Lines changed: 118 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,20 @@ static void checkOptions(Ctx &ctx) {
425425
if (ctx.arg.zZicfilpUnlabeledReport != ReportPolicy::None)
426426
ErrAlways(ctx) << "-z zicfilip-unlabeled-report is only supported on "
427427
"RISC-V targets";
428+
if (ctx.arg.zZicfilpUnlabeledReportDynamic != ReportPolicy::None)
429+
ErrAlways(ctx) << "-z zicfilip-unlabeled-report-dynamic is only supported"
430+
" on RISC-V targets";
428431
if (ctx.arg.zZicfilpFuncSigReport != ReportPolicy::None)
429432
ErrAlways(ctx) << "-z zicfilip-func-sig-report is only supported on "
430433
"RISC-V targets";
434+
if (ctx.arg.zZicfilpFuncSigReportDynamic != ReportPolicy::None)
435+
ErrAlways(ctx) << "-z zicfilip-func-sig-report-dynamic is only supported "
436+
"on RISC-V targets";
431437
if (ctx.arg.zZicfissReport != ReportPolicy::None)
432438
ErrAlways(ctx) << "-z zicfiss-report is only supported on RISC-V targets";
439+
if (ctx.arg.zZicfissReportDynamic != ReportPolicy::None)
440+
ErrAlways(ctx) << "-z zicfiss-report-dynamic is only supported on RISC-V "
441+
"targets";
433442
if (ctx.arg.zZicfilp != ZicfilpPolicy::Implicit)
434443
ErrAlways(ctx) << "-z zicfilp is only supported on RISC-V targets";
435444
if (ctx.arg.zZicfiss != ZicfissPolicy::Implicit)
@@ -1686,45 +1695,84 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
16861695
ErrAlways(ctx) << errPrefix << pat.takeError() << ": " << kv.first;
16871696
}
16881697

1689-
auto reports = {
1690-
std::make_pair("bti-report", &ctx.arg.zBtiReport),
1691-
std::make_pair("cet-report", &ctx.arg.zCetReport),
1692-
std::make_pair("execute-only-report", &ctx.arg.zExecuteOnlyReport),
1693-
std::make_pair("gcs-report", &ctx.arg.zGcsReport),
1694-
std::make_pair("gcs-report-dynamic", &ctx.arg.zGcsReportDynamic),
1695-
std::make_pair("pauth-report", &ctx.arg.zPauthReport),
1696-
std::make_pair("zicfilp-unlabeled-report",
1697-
&ctx.arg.zZicfilpUnlabeledReport),
1698-
std::make_pair("zicfilp-func-sig-report", &ctx.arg.zZicfilpFuncSigReport),
1699-
std::make_pair("zicfiss-report", &ctx.arg.zZicfissReport)};
17001698
bool hasGcsReportDynamic = false;
1699+
bool hasZicfilpUnlabeledReportDynamic = false;
1700+
bool hasZicfilpFuncSigReportDynamic = false;
1701+
bool hasZicfissReportDynamic = false;
1702+
struct ReportOptDesc {
1703+
const char *const name;
1704+
ReportPolicy &policy;
1705+
bool *const seen;
1706+
1707+
ReportOptDesc(const char *const name, ReportPolicy &policy, bool *seen)
1708+
: name(name), policy(policy), seen(seen) {}
1709+
};
1710+
const ReportOptDesc reports[] = {
1711+
{"bti-report", ctx.arg.zBtiReport, nullptr},
1712+
{"cet-report", ctx.arg.zCetReport, nullptr},
1713+
{"execute-only-report", ctx.arg.zExecuteOnlyReport, nullptr},
1714+
{"gcs-report", ctx.arg.zGcsReport, nullptr},
1715+
{"gcs-report-dynamic", ctx.arg.zGcsReportDynamic, &hasGcsReportDynamic},
1716+
{"pauth-report", ctx.arg.zPauthReport, nullptr},
1717+
{"zicfilp-unlabeled-report", ctx.arg.zZicfilpUnlabeledReport, nullptr},
1718+
{"zicfilp-unlabeled-report-dynamic",
1719+
ctx.arg.zZicfilpUnlabeledReportDynamic,
1720+
&hasZicfilpUnlabeledReportDynamic},
1721+
{"zicfilp-func-sig-report", ctx.arg.zZicfilpFuncSigReport, nullptr},
1722+
{"zicfilp-func-sig-report-dynamic", ctx.arg.zZicfilpFuncSigReportDynamic,
1723+
&hasZicfilpFuncSigReportDynamic},
1724+
{"zicfiss-report", ctx.arg.zZicfissReport, nullptr},
1725+
{"zicfiss-report-dynamic", ctx.arg.zZicfissReportDynamic,
1726+
&hasZicfissReportDynamic}};
17011727
for (opt::Arg *arg : args.filtered(OPT_z)) {
17021728
std::pair<StringRef, StringRef> option =
17031729
StringRef(arg->getValue()).split('=');
1704-
for (auto reportArg : reports) {
1705-
if (option.first != reportArg.first)
1730+
for (const ReportOptDesc &desc : reports) {
1731+
if (option.first != desc.name)
17061732
continue;
17071733
arg->claim();
17081734
if (option.second == "none")
1709-
*reportArg.second = ReportPolicy::None;
1735+
desc.policy = ReportPolicy::None;
17101736
else if (option.second == "warning")
1711-
*reportArg.second = ReportPolicy::Warning;
1737+
desc.policy = ReportPolicy::Warning;
17121738
else if (option.second == "error")
1713-
*reportArg.second = ReportPolicy::Error;
1739+
desc.policy = ReportPolicy::Error;
17141740
else {
1715-
ErrAlways(ctx) << "unknown -z " << reportArg.first
1741+
ErrAlways(ctx) << "unknown -z " << desc.name
17161742
<< "= value: " << option.second;
17171743
continue;
17181744
}
1719-
hasGcsReportDynamic |= option.first == "gcs-report-dynamic";
1745+
if (desc.seen)
1746+
*desc.seen = true;
17201747
}
17211748
}
17221749

1723-
// When -zgcs-report-dynamic is unspecified, it inherits -zgcs-report
1724-
// but is capped at warning to avoid needing to rebuild the shared library
1725-
// with GCS enabled.
1726-
if (!hasGcsReportDynamic && ctx.arg.zGcsReport != ReportPolicy::None)
1727-
ctx.arg.zGcsReportDynamic = ReportPolicy::Warning;
1750+
struct ReportDynamicOptDesc {
1751+
ReportPolicy &dynamicPolicy;
1752+
const ReportPolicy objectPolicy;
1753+
const bool seenDynamicPolicy;
1754+
1755+
ReportDynamicOptDesc(ReportPolicy &dynamicPolicy,
1756+
const ReportPolicy objectPolicy,
1757+
const bool seenDynamicPolicy)
1758+
: dynamicPolicy(dynamicPolicy), objectPolicy(objectPolicy),
1759+
seenDynamicPolicy(seenDynamicPolicy) {}
1760+
};
1761+
const ReportDynamicOptDesc reportDynamics[] = {
1762+
{ctx.arg.zGcsReportDynamic, ctx.arg.zGcsReport, hasGcsReportDynamic},
1763+
{ctx.arg.zZicfilpUnlabeledReportDynamic, ctx.arg.zZicfilpUnlabeledReport,
1764+
hasZicfilpUnlabeledReportDynamic},
1765+
{ctx.arg.zZicfilpFuncSigReportDynamic, ctx.arg.zZicfilpFuncSigReport,
1766+
hasZicfilpFuncSigReportDynamic},
1767+
{ctx.arg.zZicfissReportDynamic, ctx.arg.zZicfissReport,
1768+
hasZicfissReportDynamic}};
1769+
for (const ReportDynamicOptDesc &desc : reportDynamics) {
1770+
// When -z xxx-report-dynamic is unspecified, it inherits -z xxx-report
1771+
// but is capped at warning to avoid needing to rebuild the shared library
1772+
// with XXX enabled.
1773+
if (!desc.seenDynamicPolicy && desc.objectPolicy != ReportPolicy::None)
1774+
desc.dynamicPolicy = ReportPolicy::Warning;
1775+
}
17281776

17291777
for (opt::Arg *arg : args.filtered(OPT_compress_sections)) {
17301778
SmallVector<StringRef, 0> fields;
@@ -3066,13 +3114,15 @@ static void readSecurityNotes(Ctx &ctx) {
30663114
ctx.arg.andFeatures &= ~GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS;
30673115
}
30683116

3069-
// If we are utilising GCS at any stage, the sharedFiles should be checked to
3070-
// ensure they also support this feature. The gcs-report-dynamic option is
3071-
// used to indicate if the user wants information relating to this, and will
3072-
// be set depending on the user's input, or warning if gcs-report is set to
3073-
// either `warning` or `error`.
3074-
if (ctx.arg.andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
3075-
for (SharedFile *f : ctx.sharedFiles)
3117+
// If we are utilising AArch64 GCS/RISC-V ZICFILP-unlabeled/RISC-V
3118+
// ZICFILP-func-sig/RISC-V ZICFISS at any stage, the sharedFiles should be
3119+
// checked to ensure they also support this feature. The -z xxx-report-dynamic
3120+
// option is used to indicate if the user wants information relating to this,
3121+
// and will be set depending on the user's input, or warning if -z xxx-report
3122+
// is set to either `warning` or `error`.
3123+
for (SharedFile *f : ctx.sharedFiles) {
3124+
if (ctx.arg.emachine == EM_AARCH64 &&
3125+
(ctx.arg.andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS))
30763126
reportUnless(ctx.arg.zGcsReportDynamic,
30773127
f->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
30783128
<< f
@@ -3081,6 +3131,44 @@ static void readSecurityNotes(Ctx &ctx) {
30813131
<< "dynamic loader might not enable GCS or refuse to load the "
30823132
"program unless all shared library "
30833133
<< "dependencies have the GCS marking.";
3134+
3135+
if (ctx.arg.emachine == EM_RISCV) {
3136+
if (ctx.arg.andFeatures & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED)
3137+
reportUnless(ctx.arg.zZicfilpUnlabeledReportDynamic,
3138+
f->andFeatures &
3139+
GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED)
3140+
<< f << ": " << "ZICFILP-unlabeled"
3141+
<< " is enabled, but this shared library lacks the necessary "
3142+
"property note. The dynamic loader might not enable "
3143+
<< "ZICFILP-unlabeled"
3144+
<< " or refuse to load the program unless all shared library "
3145+
"dependencies have the "
3146+
<< "ZICFILP-unlabeled" << " marking.";
3147+
3148+
if (ctx.arg.andFeatures & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG)
3149+
reportUnless(ctx.arg.zZicfilpFuncSigReportDynamic,
3150+
f->andFeatures &
3151+
GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG)
3152+
<< f << ": " << "ZICFILP-func-sig"
3153+
<< " is enabled, but this shared library lacks the necessary "
3154+
"property note. The dynamic loader might not enable "
3155+
<< "ZICFILP-func-sig"
3156+
<< " or refuse to load the program unless all shared library "
3157+
"dependencies have the "
3158+
<< "ZICFILP-func-sig" << " marking.";
3159+
3160+
if (ctx.arg.andFeatures & GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS)
3161+
reportUnless(ctx.arg.zZicfissReportDynamic,
3162+
f->andFeatures & GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS)
3163+
<< f << ": " << "ZICFISS"
3164+
<< " is enabled, but this shared library lacks the necessary "
3165+
"property note. The dynamic loader might not enable "
3166+
<< "ZICFISS"
3167+
<< " or refuse to load the program unless all shared library "
3168+
"dependencies have the "
3169+
<< "ZICFISS" << " marking.";
3170+
}
3171+
}
30843172
}
30853173

30863174
static void initSectionsAndLocalSyms(ELFFileBase *file, bool ignoreComdats) {

lld/ELF/InputFiles.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,8 +1450,17 @@ std::vector<uint32_t> SharedFile::parseVerneed(const ELFFile<ELFT> &obj,
14501450
// readGnuProperty, but we don't have the InputSection information.
14511451
template <typename ELFT>
14521452
void SharedFile::parseGnuAndFeatures(const ELFFile<ELFT> &obj) {
1453-
if (ctx.arg.emachine != EM_AARCH64)
1453+
unsigned featureAndType;
1454+
switch (ctx.arg.emachine) {
1455+
case EM_AARCH64:
1456+
featureAndType = GNU_PROPERTY_AARCH64_FEATURE_1_AND;
1457+
break;
1458+
case EM_RISCV:
1459+
featureAndType = GNU_PROPERTY_RISCV_FEATURE_1_AND;
1460+
break;
1461+
default:
14541462
return;
1463+
}
14551464
const uint8_t *base = obj.base();
14561465
auto phdrs = CHECK2(obj.program_headers(), this);
14571466
for (auto phdr : phdrs) {
@@ -1463,8 +1472,7 @@ void SharedFile::parseGnuAndFeatures(const ELFFile<ELFT> &obj) {
14631472
continue;
14641473

14651474
ArrayRef<uint8_t> desc = note.getDesc(phdr.p_align);
1466-
parseGnuPropertyNote<ELFT>(ctx, *this, GNU_PROPERTY_AARCH64_FEATURE_1_AND,
1467-
desc, base);
1475+
parseGnuPropertyNote<ELFT>(ctx, *this, featureAndType, desc, base);
14681476
}
14691477
}
14701478

lld/test/ELF/riscv-feature-zicfilp-func-sig.s

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,24 @@
5151
# REPORT-WARN: warning: f2.o: -z zicfilp-func-sig-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG property
5252
# REPORT-ERROR: error: f3.o: -z zicfilp-func-sig-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG property
5353

54+
## zicfilp-func-sig-report-dynamic should report any dynamic objects that does
55+
## not have the ZICFILP-func-sig property. This also ensures the inhertance from
56+
## zicfilp-func-sig-report is working correctly.
57+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-func-sig-report=warning -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
58+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-func-sig-report=error -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
59+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-func-sig-report-dynamic=none -z zicfilp=func-sig 2>&1 | count 0
60+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-func-sig-report-dynamic=warning -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
61+
# RUN: not ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-func-sig-report-dynamic=error -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
62+
# RUN: ld.lld f1-s.o f3-s.o out.force.so -z zicfilp-func-sig-report-dynamic=error -z zicfilp=func-sig 2>&1 | count 0
63+
# REPORT-WARN-DYNAMIC: warning: out.no.so: ZICFILP-func-sig is enabled, but this shared library lacks the necessary property note. The dynamic loader might not enable ZICFILP-func-sig or refuse to load the program unless all shared library dependencies have the ZICFILP-func-sig marking.
64+
# REPORT-WARN-DYNAMIC-NOT: {{.}}
65+
# REPORT-ERROR-DYNAMIC: error: out.no.so: ZICFILP-func-sig is enabled, but this shared library lacks the necessary property note. The dynamic loader might not enable ZICFILP-func-sig or refuse to load the program unless all shared library dependencies have the ZICFILP-func-sig marking.
66+
# REPORT-ERROR-DYNAMIC-NOT: error:
67+
5468
## An invalid -z zicfilp-func-sig-report option should give an error
55-
# RUN: not ld.lld f2-s.o -z zicfilp-func-sig-report=x 2>&1 | FileCheck --check-prefix=INVALID %s
69+
# RUN: not ld.lld f2-s.o -z zicfilp-func-sig-report=x -z zicfilp-func-sig-report-dynamic=x 2>&1 | FileCheck --check-prefix=INVALID %s
5670
# INVALID: error: unknown -z zicfilp-func-sig-report= value: x
71+
# INVALID: error: unknown -z zicfilp-func-sig-report-dynamic= value: x
5772

5873
## ZICFILP-unlabeled and ZICFILP-func-sig should conflict with each other.
5974
# RUN: ld.lld f3-u.o -o out.override -z zicfilp=func-sig 2>&1 | FileCheck --check-prefix=FORCE-CONFLICT %s

lld/test/ELF/riscv-feature-zicfilp-unlabeled.s

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,25 @@
5353
# REPORT-WARN: warning: f2.o: -z zicfilp-unlabeled-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED property
5454
# REPORT-ERROR: error: f3.o: -z zicfilp-unlabeled-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED property
5555

56+
## zicfilp-unlabeled-report-dynamic should report any dynamic objects that does
57+
## not have the ZICFILP-unlabeled property. This also ensures the inhertance
58+
## from zicfilp-unlabeled-report is working correctly.
59+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-unlabeled-report=warning -z zicfilp=unlabeled 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
60+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-unlabeled-report=error -z zicfilp=unlabeled 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
61+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-unlabeled-report-dynamic=none -z zicfilp=unlabeled 2>&1 | count 0
62+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-unlabeled-report-dynamic=warning -z zicfilp=unlabeled 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
63+
# RUN: not ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfilp-unlabeled-report-dynamic=error -z zicfilp=unlabeled 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
64+
# RUN: ld.lld f1-s.o f3-s.o out.force.so -z zicfilp-unlabeled-report-dynamic=error -z zicfilp=unlabeled 2>&1 | count 0
65+
# REPORT-WARN-DYNAMIC: warning: out.no.so: ZICFILP-unlabeled is enabled, but this shared library lacks the necessary property note. The dynamic loader might not enable ZICFILP-unlabeled or refuse to load the program unless all shared library dependencies have the ZICFILP-unlabeled marking.
66+
# REPORT-WARN-DYNAMIC-NOT: {{.}}
67+
# REPORT-ERROR-DYNAMIC: error: out.no.so: ZICFILP-unlabeled is enabled, but this shared library lacks the necessary property note. The dynamic loader might not enable ZICFILP-unlabeled or refuse to load the program unless all shared library dependencies have the ZICFILP-unlabeled marking.
68+
# REPORT-ERROR-DYNAMIC-NOT: error:
69+
5670
## An invalid -z zicfilp-unlabeled-report option should give an error
57-
# RUN: not ld.lld f2-s.o -z zicfilp=x -z zicfilp-unlabeled-report=x 2>&1 | FileCheck --check-prefix=INVALID %s
71+
# RUN: not ld.lld f2-s.o -z zicfilp=x -z zicfilp-unlabeled-report=x -z zicfilp-unlabeled-report-dynamic=x 2>&1 | FileCheck --check-prefix=INVALID %s
5872
# INVALID: error: unknown -z zicfilp= value: x
5973
# INVALID: error: unknown -z zicfilp-unlabeled-report= value: x
74+
# INVALID: error: unknown -z zicfilp-unlabeled-report-dynamic= value: x
6075

6176
## ZICFILP-unlabeled and ZICFILP-func-sig should conflict with each other
6277
# RUN: not ld.lld f1-c.o 2>&1 | FileCheck --check-prefix=CONFLICT %s

lld/test/ELF/riscv-feature-zicfiss.s

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,25 @@
4848
# REPORT-WARN: warning: f2.o: -z zicfiss-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS property
4949
# REPORT-ERROR: error: f3.o: -z zicfiss-report: file does not have GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS property
5050

51+
## zicfiss-report-dynamic should report any dynamic objects that does not have
52+
## the ZICFISS property. This also ensures the inhertance from zicfiss-report
53+
## is working correctly.
54+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfiss-report=warning -z zicfiss=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
55+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfiss-report=error -z zicfiss=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
56+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfiss-report-dynamic=none -z zicfiss=always 2>&1 | count 0
57+
# RUN: ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfiss-report-dynamic=warning -z zicfiss=always 2>&1 | FileCheck --check-prefix=REPORT-WARN-DYNAMIC %s
58+
# RUN: not ld.lld f1-s.o f3-s.o out.no.so out.force.so -z zicfiss-report-dynamic=error -z zicfiss=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR-DYNAMIC %s
59+
# RUN: ld.lld f1-s.o f3-s.o out.force.so -z zicfiss-report-dynamic=error -z zicfiss=always 2>&1 | count 0
60+
# REPORT-WARN-DYNAMIC: warning: out.no.so: ZICFISS is enabled, but this shared library lacks the necessary property note. The dynamic loader might not enable ZICFISS or refuse to load the program unless all shared library dependencies have the ZICFISS marking.
61+
# REPORT-WARN-DYNAMIC-NOT: {{.}}
62+
# REPORT-ERROR-DYNAMIC: error: out.no.so: ZICFISS is enabled, but this shared library lacks the necessary property note. The dynamic loader might not enable ZICFISS or refuse to load the program unless all shared library dependencies have the ZICFISS marking.
63+
# REPORT-ERROR-DYNAMIC-NOT: error:
64+
5165
## An invalid -z zicfiss-report option should give an error
52-
# RUN: not ld.lld f2-s.o f3-s.o -z zicfiss=x -z zicfiss-report=x 2>&1 | FileCheck --check-prefix=INVALID %s
66+
# RUN: not ld.lld f2-s.o f3-s.o -z zicfiss=x -z zicfiss-report=x -z zicfiss-report-dynamic=x 2>&1 | FileCheck --check-prefix=INVALID %s
5367
# INVALID: error: unknown -z zicfiss= value: x
5468
# INVALID: error: unknown -z zicfiss-report= value: x
69+
# INVALID: error: unknown -z zicfiss-report-dynamic= value: x
5570

5671
#--- rv32-f1-s.s
5772
.section ".note.gnu.property", "a"

0 commit comments

Comments
 (0)