<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">For my 16 bit based target implementation, I need objects larger than 1 byte to get always aligned to 2 bytes.</div><div class=""><br class=""></div><div class="">For simple types, this is easily made by setting alignments in the MyTarget.h file (for example IntWidth=16; IntAlign=16; and so on)</div><div class="">For arrays, I have set LargeArrayMinWidth = 8; LargeArrayAlign = 16; so that all of them get an alignment of 2 bytes.</div><div class=""><br class=""></div><div class="">However, I am lost at what to do with Structs. The desired behaviour is obtained when I explicitly give the __attribute__( (aligned) ) in the source C code, such as this</div><div class=""><br class=""></div><div class="">struct AA<br class="">{<br class=""> char n;<br class=""> char m;<br class=""> char j;<br class="">} __attribute__( (aligned) );</div><div class=""><br class=""></div><div class="">but I would want CLang to set that attribute by default to all aggregate types.</div><div class=""><br class=""></div><div class="">Setting MinGlobalAlign is not an option because I still want single bytes to be 1 byte aligned, also, this does not work for objects initialised on the stack.</div><div class=""><br class=""></div><div class="">So, what’s the code hook to instruct Clang to always emit aligned code (as if the __attribute__( (aligned) ) was specified) ?</div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">John Lluch<br class=""></div></div></div></div></div></body></html>