@@ -84,7 +84,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline error_code
__unsupported() noexcept
{
-#if defined ENOTSUP
+#if defined __AVR__
+ // avr-libc defines ENOTSUP and EOPNOTSUPP but with nonsense values.
+ // ENOSYS is defined though, so use an error_code corresponding to that.
+ // This contradicts the comment above, but we don't have much choice.
+ return std::make_error_code(std::errc::function_not_supported);
+#elif defined ENOTSUP
return std::make_error_code(std::errc::not_supported);
#elif defined EOPNOTSUPP
// This is supposed to be for socket operations