[PATCH] D136344: [ELF][RISCV] Merge `riscv.attributes` sections from all input files
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 5 13:34:30 PDT 2022
MaskRay added a comment.
Can you add a link to the official ABI and the relevant chapter?
> riscv.attributes sections
Change these to `.riscv.attributes` in the subject and description and comments.
================
Comment at: lld/ELF/SyntheticSections.cpp:3689
+ encodeULEB128(value, OSE);
+ memcpy(buf, OSE.str().data(), OSE.str().size());
+ return OSE.str().size();
----------------
The extra memcpy is wasteful.
================
Comment at: lld/ELF/SyntheticSections.cpp:3702
+ RISCVAttributeParser attributesParser;
+
+ if (Error e = attributesParser.parse(s->data(), support::little)) {
----------------
delete the blank line
================
Comment at: lld/ELF/SyntheticSections.cpp:3705
+ error(toString(s) + ": " + llvm::toString(std::move(e)));
+ }
+ for (const auto ¤tTag : attributesTags) {
----------------
drop braces
================
Comment at: lld/ELF/SyntheticSections.cpp:3768
+ std::unique_ptr<RISCVISAInfo> isaInfo(
+ new RISCVISAInfo(resultXlen, resultExtensions));
+ auto checkResult = RISCVISAInfo::postProcessAndChecking(std::move(isaInfo));
----------------
Does make_unique work?
================
Comment at: lld/ELF/SyntheticSections.cpp:3772
+ error(llvm::toString(checkResult.takeError()));
+ }
+ auto &resultInfo = *checkResult;
----------------
drop braces around single line simple statements.
================
Comment at: lld/ELF/SyntheticSections.cpp:3846
+ : SyntheticSection(flags, type, alignment, ".riscv.attributes") {}
+
+// Calculate size of attributes values subsection of `riscv.attributes`.
----------------
drop blank line.
================
Comment at: lld/ELF/SyntheticSections.cpp:3866
+ const size_t vendorHeaderSize = 4 + currentVendor.size() + 1;
+
+ return vendorHeaderSize + tagHeaderSize + contentsSize + 1;
----------------
drop blank line.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136344/new/
https://reviews.llvm.org/D136344
More information about the llvm-commits
mailing list