Coder Social home page Coder Social logo

Comments (6)

asiekierka avatar asiekierka commented on June 7, 2024

The main problem I've ran into with C macros is that they're not great at doing arithmetic; one could, of course, leave the arithmetic part to lld, but this would probably scale up to subtly impacting linking performance at the scale of hundreds of sections.

I'm going to lobby towards standardizing on Lua (which is an LLDB dependency regardless, alongside Python - though it may be optional...), but I will fully admit that I am unusually biased here as a long-time Lua enthusiast.

from llvm-mos-sdk.

asiekierka avatar asiekierka commented on June 7, 2024

(I'm willing to do some work on cleaning up the scripts in case they were to become an actual part of the SDK compilation process and not just a leftover from my work committed for preservation's sake.)

from llvm-mos-sdk.

mysterymath avatar mysterymath commented on June 7, 2024

The main problem I've ran into with C macros is that they're not great at doing arithmetic; one could, of course, leave the arithmetic part to lld, but this would probably scale up to subtly impacting linking performance at the scale of hundreds of sections.

I'm going to lobby towards standardizing on Lua (which is an LLDB dependency regardless, alongside Python - though it may be optional...), but I will fully admit that I am unusually biased here as a long-time Lua enthusiast.

This is a good point; it would also matter whether the arithmetic expressions we could generate from the preprocessor would be gibberish or readable and meaningful. I'd take that as an additional success criteria: the generated output may be much more verbose, but it should be as clear as the input linker script.

The main advantage to a macro language over a generator is the ability to mix abstractions into the unabstracted source text. The generated output is implicit in a generator; in a macro language, one can pretend that it's just a linker script, but with function definitions. I'd argue that our linker scripts are still mostly linker scripts, and that's the ideal level of abstraction to work at. That is, if you actually could define a function in LD to generate a section definition given some input arguments, doing math and so forth, it would be pretty clear that that's the way to go, but que sera.

I do doubt that we'll seriously stress LLD with our tiny embedded platform though; the bits of the linker script parser I've read are pretty efficient Dragon Book stuff, and our linker scripts are similar in size to those I've seen from other embedded projects in the wild (amazingly). It is the case that the smaller the project, the bigger the linker script, though; so this is one case where we can't do anything crazily n^2.

from llvm-mos-sdk.

asiekierka avatar asiekierka commented on June 7, 2024

We could import a simple templating library if you want to use Lua like .PHP. macros, think pl.template or something even more self-contained.

from llvm-mos-sdk.

mysterymath avatar mysterymath commented on June 7, 2024

Was thinking about that; the main advantage of the C preprocessor at that point is that it's familiar and doesn't add a new dependency (we can use the one in llvm-mos clang). That may very-well be outweighed by other concerns; particularly lack of a looping construct seems likely to be fatal now that I think more on it.

from llvm-mos-sdk.

mysterymath avatar mysterymath commented on June 7, 2024

LISP! LISP ALL THE THINGS!

from llvm-mos-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.