Commit 34d6a27
committed
Refine generated instructions for staticly linked programs of Arm32
Previously, for the Arm architecture, the compiler generated the
following sequence at the program entry point for staticly linked
executables:
- a 'bl' instruction to call a global initialization function, and
then execute the main function.
- a 'b' instruction.
- a sequence of instructions to invoke the '_exit' system all.
After further investigation, since the main function inherently invokes
'_exit' upon completion, the entry sequence can be simplified. We now
use a single 'b' instruction to perform an unconditional jump to the
global initialization and the main routines.
Additionally, the implementation of the '__syscall' function has been
corrected. Previously, it modified registers r4-r7 without preserving
their original values for the caller. This commit ensures that these
callee-saved registers are properly saved and restored.
Finally, This refinement improves the efficiency and correctness of
the generated instructions for statically linked programs.1 parent b75bfee commit 34d6a27
1 file changed
Lines changed: 22 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
| 168 | + | |
| 169 | + | |
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
| |||
670 | 669 | | |
671 | 670 | | |
672 | 671 | | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
685 | 680 | | |
686 | 681 | | |
687 | 682 | | |
688 | 683 | | |
689 | | - | |
690 | | - | |
691 | | - | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
692 | 690 | | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
697 | 696 | | |
698 | 697 | | |
699 | 698 | | |
| |||
702 | 701 | | |
703 | 702 | | |
704 | 703 | | |
| 704 | + | |
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
| |||
0 commit comments