Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Sauermann J.Realtime operating systems.Concepts and implementation of microkernels for embedded systems.1997.pdf
Скачиваний:
29
Добавлен:
23.08.2013
Размер:
1.32 Mб
Скачать

6. Development Environment

121

 

 

removed. The map file is useful to translate absolute addresses (e.g. in stack dumps created in the case of fatal errors) to function names.

101Target.sym:Target.td

102$(NM) -n --demangle $< \

103| awk '{printf("%s %s\n", $$1, $$3)}' \

104| grep -v compiled | grep -v "\.o" \

105| grep -v "_DYNAMIC" | grep -v "^U" > $@

The object file crt0.o for the start-up code crt0.S is linked with libos.a (containing all object files for our sources) and with libgcc (containing all object files required by the gcc compiler).

108Target.td:crt0.o libos.a libgcc.a

109$(CC) -o $@ crt0.o -L. -los -lgcc $(LDFLAGS)

6.5.2 The skip_aout Utility

As already mentioned, the .TEXT segment extracted from Target.td by objcopy starts with a 32 byte header if the link address is 0. This header can be removed by the following utility skip_aout, which simply discards the first 32 bytes from stdin and copies the remaining bytes to stdout.

// skip_aout.cc #include <stdio.h>

enum { AOUT_OFFSET = 0x20 }; // 32 byte aout header to skip

int main(int, char *[])

{

int count, cc;

for (count =

0; (cc = getchar()) != EOF; count++)

if (count >= AOUT_OFFSET) putchar(cc);

exit(count <

AOUT_OFFSET ? 1 : 0);

}