scripts: build: gen_handles: exit on relocatable files

Print a clean error message when provided a relocatable file, instead
of generating a source file which will cause compilation errors further
away from the source.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
diff --git a/scripts/build/gen_handles.py b/scripts/build/gen_handles.py
index c97bb2f..e6807bf 100755
--- a/scripts/build/gen_handles.py
+++ b/scripts/build/gen_handles.py
@@ -121,6 +121,13 @@
         edt = pickle.load(f)
 
     parsed_elf = ZephyrElf(args.kernel, edt, args.start_symbol)
+    if parsed_elf.relocatable:
+        # While relocatable elf files will load cleanly, the pointers pulled from
+        # the symbol table are invalid (as expected, because the structures have not
+        # yet been allocated addresses). Fixing this will require iterating over
+        # the relocation sections to find the symbols those pointers will end up
+        # referring to.
+        sys.exit('Relocatable elf files are not yet supported')
 
     if args.output_graphviz:
         # Try and output the dependency tree