<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div>Currently the XCore backend choses how to access the global based on whether it is declared as constant in the LLVM IR. If it is constant it is placed in the .cp.rodata section the accessed via the cp register, otherwise it is placed in the .dp.data section
 and it is accessed via the dp register.</div>
<div><br>
</div>
<div>In retrospect this is the wrong approach - it breaks when the constness of the global in LLVM IR differs across translation units and there is no way to avoid this with C++. I think the right fix is to move the decision of where to place the global (which
 is an ABI issue) to the frontend where the decision can be based on the high level type. In particular clang should explicitly specify the .cp.rodata section on globals that need to go in the cp according the XCore ABI. In the absence of an explicit section
 the XCore backend should place all globals in the .dp.data or .dp.rodata sections.</div>
<div><br>
</div>
<div>
<blockquote type="cite">
<div ocsi="0" fpstyle="1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div style="direction: ltr; font-family: Tahoma; font-size: 10pt;">
<div style="font-family: 'Times New Roman'; font-size: 16px;">
<div>
<div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><span style="font-size: 10pt;">This is a problem on the XCore target as we handle constant and non-constant data in separate areas and hence will emit different assembler instructions.</span><br>
<br>
Robert<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</body>
</html>