diff mbox series

[08/14] core: make is_rodata test-friendly

Message ID 20170915054059.32109-8-oohall@gmail.com
State Accepted
Headers show
Series [01/14] core/pci-dt-slot: Represent PCIe slots in the devicetree | expand

Commit Message

Oliver O'Halloran Sept. 15, 2017, 5:40 a.m. UTC
Add a dummy is_rodata() implementation for use inside test code.
Currently we don't need to make this actually check if the given
pointer is actually read-only, but someone might want it to work
properly in the future.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 include/skiboot.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/skiboot.h b/include/skiboot.h
index 0ab9f3883973..3040c5175125 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -45,16 +45,23 @@ 
 /* Special ELF sections */
 #define __force_data		__section(".force.data")
 
-/* Readonly section start and end. */
-extern char __rodata_start[], __rodata_end[];
-
 struct mem_region;
 extern struct mem_region *mem_region_next(struct mem_region *region);
 
+#ifndef __TESTING__
+/* Readonly section start and end. */
+extern char __rodata_start[], __rodata_end[];
+
 static inline bool is_rodata(const void *p)
 {
 	return ((const char *)p >= __rodata_start && (const char *)p < __rodata_end);
 }
+#else
+static inline bool is_rodata(const void *p)
+{
+	return false;
+}
+#endif
 
 #define OPAL_BOOT_COMPLETE 0x1
 /* Debug descriptor. This structure is pointed to by the word at offset