General Practices for clearing BSS segments

Source: Internet
Author: User

Link scripts generally contain similar statements:

_ Bss_start = .; __bss_start _ = .;. bss :{*(. shbss )*(. bss. bss. *. gnu. linkonce. b. *) * (COMMON )}. = ALIGN (4); _ bss_end = .; __bss_end _ = .;

The code for the startup process is generally compiled as follows:

@ ++ Clear the BSS section ++ ldr r2, =__ bss_start _ ldr r3, =__ bss_end _ mov r12, # 0bss_loop: cmp r2, r3 stmltia r2 !, {R12} blt bss_loop @ ---- clear the BSS section ----


Therefore, do not assign 0 to uninitialized global variables in the C code, because the BSS segment is automatically assigned 0.


This article is from "song Baohua's blog", please be sure to keep this source http://21cnbao.blog.51cto.com/109393/1295126

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.