File tree 2 files changed +21
-5
lines changed
2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,12 @@ static Elf64_Sym *find_dot_toc(Elf64_Shdr *sechdrs,
277
277
return NULL ;
278
278
}
279
279
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
+
280
286
int module_frob_arch_sections (Elf64_Ehdr * hdr ,
281
287
Elf64_Shdr * sechdrs ,
282
288
char * secstrings ,
@@ -286,7 +292,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
286
292
287
293
/* Find .toc and .stubs sections, symtab and strtab */
288
294
for (i = 1 ; i < hdr -> e_shnum ; i ++ ) {
289
- char * p ;
290
295
if (strcmp (secstrings + sechdrs [i ].sh_name , ".stubs" ) == 0 )
291
296
me -> arch .stubs_section = i ;
292
297
else if (strcmp (secstrings + sechdrs [i ].sh_name , ".toc" ) == 0 ) {
@@ -298,10 +303,6 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,
298
303
dedotify_versions ((void * )hdr + sechdrs [i ].sh_offset ,
299
304
sechdrs [i ].sh_size );
300
305
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
-
305
306
if (sechdrs [i ].sh_type == SHT_SYMTAB )
306
307
dedotify ((void * )hdr + sechdrs [i ].sh_offset ,
307
308
sechdrs [i ].sh_size / sizeof (Elf64_Sym ),
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ module! {
16
16
license: b"GPL v2" ,
17
17
}
18
18
19
+ kernel:: init_static_sync! {
20
+ static SAMPLE_MUTEX : Mutex <u32 > = 10 ;
21
+ static SAMPLE_CONDVAR : CondVar ;
22
+ }
23
+
19
24
struct RustSync ;
20
25
21
26
impl KernelModule for RustSync {
@@ -45,6 +50,16 @@ impl KernelModule for RustSync {
45
50
cv. free_waiters ( ) ;
46
51
}
47
52
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
+
48
63
// Test spinlocks.
49
64
{
50
65
// SAFETY: `init` is called below.
You can’t perform that action at this time.
0 commit comments