http://www.invalidsoftware.net/os/?the_id=11
The URL above is about writing a kernel in C++, it is for 32bit Djgpp. It is the nearest resource I get. I try to use it's concept in my real mode kernel. But I need some hand.
objdump -h Kernel.o > Kernel.dis
Redirects the output of objdump to a file named Kernel.dis
Step 4 - Open the Kernel.dis with a text editor (Notepad, WordPad, my preferred choice is TextPad)
Look for something like this in the file
7 .ctors 00000004 000000f4 000000f4 00000294 2**2
CONTENTS, ALLOC, LOAD, RELOC, DATA
8 .dtors 00000004 000000f8 000000f8 00000298 2**2
CONTENTS, ALLOC, LOAD, RELOC, DATA.
If they are present, you can use solution 1.
This is what I get from the tutorial. So, for the first step, I need to check if the .ctors and .dtors(It may be other name in my object file that create from Turbo C++) is in the obj file. However, the object file I create from the Turbo C++ is OMF format, Djgpp can't read OMF format.
The first problem, Turbo C++ don't have objdump, the nearest tool I get is objxref, and it is the dump file I get.
Code: Select all
WARNING: Unresolved symbol operator new(unsigned int) in module TTTT
WARNING: Unresolved symbol operator delete(void near*) in module TTTT
WARNING: Unresolved symbol _printf in module TTTT
PUBLIC SYMBOL DEFINITIONS BY SYMBOL NAME
SYMBOL DEFINED IN
operator delete(void near*) -undefined-
operator new(unsigned int) -undefined-
_kk TTTT
_main TTTT
_printf -undefined-
PUBLIC SYMBOL DEFINITIONS BY MODULE NAME
MODULE: -undefined- defines the following symbols
operator delete(void near*)
operator new(unsigned int)
_printf
MODULE: TTTT defines the following symbols
_kk
_main
EXTERNAL SYMBOL REFERENCES BY MODULE NAME
MODULE: -undefined- references the following symbols
MODULE: TTTT references the following symbols
operator delete(void near*)
operator new(unsigned int)
_printf
PUBLIC SYMBOL DEFINITION AND REFERENCES BY SYMBOL NAME
operator delete(void near*) (-undefined-)
TTTT
operator new(unsigned int) (-undefined-)
TTTT
_printf (-undefined-)
TTTT
MODULE SIZES BY SEGMENT
_BSS, PUBLIC
0 (00000h) total
_DATA, PUBLIC
22 (00016h) TTTT
22 (00016h) total
_EXIT_, PUBLIC
6 (00006h) TTTT
6 (00006h) total
_INIT_, PUBLIC
6 (00006h) TTTT
6 (00006h) total
_TEXT, PUBLIC
48 (00030h) TTTT
48 (00030h) total
MODULE SIZES BY CLASS
BSS
0 (00000h) total
CODE
48 (00030h) _TEXT, TTTT
48 (00030h) total
DATA
22 (00016h) _DATA, TTTT
22 (00016h) total
EXITDATA
6 (00006h) _EXIT_, TTTT
6 (00006h) total
INITDATA
6 (00006h) _INIT_, TTTT
6 (00006h) total
UNREFERENCED PUBLIC SYMBOLS BY MODULE NAME
MODULE: TTTT defines the following unreferenced symbols
_kk
_main
Symbols = 5
Modules = 2
Segments = 5
Classes = 5
_kk is the test class I create, do you have any idea how to use of the data above.
Or any other tool that can dump the object file with OMF format.
#2 I have some question, first, what is BSS. And another thing, when the linker link the object file, will it collect all the global data and put all of then in some place. Or we need to setup where to put the global data in some place.
Thank you for answering my question. I know it is hard to solve it, but any help will be nice.