I have Linux Kernel with me and trying to generate ELF Header on it using objcopy tool, Below is the first step
objcopy -I binary -B i386 -O elf32-i386 --rename-section .data=.text linux_kernel.bin main.o
And after this I wanted to read symbol table using readelf -s main.o ,but getting strange symbols, below is output
Symbol table '.symtab' contains 5 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 SECTION LOCAL DEFAULT 1
2: 00000000 0 NOTYPE GLOBAL DEFAULT 1 _binary_linux_kernel_bin_
3: 004df650 0 NOTYPE GLOBAL DEFAULT 1 _binary_linux_kernel_bin_
4: 004df650 0 NOTYPE GLOBAL DEFAULT ABS _binary_linux_kernel_bin_
Now should be able to see symbols like
_binary_linux_kernel_bin_start
_binary_linux_kernel_bin__end
_binary_linux_kernel_bin_size
Can any body let me know where I am doing wrong?? or is it expected one??
Why I wanted to see proper symbol because have to do something like below one
--entry_point=_binary_linux_kernel_bin_start
It is simply that the string is too long and readelf
is truncating. Try objdump -x main.o
.