I have downloaded the sample operating systems from OSD (http://my.execpc.com/~geezer/osd/) and I have some questions:
The make file for OSD3 (one of the simple demo kernels) has the following:
krnl.x: $(OBJS) $(LDSCRIPT) $(MAKEDEP)
$(LD) -o$@ $(OBJS)
objdump --source $@ >krnl.lst
nm --line-numbers $@ | sort >krnl.sym
strip $@
What the purpose if the objdump, and nm line? I guess it is to save some debug information into krnl.lst and krnl.sym, right? Could I eliminate the 'objdump','nm' and 'strip' command and call LD with the '--strip-all' argument?
Question about certain GNU tools (objdump,ld,nm,strip)
Re:Question about certain GNU tools (objdump,ld,nm,strip)
Ok, LD can do the 'strip' command with the --strip-all flag. Is there flag (or flags) in LD that would let me do the same as the 'objdump' and 'nm' commands?
Re:Question about certain GNU tools (objdump,ld,nm,strip)
ld is a linker, and as such its purpose isn't to produce any debugging output. So no, you can't do objdump using ld - or there wouldn't be an objdump, right?
This makefile does two things: Create debug output (using objdump and nm) and linking the object files (using ld).
The 'strip' at the end is not strictly necessary because ld has a 'stip-all' option, and you can leave out the debug steps ('objdump' and 'nm'). Actually, if you run 'ld' with strip-all, there won't be any debug information left in the binary for objdump and/or nm to process, so calling them would be rather pointless.
Does that help?
This makefile does two things: Create debug output (using objdump and nm) and linking the object files (using ld).
The 'strip' at the end is not strictly necessary because ld has a 'stip-all' option, and you can leave out the debug steps ('objdump' and 'nm'). Actually, if you run 'ld' with strip-all, there won't be any debug information left in the binary for objdump and/or nm to process, so calling them would be rather pointless.
Does that help?
Every good solution is obvious once you've found it.
Re:Question about certain GNU tools (objdump,ld,nm,strip)
Thanks, it sort of helps...
I ask because I'm trying to use Borland C++BuilderX for OS Development and I have to configure it so it uses the LD linker and NASM. Originally it comes with Borland and MingW toolsets. Since C++BuilderX Personal Edition is free (and fairly decent) I wanted to use it.
I ask because I'm trying to use Borland C++BuilderX for OS Development and I have to configure it so it uses the LD linker and NASM. Originally it comes with Borland and MingW toolsets. Since C++BuilderX Personal Edition is free (and fairly decent) I wanted to use it.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Question about certain GNU tools (objdump,ld,nm,strip)
i dunno exactly what "nm" and "objdump" does with those arguments, but you can get the "map" of your built file using -Map <filename> flag in LD.Faw wrote: Ok, LD can do the 'strip' command with the --strip-all flag. Is there flag (or flags) in LD that would let me do the same as the 'objdump' and 'nm' commands?
It will show, among other things, the "LinkerScript and Memory Map"
Code: Select all
Linker script and memory map
0x0000000000000074 . = SIZEOF_HEADERS
.text 0x0000000000000000 0x1c4e0
0x0000000000002000 . = 0x2000
*fill* 0x0000000000000000 0x100002000 00
*(.text)
.text 0x0000000000002000 0x104 bin/kernel.o
0x00000000000020fc farJmp
0x00000000000020e0 enablePaging
0x00000000000020f4 farCall
0x0000000000002000 start
*fill* 0x0000000000002104 0xc 00
.text 0x0000000000002110 0x200 bin/config.o
0x0000000000002232 _prepare
0x00000000000022eb setBreakPoints