File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -277,6 +277,12 @@ static Elf64_Sym *find_dot_toc(Elf64_Shdr *sechdrs,
277277 return NULL ;
278278}
279279
280+ bool module_init_section (const char * name )
281+ {
282+ /* We don't handle .init for the moment: always return false. */
283+ return false;
284+ }
285+
280286int module_frob_arch_sections (Elf64_Ehdr * hdr ,
281287 Elf64_Shdr * sechdrs ,
282288 char * secstrings ,
@@ -286,7 +292,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
286292
287293 /* Find .toc and .stubs sections, symtab and strtab */
288294 for (i = 1 ; i < hdr -> e_shnum ; i ++ ) {
289- char * p ;
290295 if (strcmp (secstrings + sechdrs [i ].sh_name , ".stubs" ) == 0 )
291296 me -> arch .stubs_section = i ;
292297 else if (strcmp (secstrings + sechdrs [i ].sh_name , ".toc" ) == 0 ) {
@@ -298,10 +303,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
298303 dedotify_versions ((void * )hdr + sechdrs [i ].sh_offset ,
299304 sechdrs [i ].sh_size );
300305
301- /* We don't handle .init for the moment: rename to _init */
302- while ((p = strstr (secstrings + sechdrs [i ].sh_name , ".init" )))
303- p [0 ] = '_' ;
304-
305306 if (sechdrs [i ].sh_type == SHT_SYMTAB )
306307 dedotify ((void * )hdr + sechdrs [i ].sh_offset ,
307308 sechdrs [i ].sh_size / sizeof (Elf64_Sym ),
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ module! {
1616 license: b"GPL v2" ,
1717}
1818
19+ kernel:: init_static_sync! {
20+ static SAMPLE_MUTEX : Mutex <u32 > = 10 ;
21+ static SAMPLE_CONDVAR : CondVar ;
22+ }
23+
1924struct RustSync ;
2025
2126impl KernelModule for RustSync {
@@ -45,6 +50,16 @@ impl KernelModule for RustSync {
4550 cv. free_waiters ( ) ;
4651 }
4752
53+ // Test static mutex + condvar.
54+ * SAMPLE_MUTEX . lock ( ) = 20 ;
55+
56+ {
57+ let mut guard = SAMPLE_MUTEX . lock ( ) ;
58+ while * guard != 20 {
59+ let _ = SAMPLE_CONDVAR . wait ( & mut guard) ;
60+ }
61+ }
62+
4863 // Test spinlocks.
4964 {
5065 // SAFETY: `init` is called below.
You can’t perform that action at this time.
0 commit comments