Hi,
This line:
Code: Select all
$(LD) $(LDFLAGS) head.o -o system > System.map
is incorrect. On success, LD will output nothing (so your System.map file contains nothing).
The line of code you copied:
Code: Select all
nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map
Let's go through that bit by bit.
'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".
The expression, when you remove the backslashes put in there to stop the shell expanding them, reads:
Code: Select all
(compiled)|(.o$)|( [aU] )|(..ng$)|(LASH[RL]DI)
Which will match:
* 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