GNU assembler (GAS) - pytanie o #define

Nov 17, 2009 6 Replies

Witam,



Mam pytanie dotyczące GNU asemblera (a dokładnie w wersji dla procków AVR32).



Czy można w nim zrobić coś w rodzaju #define? A dokłanie chodzi mi o zastąpienie rejestru identyfikatorem,



czyli zamiast:



mov r0, r1



zrobić coś takiego jak w asemblerze dla AVR 8bit:



.def dst = r0 .def src = r1



mov dst, src



Pozdrawiam, SM


SM pisze:

A próbowałeś przed assemblacją przepuścić plik przez preprocesor? Czyli dodać swoje #define w pliku i kompilować go z opcją "-x assembler-with-cpp"?

Zbych pisze:

Rozumiem że mam nie wywoływać avr32-as.exe tylko avr32-gcc.exe z podaną powyżej opcją (albo zapisanym plikiem źródłowym z rozszerzeniem .S)?

SM

SM pisze:

Tak, po podaniu opcji -x rozszerzenie nie ma znaczenia.

Tylko że teraz kompilator chce mi wcisnąć swoje procedury rozruchowe. chyba sekcja .fini czy też .reset. z crt0. Czy można jakąś opcją wyłączyć mu doklejanie czegokolwiek?

SM

SM pisze:

Można:

-nostartfiles Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used.

-nodefaultlibs Do not use the standard system libraries when linking. Only the libraries you specify will be passed to the linker. The standard startup files are used normally, unless -nostartfiles is used. The compiler may generate calls to memcmp, memset, memcpy and memmove. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified.

-nostdlib Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify will be passed to the linker. The compiler may generate calls to memcmp, memset, memcpy and memmove. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified.

Wielkie dzięki za pomoc!

Pozdrawiam, SM

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required