
what's mean of LDFLAGS =-m elf_i386 -Ttext 0 -e startup_32
i think it is the parameter or option of the GUN( ld)
but i do not know what it uesd for....?
thanks ..... any answers...
]nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map[/b
Code: Select all
$(LD) $(LDFLAGS) head.o -o system > System.map
Code: Select all
nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map
Code: Select all
nm system
Code: Select all
(compiled)|(.o$)|( [aU] )|(..ng$)|(LASH[RL]DI)
JamesM wrote:Hi,
This line:
is incorrect. On success, LD will output nothing (so your System.map file contains nothing).Code: Select all
$(LD) $(LDFLAGS) head.o -o system > System.map
The line of code you copied:
Let's go through that bit by bit.Code: Select all
nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map
'nm' is a binutils command that dumps out a list of symbols from an ELF file. The output from this is then piped into 'grep', which is a regular expression pattern matcher. It's called with a regular expression, and the '-v' flag which means "print all lines that do NOT match the given regular expression".Code: Select all
nm system
The expression, when you remove the backslashes put in there to stop the shell expanding them, reads:
Which will match:Code: Select all
(compiled)|(.o$)|( [aU] )|(..ng$)|(LASH[RL]DI)
* The word 'compiled', anywhere in the output.
* any line ending in any character followed by an 'o'.
* any line where the pattern 'SPACE a SPACE' or 'SPACE U SPACE' is found.
* any line which ends with two of any character followed by 'ng'.
* any line which contains the text 'LASHRDI' or 'LASHLDI'.
Those rules seem fairly strange to me, with the exception of the first three, but I assume they make sense for the binary you're compiling.
So the output of the grep stage will contain every line of the output of 'nm' that does NOT match the above rules.
The output of grep is then piped into 'sort', which takes its input and sorts it alphanumerically. This is then put into the file "System.map". (There's an extraneous '> System.map' in there - typo?)
That is its meaning.
Cheers,
James