<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>
<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>
<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">
<p style="color: #777777;">
<a href="https://gitlab.rtems.org/opticron">Kinsey Moore</a>
<a href="https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/issues/144#note_135804">commented</a>:
</p>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">While the fix mentioned above is the correct fix for NOEL-V, you're right that it would affect all other RISC-V BSPs and that should be avoided. This means that possible solutions are:</p>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0 0 1rem; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Add a multilib variant that provides supporting libraries with strict alignment</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Add support to RTEMS RISC-V CPU port for RTEMS_EXCEPTION_EXTENSIONS and use that to emulate unaligned accesses</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Force all multilibs to use <code style='font-size: 90%; color: #18171d; word-wrap: break-word; border-radius: .25rem; background-color: #ececef; margin-top: 0; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;'>-mstrict-align</code>
</li>
</ul>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">In the case of the first solution, we need a way to delineate strictly aligned multilibs from others which can be configured in RTEMS so that the correct multilib is selected. This also adds to the already wide variety of multilibs available for RISC-V which increases the time to compile the toolchain. We may want to reconsider exactly which multilibs need to be represented.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">The second solution has drawbacks as well since strictly aligned code will be significantly more efficient than emulated support, especially for large memcmp() or memcpy() calls. If RTEMS were to ever run in something other than M-mode, this solution would be required to operate alongside other possible solutions.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">As for the third solution, there is anecdotal evidence around the internet that, generally, M-mode code should not use unaligned accesses at all and that, generally, unaligned accesses are slower than aligned accesses.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">Some questions to answer:</p>
<ul dir="auto" style="text-align: initial; list-style-type: disc; margin: 0; padding: 0;">
<li style="margin-top: 0; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Is there an easy way to know whether a RISC-V CPU supports misaligned accesses beyond trying it to see if it generates a trap?</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">How do we differentiate between strict/non-strict multilibs?</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Should we switch all RISC-V multilibs/BSPs to strict alignment?</li>
</ul>
</div>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #626168;">
—
<br>
<a href="https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/issues/144#note_135804">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/821dba5d1ba680219e252ea820600e40/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/issues/144#note_135804 at 1762538820
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/issues/144#note_135804"}}</script>
</p>
</div>
</body>
</html>