boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

strip-file-prefix.after (721B)


      1     /* an elf symbol of type STT_FILE must be put so that STB_LOCAL
      2        symbols can be safely used. Under BOOTSTRAP, strip the well-known
      3        container mount prefix so seed-staged inputs (flat basenames) and
      4        podman-staged inputs (under /work/in/[tcc-lib/]) yield byte-
      5        identical .o files. Longest match first; both prefixes are
      6        bootstrap-internal layout constants. */
      7     {
      8         const char *fn = file->filename;
      9 #if BOOTSTRAP
     10         if (!strncmp(fn, "/work/in/tcc-lib/", 17)) fn += 17;
     11         else if (!strncmp(fn, "/work/in/", 9)) fn += 9;
     12 #endif
     13         put_elf_sym(symtab_section, 0, 0,
     14                     ELFW(ST_INFO)(STB_LOCAL, STT_FILE), 0,
     15                     SHN_ABS, fn);
     16     }