<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 6, 2015 at 12:51 AM, Will Newton <span dir="ltr"><<a href="mailto:will.newton@gmail.com" target="_blank">will.newton@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Wed, May 6, 2015 at 6:22 AM, Chris Lattner <<a href="mailto:clattner@apple.com">clattner@apple.com</a>> wrote:<br>
> On May 5, 2015, at 6:47 PM, Daniel Dilts <<a href="mailto:diltsman@gmail.com">diltsman@gmail.com</a>> wrote:<br>
><br>
> Take a look at how debuggers have migrated through the years.  They too<br>
>><br>
>> used to have their own script format.  Now most (all?) popular debuggers<br>
>> do scripting through embedding an actual programming language.  This<br>
>> could be a better way forward for linkers as well -- embed Python in the<br>
>> linker, define a Python API for linkable item placement, entry point,<br>
>> symbol operations, etc..., and then you also have the rest of Python at<br>
>> your fingertips.<br>
><br>
><br>
> I mostly care about specifying address where specific symbols will be placed<br>
> and specifying the memory layout of the platform.   I normally use<br>
> __attribute__((section(""))) to place the symbols in their own sections and<br>
> then use the linker script to place the sections at the required addresses.<br>
> How would this be accomplished without linker scripts?<br>
><br>
><br>
> I’d prefer to use an "__attribute__((address(0x1234)))” myself.  That way<br>
> you can control platform specifics with #ifdefs.<br>
<br>
</div></div>But that way you have to do layout by hand in C. Generally you won't<br>
know the size of the preceding code or data so you won't know what<br>
address to put things at at the granularity of a single C level<br>
object/function. Better to say "put this in the ROM section" and set<br>
the address of the ROM section once in a linker script and let the<br>
linker do the layout.<br></blockquote><div><br></div><div>Chris is referring to memory-mapped registers that are literally at a fixed address in the hardware. These sorts of attributes already exist, e.g. <a href="https://gcc.gnu.org/onlinedocs/gcc/AVR-Variable-Attributes.html#AVR-Variable-Attributes">https://gcc.gnu.org/onlinedocs/gcc/AVR-Variable-Attributes.html#AVR-Variable-Attributes</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div></div>