Explorar el Código

generate symbol files

greatbridf hace 4 años
padre
commit
723d523b13
Se han modificado 2 ficheros con 15 adiciones y 1 borrados
  1. 5 1
      CMakeLists.txt
  2. 10 0
      make_symbol_table.sh

+ 5 - 1
CMakeLists.txt

@@ -23,7 +23,11 @@ add_custom_command(OUTPUT extracted_bootloader
 
 project(kernel_main)
 
-set(CMAKE_C_FLAGS "-nostdinc -m32 -nostdlib -Wall -O -fverbose-asm -fno-exceptions -fno-pic")
+if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+    set(CMAKE_C_FLAGS "-nostdinc -m32 -nostdlib -Wall -g -O0 -fverbose-asm -fno-exceptions -fno-pic")
+elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
+    set(CMAKE_C_FLAGS "-nostdinc -m32 -nostdlib -Wall -O -fverbose-asm -fno-exceptions -fno-pic")
+endif()
 
 include_directories(${PROJECT_SOURCE_DIR}/include)
 

+ 10 - 0
make_symbol_table.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+ld -T ./ldscript.ld ./build/extract/*.o -melf_i386 --oformat=elf32-i386 -o ./build/kernel.out
+
+objdump -t ./build/kernel.out | dd of=./build/dump.txt
+
+awk '($1 ~ /[0-9]/) && ($4 != "*ABS*") && ($4 != ".text.bootsect") && ($3 != ".text.bootsect") && ($4 != ".magicnumber") {print $1 " " $NF}' ./build/dump.txt | dd of=./build/kernel.sym
+
+rm ./build/kernel.out
+rm ./build/dump.txt