@@ -451,7 +451,7 @@ static int create_static_call_sections(struct objtool_file *file)
451
451
return 0 ;
452
452
453
453
idx = 0 ;
454
- list_for_each_entry (insn , & file -> static_call_list , static_call_node )
454
+ list_for_each_entry (insn , & file -> static_call_list , call_node )
455
455
idx ++ ;
456
456
457
457
sec = elf_create_section (file -> elf , ".static_call_sites" , SHF_WRITE ,
@@ -460,7 +460,7 @@ static int create_static_call_sections(struct objtool_file *file)
460
460
return -1 ;
461
461
462
462
idx = 0 ;
463
- list_for_each_entry (insn , & file -> static_call_list , static_call_node ) {
463
+ list_for_each_entry (insn , & file -> static_call_list , call_node ) {
464
464
465
465
site = (struct static_call_site * )sec -> data -> d_buf + idx ;
466
466
memset (site , 0 , sizeof (struct static_call_site ));
@@ -829,13 +829,16 @@ static int add_jump_destinations(struct objtool_file *file)
829
829
else
830
830
insn -> type = INSN_JUMP_DYNAMIC_CONDITIONAL ;
831
831
832
+ list_add_tail (& insn -> call_node ,
833
+ & file -> retpoline_call_list );
834
+
832
835
insn -> retpoline_safe = true;
833
836
continue ;
834
837
} else if (insn -> func ) {
835
838
/* internal or external sibling call (with reloc) */
836
839
insn -> call_dest = reloc -> sym ;
837
840
if (insn -> call_dest -> static_call_tramp ) {
838
- list_add_tail (& insn -> static_call_node ,
841
+ list_add_tail (& insn -> call_node ,
839
842
& file -> static_call_list );
840
843
}
841
844
continue ;
@@ -897,7 +900,7 @@ static int add_jump_destinations(struct objtool_file *file)
897
900
/* internal sibling call (without reloc) */
898
901
insn -> call_dest = insn -> jump_dest -> func ;
899
902
if (insn -> call_dest -> static_call_tramp ) {
900
- list_add_tail (& insn -> static_call_node ,
903
+ list_add_tail (& insn -> call_node ,
901
904
& file -> static_call_list );
902
905
}
903
906
}
@@ -981,14 +984,17 @@ static int add_call_destinations(struct objtool_file *file)
981
984
insn -> type = INSN_CALL_DYNAMIC ;
982
985
insn -> retpoline_safe = true;
983
986
987
+ list_add_tail (& insn -> call_node ,
988
+ & file -> retpoline_call_list );
989
+
984
990
remove_insn_ops (insn );
985
991
continue ;
986
992
987
993
} else
988
994
insn -> call_dest = reloc -> sym ;
989
995
990
996
if (insn -> call_dest && insn -> call_dest -> static_call_tramp ) {
991
- list_add_tail (& insn -> static_call_node ,
997
+ list_add_tail (& insn -> call_node ,
992
998
& file -> static_call_list );
993
999
}
994
1000
@@ -1714,6 +1720,11 @@ static void mark_rodata(struct objtool_file *file)
1714
1720
file -> rodata = found ;
1715
1721
}
1716
1722
1723
+ __weak int arch_rewrite_retpolines (struct objtool_file * file )
1724
+ {
1725
+ return 0 ;
1726
+ }
1727
+
1717
1728
static int decode_sections (struct objtool_file * file )
1718
1729
{
1719
1730
int ret ;
@@ -1742,6 +1753,10 @@ static int decode_sections(struct objtool_file *file)
1742
1753
if (ret )
1743
1754
return ret ;
1744
1755
1756
+ /*
1757
+ * Must be before add_special_section_alts() as that depends on
1758
+ * jump_dest being set.
1759
+ */
1745
1760
ret = add_jump_destinations (file );
1746
1761
if (ret )
1747
1762
return ret ;
@@ -1778,6 +1793,15 @@ static int decode_sections(struct objtool_file *file)
1778
1793
if (ret )
1779
1794
return ret ;
1780
1795
1796
+ /*
1797
+ * Must be after add_special_section_alts(), since this will emit
1798
+ * alternatives. Must be after add_{jump,call}_destination(), since
1799
+ * those create the call insn lists.
1800
+ */
1801
+ ret = arch_rewrite_retpolines (file );
1802
+ if (ret )
1803
+ return ret ;
1804
+
1781
1805
return 0 ;
1782
1806
}
1783
1807
0 commit comments