boot2

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

arm64-link-asm-relocs.after (1924B)


      1 int code_reloc (int reloc_type)
      2 {
      3     switch (reloc_type) {
      4         case R_AARCH64_ABS32:
      5         case R_AARCH64_ABS64:
      6 	case R_AARCH64_PREL32:
      7 	case R_AARCH64_PREL64:
      8         case R_AARCH64_MOVW_UABS_G0_NC:
      9         case R_AARCH64_MOVW_UABS_G1_NC:
     10         case R_AARCH64_MOVW_UABS_G2_NC:
     11         case R_AARCH64_MOVW_UABS_G3:
     12         case R_AARCH64_ADR_PREL_PG_HI21:
     13         case R_AARCH64_ADD_ABS_LO12_NC:
     14         case R_AARCH64_ADR_GOT_PAGE:
     15         case R_AARCH64_LD64_GOT_LO12_NC:
     16         case R_AARCH64_GLOB_DAT:
     17         case R_AARCH64_COPY:
     18             return 0;
     19 
     20         case R_AARCH64_JUMP26:
     21         case R_AARCH64_CALL26:
     22         case R_AARCH64_CONDBR19:
     23         case R_AARCH64_TSTBR14:
     24         case R_AARCH64_JUMP_SLOT:
     25             return 1;
     26     }
     27 
     28     tcc_error ("Unknown relocation type: %d", reloc_type);
     29     return -1;
     30 }
     31 
     32 /* Returns an enumerator to describe whether and when the relocation needs a
     33    GOT and/or PLT entry to be created. See tcc.h for a description of the
     34    different values. */
     35 int gotplt_entry_type (int reloc_type)
     36 {
     37     switch (reloc_type) {
     38 	case R_AARCH64_PREL32:
     39 	case R_AARCH64_PREL64:
     40         case R_AARCH64_MOVW_UABS_G0_NC:
     41         case R_AARCH64_MOVW_UABS_G1_NC:
     42         case R_AARCH64_MOVW_UABS_G2_NC:
     43         case R_AARCH64_MOVW_UABS_G3:
     44         case R_AARCH64_ADR_PREL_PG_HI21:
     45         case R_AARCH64_ADD_ABS_LO12_NC:
     46         case R_AARCH64_GLOB_DAT:
     47         case R_AARCH64_JUMP_SLOT:
     48         case R_AARCH64_COPY:
     49             return NO_GOTPLT_ENTRY;
     50 
     51         case R_AARCH64_ABS32:
     52         case R_AARCH64_ABS64:
     53         case R_AARCH64_JUMP26:
     54         case R_AARCH64_CALL26:
     55         case R_AARCH64_CONDBR19:
     56         case R_AARCH64_TSTBR14:
     57             return AUTO_GOTPLT_ENTRY;
     58 
     59         case R_AARCH64_ADR_GOT_PAGE:
     60         case R_AARCH64_LD64_GOT_LO12_NC:
     61             return ALWAYS_GOTPLT_ENTRY;
     62     }
     63 
     64     tcc_error ("Unknown relocation type: %d", reloc_type);
     65     return -1;
     66 }