kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

link_reloc_desc.c (712B)


      1 /* Arch-aware relocation-descriptor dispatcher.
      2  *
      3  * Stitches the per-arch slices (src/arch/<arch>/reloc.c, reached through
      4  * LinkArchDesc.reloc_desc) onto the arch-neutral table (src/obj/reloc.c).
      5  * The arch slice wins so an arch can refine the classification of an
      6  * otherwise-neutral kind (e.g. R_PLT32 is a branch on x86-64 / RISC-V but
      7  * not on AArch64) while still sharing the neutral width. */
      8 
      9 #include "link/link_reloc_desc.h"
     10 
     11 #include "link/link_arch.h"
     12 
     13 const RelocDesc* reloc_desc(const Compiler* c, RelocKind k) {
     14   const LinkArchDesc* d = link_arch_desc_for(c);
     15   if (d && d->reloc_desc) {
     16     const RelocDesc* r = d->reloc_desc(k);
     17     if (r) return r;
     18   }
     19   return reloc_desc_neutral(k);
     20 }