Skip to contentSkip to conversation

selftests: mm: fix linker error for inline function

PATCH New Amer Al Shanawany 1 participant 1 message Apr 20, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: mm: fix linker error for inline function

add 'static' keyword to 'sys_mprotect()' to link properly, otherwise the test won't build.

gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0

/usr/bin/ld: /tmp/cc7yeABp.o: in function `test_seal_elf':
seal_elf.c:(.text+0x7af): undefined reference to sys_mprotect' /usr/bin/ld: seal_elf.c:(.text+0x82c): undefined reference to sys_mprotect'
/usr/bin/ld: seal_elf.c:(.text+0xa4e): undefined reference to `sys_mprotect'

---
 tools/testing/selftests/mm/seal_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/seal_elf.c +1 -1
index 7143dc4f1b10..f0cf96625e58 100644
@@ -72,7 +72,7 @@ static void *sys_mmap(void *addr, unsigned long len, unsigned long prot,
 	return sret;
 }
 
-inline int sys_mprotect(void *ptr, size_t size, unsigned long prot)
+static inline int sys_mprotect(void *ptr, size_t size, unsigned long prot)
 {
 	int sret;
 
Signature · 1 line
2.34.1