return std::error_code(static_cast<int>(e), YamlReaderCategory());
}
-const std::error_category &LinkerScriptReaderCategory();
-
-enum class LinkerScriptReaderError {
- success = 0,
- parse_error,
- unknown_symbol_in_expr,
- unrecognized_function_in_expr,
- unknown_phdr_ids,
- extra_program_phdr,
- misplaced_program_phdr,
- program_phdr_wrong_phdrs,
-};
-
-inline std::error_code make_error_code(LinkerScriptReaderError e) {
- return std::error_code(static_cast<int>(e), LinkerScriptReaderCategory());
-}
-
/// Creates an error_code object that has associated with it an arbitrary
/// error messsage. The value() of the error_code will always be non-zero
/// but its value is meaningless. The messsage() will be (a copy of) the
namespace std {
template <> struct is_error_code_enum<lld::YamlReaderError> : std::true_type {};
-template <>
-struct is_error_code_enum<lld::LinkerScriptReaderError> : std::true_type {};
}
#endif
return o;
}
-class _LinkerScriptReaderErrorCategory : public std::error_category {
-public:
- const char *name() const LLVM_NOEXCEPT override {
- return "lld.linker-script.reader";
- }
-
- std::string message(int ev) const override {
- switch (static_cast<LinkerScriptReaderError>(ev)) {
- case LinkerScriptReaderError::success:
- return "Success";
- case LinkerScriptReaderError::parse_error:
- return "Error parsing linker script";
- case LinkerScriptReaderError::unknown_symbol_in_expr:
- return "Unknown symbol found when evaluating linker script expression";
- case LinkerScriptReaderError::unrecognized_function_in_expr:
- return "Unrecognized function call when evaluating linker script "
- "expression";
- case LinkerScriptReaderError::unknown_phdr_ids:
- return "Unknown header identifiers (missing in PHDRS command) are used";
- case LinkerScriptReaderError::extra_program_phdr:
- return "Extra program header is found";
- case LinkerScriptReaderError::misplaced_program_phdr:
- return "Program header must precede load segments";
- case LinkerScriptReaderError::program_phdr_wrong_phdrs:
- return "Program header has invalid PHDRS attribute";
- }
- llvm_unreachable("An enumerator of LinkerScriptReaderError does not have a "
- "message defined.");
- }
-};
-
-const std::error_category &lld::LinkerScriptReaderCategory() {
- static _LinkerScriptReaderErrorCategory o;
- return o;
-}
-
namespace lld {
/// Temporary class to enable make_dynamic_error_code() until