This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
MMU Off / Strict Alignment
- From: Christopher Covington <cov at codeaurora dot org>
- To: newlib at sourceware dot org, "linaro-toolchain at lists dot linaro dot org" <linaro-toolchain at lists dot linaro dot org>
- Date: Wed, 20 Nov 2013 12:57:05 -0500
- Subject: MMU Off / Strict Alignment
- Authentication-results: sourceware.org; auth=none
Hi,
We've noticed an issue trying to use the Linaro AArch64 binary bare metal
toolchain release with the MMU turned off for some low-level tests.
Anytime puts, sprintf, etc. gets called, a reent structure gets created with
references to STDIN, STDOUT, STDERR FILE types. A member in the __sFile
struct, _mbstate, is an 8 byte struct, but is not aligned on an 8 byte
boundary. This means that when memset (or a similar function) gets called on
this struct, and doesn't operate one byte at a time, a data alignment fault
will be generated when operating out of device memory, such as on a system
where the MMU has not yet been turned on yet.
I'm still examining possible fixes (I'll probably look at building with
-mstrict-align first), but I wanted to check if anyone had thoughts on the
subject and if Newlib upstream or Linaro consider using Newlib with the MMU
turned off to be a valid use case or if running the code that turns on the MMU
is considered a prerequisite to everything else.
Thanks,
Christopher
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.