1. 22
  1.  

  2. 3

    Story was submitted a few months ago. Last section was entirely rewritten in recent days.

    1. 1

      Hey @jart, is there a guide for targeting APE in a new compiler (as opposed to GCC/Clang)?

      1. 2

        It depends on whether or not you’re doing the linking. If you can use ape.lds with ld.bfd, then it’s relatively straightforward. You just generate the .o files. We already do this with third_party/chibicc. If you generate the APE format by hand, the tricky part is probably going to be figuring out how to generate ELF + MachO + PE all it once, overlaid into the same structure. But once that’s done, APE only really has one requirement, which is the shell script should be the same. I’ve thought about writing up a more formal spec for this. Is it something you need?

        1. 1

          I am idly curious – I don’t need anything. I was thinking it might be a fun post in the Compiling a Lisp series. I already have some in-progress code to generate an executable ELF but it’s really gross… if there’s an “easy” way to generate a .o from C, then I am all ears.

      Stories with similar links:

      1. Size Optimization Tricks via fstamour 5 months ago | 27 points | 11 comments