> > > Linker scripts are worse than everything - except for the alternatives > that > > we know about. Any particular suggestions here? > > I very much care about the functionality provided by linker scripts (for > embedded systems and kernel work), but I do agree that most current > script formats are hard to use, debug, reason about, etc... I have > often wondered whether embedding Python might be a better choice. > > Take a look at how debuggers have migrated through the years. They too > used to have their own script format. Now most (all?) popular debuggers > do scripting through embedding an actual programming language. This > could be a better way forward for linkers as well -- embed Python in the > linker, define a Python API for linkable item placement, entry point, > symbol operations, etc..., and then you also have the rest of Python at > your fingertips.I mostly care about specifying address where specific symbols will be placed and specifying the memory layout of the platform. I normally use __attribute__((section(""))) to place the symbols in their own sections and then use the linker script to place the sections at the required addresses. How would this be accomplished without linker scripts? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150505/1b87ad1a/attachment.html>
On May 5, 2015, at 6:47 PM, Daniel Dilts <diltsman at gmail.com> wrote:> Take a look at how debuggers have migrated through the years. They too > used to have their own script format. Now most (all?) popular debuggers > do scripting through embedding an actual programming language. This > could be a better way forward for linkers as well -- embed Python in the > linker, define a Python API for linkable item placement, entry point, > symbol operations, etc..., and then you also have the rest of Python at > your fingertips. > > I mostly care about specifying address where specific symbols will be placed and specifying the memory layout of the platform. I normally use __attribute__((section(""))) to place the symbols in their own sections and then use the linker script to place the sections at the required addresses. How would this be accomplished without linker scripts?I’d prefer to use an "__attribute__((address(0x1234)))” myself. That way you can control platform specifics with #ifdefs. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150505/6218c465/attachment.html>
On Wed, May 6, 2015 at 6:22 AM, Chris Lattner <clattner at apple.com> wrote:> On May 5, 2015, at 6:47 PM, Daniel Dilts <diltsman at gmail.com> wrote: > > Take a look at how debuggers have migrated through the years. They too >> >> used to have their own script format. Now most (all?) popular debuggers >> do scripting through embedding an actual programming language. This >> could be a better way forward for linkers as well -- embed Python in the >> linker, define a Python API for linkable item placement, entry point, >> symbol operations, etc..., and then you also have the rest of Python at >> your fingertips. > > > I mostly care about specifying address where specific symbols will be placed > and specifying the memory layout of the platform. I normally use > __attribute__((section(""))) to place the symbols in their own sections and > then use the linker script to place the sections at the required addresses. > How would this be accomplished without linker scripts? > > > I’d prefer to use an "__attribute__((address(0x1234)))” myself. That way > you can control platform specifics with #ifdefs.But that way you have to do layout by hand in C. Generally you won't know the size of the preceding code or data so you won't know what address to put things at at the granularity of a single C level object/function. Better to say "put this in the ROM section" and set the address of the ROM section once in a linker script and let the linker do the layout.