CPSC 355 Lecture Notes - Lecture 27: Object Code, Gnu Compiler Collection, Entry Point

130 views4 pages

Document Summary

Cpsc 355 - lecture 27 nov 18th. Equivalent assembly code define(i_r, w19) define(base_r, x20) fmt: spr_m: sum_m: fall_m: win_m season_m: . dword (cid:862)seaso(cid:374)[%d] = %s\(cid:374)(cid:863) (cid:862)spri(cid:374)g(cid:863) (cid:862)su(cid:373)(cid:373)er(cid:863) (cid:862)fall(cid:863) (cid:862)wi(cid:374)ter(cid:863) . global main stp . mov b i_r, 0 test adrp x0, fmt add x0, x0, :lo12:fmt mov w1, i_r. // set up the 2nd argument adrp base_r, season_m add base_r, base_r, :lo12:season_m. // calc array base address ldr x2, [base_r, i_r, sxtw 3] // set up the 3rd argument i_r, i_r 1 i_r, 4 top bl printf add cmp b. lt ldp ret test: Allow you to pass values from the shell into your program. In c: main (int argc, char argv[ ] : argc: the number of arguments, argv[ ]: an array of pointers to the arguments (represented as strings) Eg: c code: myecho. c pri(cid:374)tf((cid:862)%s\n, argv[i] ); return 0; register int i; for (i = 0; i < argc; i++) { int main( int argc, char *argv[ ] ){

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents