@@ -532,69 +532,74 @@ static int apply_uleb128_accumulation(struct module *me, void *location, long bu
532532 * This handles static linking only.
533533 */
534534static const struct relocation_handlers reloc_handlers [] = {
535- [R_RISCV_32 ] = { apply_r_riscv_32_rela },
536- [R_RISCV_64 ] = { apply_r_riscv_64_rela },
537- [R_RISCV_RELATIVE ] = { dynamic_linking_not_supported },
538- [R_RISCV_COPY ] = { dynamic_linking_not_supported },
539- [R_RISCV_JUMP_SLOT ] = { dynamic_linking_not_supported },
540- [R_RISCV_TLS_DTPMOD32 ] = { dynamic_linking_not_supported },
541- [R_RISCV_TLS_DTPMOD64 ] = { dynamic_linking_not_supported },
542- [R_RISCV_TLS_DTPREL32 ] = { dynamic_linking_not_supported },
543- [R_RISCV_TLS_DTPREL64 ] = { dynamic_linking_not_supported },
544- [R_RISCV_TLS_TPREL32 ] = { dynamic_linking_not_supported },
545- [R_RISCV_TLS_TPREL64 ] = { dynamic_linking_not_supported },
535+ [R_RISCV_32 ] = { . reloc_handler = apply_r_riscv_32_rela },
536+ [R_RISCV_64 ] = { . reloc_handler = apply_r_riscv_64_rela },
537+ [R_RISCV_RELATIVE ] = { . reloc_handler = dynamic_linking_not_supported },
538+ [R_RISCV_COPY ] = { . reloc_handler = dynamic_linking_not_supported },
539+ [R_RISCV_JUMP_SLOT ] = { . reloc_handler = dynamic_linking_not_supported },
540+ [R_RISCV_TLS_DTPMOD32 ] = { . reloc_handler = dynamic_linking_not_supported },
541+ [R_RISCV_TLS_DTPMOD64 ] = { . reloc_handler = dynamic_linking_not_supported },
542+ [R_RISCV_TLS_DTPREL32 ] = { . reloc_handler = dynamic_linking_not_supported },
543+ [R_RISCV_TLS_DTPREL64 ] = { . reloc_handler = dynamic_linking_not_supported },
544+ [R_RISCV_TLS_TPREL32 ] = { . reloc_handler = dynamic_linking_not_supported },
545+ [R_RISCV_TLS_TPREL64 ] = { . reloc_handler = dynamic_linking_not_supported },
546546 /* 12-15 undefined */
547- [R_RISCV_BRANCH ] = { apply_r_riscv_branch_rela },
548- [R_RISCV_JAL ] = { apply_r_riscv_jal_rela },
549- [R_RISCV_CALL ] = { apply_r_riscv_call_rela },
550- [R_RISCV_CALL_PLT ] = { apply_r_riscv_call_plt_rela },
551- [R_RISCV_GOT_HI20 ] = { apply_r_riscv_got_hi20_rela },
552- [R_RISCV_TLS_GOT_HI20 ] = { tls_not_supported },
553- [R_RISCV_TLS_GD_HI20 ] = { tls_not_supported },
554- [R_RISCV_PCREL_HI20 ] = { apply_r_riscv_pcrel_hi20_rela },
555- [R_RISCV_PCREL_LO12_I ] = { apply_r_riscv_pcrel_lo12_i_rela },
556- [R_RISCV_PCREL_LO12_S ] = { apply_r_riscv_pcrel_lo12_s_rela },
557- [R_RISCV_HI20 ] = { apply_r_riscv_hi20_rela },
558- [R_RISCV_LO12_I ] = { apply_r_riscv_lo12_i_rela },
559- [R_RISCV_LO12_S ] = { apply_r_riscv_lo12_s_rela },
560- [R_RISCV_TPREL_HI20 ] = { tls_not_supported },
561- [R_RISCV_TPREL_LO12_I ] = { tls_not_supported },
562- [R_RISCV_TPREL_LO12_S ] = { tls_not_supported },
563- [R_RISCV_TPREL_ADD ] = { tls_not_supported },
564- [R_RISCV_ADD8 ] = { apply_r_riscv_add8_rela , apply_8_bit_accumulation },
565- [R_RISCV_ADD16 ] = { apply_r_riscv_add16_rela ,
566- apply_16_bit_accumulation },
567- [R_RISCV_ADD32 ] = { apply_r_riscv_add32_rela ,
568- apply_32_bit_accumulation },
569- [R_RISCV_ADD64 ] = { apply_r_riscv_add64_rela ,
570- apply_64_bit_accumulation },
571- [R_RISCV_SUB8 ] = { apply_r_riscv_sub8_rela , apply_8_bit_accumulation },
572- [R_RISCV_SUB16 ] = { apply_r_riscv_sub16_rela ,
573- apply_16_bit_accumulation },
574- [R_RISCV_SUB32 ] = { apply_r_riscv_sub32_rela ,
575- apply_32_bit_accumulation },
576- [R_RISCV_SUB64 ] = { apply_r_riscv_sub64_rela ,
577- apply_64_bit_accumulation },
547+ [R_RISCV_BRANCH ] = { .reloc_handler = apply_r_riscv_branch_rela },
548+ [R_RISCV_JAL ] = { .reloc_handler = apply_r_riscv_jal_rela },
549+ [R_RISCV_CALL ] = { .reloc_handler = apply_r_riscv_call_rela },
550+ [R_RISCV_CALL_PLT ] = { .reloc_handler = apply_r_riscv_call_plt_rela },
551+ [R_RISCV_GOT_HI20 ] = { .reloc_handler = apply_r_riscv_got_hi20_rela },
552+ [R_RISCV_TLS_GOT_HI20 ] = { .reloc_handler = tls_not_supported },
553+ [R_RISCV_TLS_GD_HI20 ] = { .reloc_handler = tls_not_supported },
554+ [R_RISCV_PCREL_HI20 ] = { .reloc_handler = apply_r_riscv_pcrel_hi20_rela },
555+ [R_RISCV_PCREL_LO12_I ] = { .reloc_handler = apply_r_riscv_pcrel_lo12_i_rela },
556+ [R_RISCV_PCREL_LO12_S ] = { .reloc_handler = apply_r_riscv_pcrel_lo12_s_rela },
557+ [R_RISCV_HI20 ] = { .reloc_handler = apply_r_riscv_hi20_rela },
558+ [R_RISCV_LO12_I ] = { .reloc_handler = apply_r_riscv_lo12_i_rela },
559+ [R_RISCV_LO12_S ] = { .reloc_handler = apply_r_riscv_lo12_s_rela },
560+ [R_RISCV_TPREL_HI20 ] = { .reloc_handler = tls_not_supported },
561+ [R_RISCV_TPREL_LO12_I ] = { .reloc_handler = tls_not_supported },
562+ [R_RISCV_TPREL_LO12_S ] = { .reloc_handler = tls_not_supported },
563+ [R_RISCV_TPREL_ADD ] = { .reloc_handler = tls_not_supported },
564+ [R_RISCV_ADD8 ] = { .reloc_handler = apply_r_riscv_add8_rela ,
565+ .accumulate_handler = apply_8_bit_accumulation },
566+ [R_RISCV_ADD16 ] = { .reloc_handler = apply_r_riscv_add16_rela ,
567+ .accumulate_handler = apply_16_bit_accumulation },
568+ [R_RISCV_ADD32 ] = { .reloc_handler = apply_r_riscv_add32_rela ,
569+ .accumulate_handler = apply_32_bit_accumulation },
570+ [R_RISCV_ADD64 ] = { .reloc_handler = apply_r_riscv_add64_rela ,
571+ .accumulate_handler = apply_64_bit_accumulation },
572+ [R_RISCV_SUB8 ] = { .reloc_handler = apply_r_riscv_sub8_rela ,
573+ .accumulate_handler = apply_8_bit_accumulation },
574+ [R_RISCV_SUB16 ] = { .reloc_handler = apply_r_riscv_sub16_rela ,
575+ .accumulate_handler = apply_16_bit_accumulation },
576+ [R_RISCV_SUB32 ] = { .reloc_handler = apply_r_riscv_sub32_rela ,
577+ .accumulate_handler = apply_32_bit_accumulation },
578+ [R_RISCV_SUB64 ] = { .reloc_handler = apply_r_riscv_sub64_rela ,
579+ .accumulate_handler = apply_64_bit_accumulation },
578580 /* 41-42 reserved for future standard use */
579- [R_RISCV_ALIGN ] = { apply_r_riscv_align_rela },
580- [R_RISCV_RVC_BRANCH ] = { apply_r_riscv_rvc_branch_rela },
581- [R_RISCV_RVC_JUMP ] = { apply_r_riscv_rvc_jump_rela },
581+ [R_RISCV_ALIGN ] = { . reloc_handler = apply_r_riscv_align_rela },
582+ [R_RISCV_RVC_BRANCH ] = { . reloc_handler = apply_r_riscv_rvc_branch_rela },
583+ [R_RISCV_RVC_JUMP ] = { . reloc_handler = apply_r_riscv_rvc_jump_rela },
582584 /* 46-50 reserved for future standard use */
583- [R_RISCV_RELAX ] = { apply_r_riscv_relax_rela },
584- [R_RISCV_SUB6 ] = { apply_r_riscv_sub6_rela , apply_6_bit_accumulation },
585- [R_RISCV_SET6 ] = { apply_r_riscv_set6_rela , apply_6_bit_accumulation },
586- [R_RISCV_SET8 ] = { apply_r_riscv_set8_rela , apply_8_bit_accumulation },
587- [R_RISCV_SET16 ] = { apply_r_riscv_set16_rela ,
588- apply_16_bit_accumulation },
589- [R_RISCV_SET32 ] = { apply_r_riscv_set32_rela ,
590- apply_32_bit_accumulation },
591- [R_RISCV_32_PCREL ] = { apply_r_riscv_32_pcrel_rela },
592- [R_RISCV_IRELATIVE ] = { dynamic_linking_not_supported },
593- [R_RISCV_PLT32 ] = { apply_r_riscv_plt32_rela },
594- [R_RISCV_SET_ULEB128 ] = { apply_r_riscv_set_uleb128 ,
595- apply_uleb128_accumulation },
596- [R_RISCV_SUB_ULEB128 ] = { apply_r_riscv_sub_uleb128 ,
597- apply_uleb128_accumulation },
585+ [R_RISCV_RELAX ] = { .reloc_handler = apply_r_riscv_relax_rela },
586+ [R_RISCV_SUB6 ] = { .reloc_handler = apply_r_riscv_sub6_rela ,
587+ .accumulate_handler = apply_6_bit_accumulation },
588+ [R_RISCV_SET6 ] = { .reloc_handler = apply_r_riscv_set6_rela ,
589+ .accumulate_handler = apply_6_bit_accumulation },
590+ [R_RISCV_SET8 ] = { .reloc_handler = apply_r_riscv_set8_rela ,
591+ .accumulate_handler = apply_8_bit_accumulation },
592+ [R_RISCV_SET16 ] = { .reloc_handler = apply_r_riscv_set16_rela ,
593+ .accumulate_handler = apply_16_bit_accumulation },
594+ [R_RISCV_SET32 ] = { .reloc_handler = apply_r_riscv_set32_rela ,
595+ .accumulate_handler = apply_32_bit_accumulation },
596+ [R_RISCV_32_PCREL ] = { .reloc_handler = apply_r_riscv_32_pcrel_rela },
597+ [R_RISCV_IRELATIVE ] = { .reloc_handler = dynamic_linking_not_supported },
598+ [R_RISCV_PLT32 ] = { .reloc_handler = apply_r_riscv_plt32_rela },
599+ [R_RISCV_SET_ULEB128 ] = { .reloc_handler = apply_r_riscv_set_uleb128 ,
600+ .accumulate_handler = apply_uleb128_accumulation },
601+ [R_RISCV_SUB_ULEB128 ] = { .reloc_handler = apply_r_riscv_sub_uleb128 ,
602+ .accumulate_handler = apply_uleb128_accumulation },
598603 /* 62-191 reserved for future standard use */
599604 /* 192-255 nonstandard ABI extensions */
600605};
0 commit comments