{"id":191058,"date":"2013-08-23T12:36:03","date_gmt":"2013-08-23T08:36:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=191058"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=191058","title":{"rendered":"<span class=\"post_title\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445: \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a, \u0447\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/438\/be0\/c60\/438be0c60295fa01fbec0ec54947c008.jpg\"\/><br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441 \u043d\u0443\u043b\u044f \u0434\u043b\u044f ARM, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443 \u0442\u0435\u043c\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u0434\u043b\u044f GNU <i>ld<\/i>. \u042d\u0442\u0430 \u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u043a\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043d\u043e \u0438 \u0442\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u0425\u043e\u0442\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0435 arm-none-eabi, \u0441\u0443\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 \u0442\u0430 \u0436\u0435 \u0438 \u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 Visual Studio, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0438\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:  <\/p>\n<ul>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/189484\/\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/a><\/li>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/190032\/\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445: \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?<\/a><\/li>\n<\/ul>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: <a href=\"https:\/\/github.com\/farcaller\/arm-demos\">https:\/\/github.com\/farcaller\/arm-demos<\/a><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0438\u043f\u0438\u0447\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0446\u0438\u0439 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0427\u0435\u0442\u044b\u0440\u0435 \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u044d\u0442\u043e:  <\/p>\n<ul>\n<li><b>.text<\/b> \u2014 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434;<\/li>\n<li><b>.data<\/b> \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435;<\/li>\n<li><b>.rodata<\/b> \u2014 \u0430\u043d\u0430\u043b\u043e\u0433 <code>.data<\/code> \u0434\u043b\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445;<\/li>\n<li><b>.bss<\/b> \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/li>\n<\/ul>\n<p>  \u0412 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0431\u0443\u0434\u0443\u0442 \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u0435\u0449\u0435 \u0434\u0432\u0435 \u0441\u0435\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li><b>.comment<\/b> \u2014 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430;<\/li>\n<li><b>.ARM.attributes<\/b> \u2014 ARM-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0444\u0430\u0439\u043b\u0430.<\/li>\n<\/ul>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0441\u0435\u043a\u0446\u0438\u0439, \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0432\u0430\u0436\u043d\u0430\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c: \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u042d\u0442\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0445\u0435\u0448: \u0438\u043c\u044f \u2014 \u0430\u0434\u0440\u0435\u0441 (\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b). \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432\u0441\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0438\u0445 \u0430\u0434\u0440\u0435\u0441\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0443\u0434\u0430-\u0442\u043e \u0432 \u0441\u0435\u043a\u0446\u0438\u044e .text).<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0437\u0430 \u0434\u0435\u043b\u043e \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u0441\u043e\u0431\u0435\u0440\u0435\u0442 \u0432\u0441\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b. \u0414\u043b\u044f \u00ab\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445\u00bb \u041e\u0421 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0433\u0434\u0435 \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u043d\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0441\u043f\u0438\u0445\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u0444\u043b\u0435\u0448\u0443 \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<h4>\u0417\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u044c<\/h4>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0438\u0437\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043d\u0430 C: <code>module_a.c<\/code>:  <\/p>\n<pre><code class=\"cpp\">static int local_function();  int external_counter; static int counter; static int preset_counter = 5; const int constant = 10;  int public_function() {     volatile int i = 3 + constant;     ++external_counter;     return local_function() * i; }  static int local_function() {     ++counter;     ++preset_counter;     return counter + preset_counter; } <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438:  <\/p>\n<pre><code class=\"bash\">% rake 'show:sections[a]' arm-none-eabi-gcc -mthumb -O2 -mcpu=cortex-m0 -c module_a.c -o build\/module_a.o arm-none-eabi-objdump build\/module_a.o -h  build\/module_a.o:     file format elf32-littlearm  Sections: Idx Name          Size      VMA       LMA       File off  Algn   0 .text         00000034  00000000  00000000  00000034  2**2                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE   1 .data         00000004  00000000  00000000  00000068  2**2                   CONTENTS, ALLOC, LOAD, DATA   2 .bss          00000004  00000000  00000000  0000006c  2**2                   ALLOC   3 .rodata       00000004  00000000  00000000  0000006c  2**2                   CONTENTS, ALLOC, LOAD, READONLY, DATA   4 .comment      00000071  00000000  00000000  00000070  2**0                   CONTENTS, READONLY   5 .ARM.attributes 00000031  00000000  00000000  000000e1  2**0                   CONTENTS, READONLY <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u2014 \u0448\u0435\u0441\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u0439, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e. \u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438\u0434\u0443\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0441\u0435\u043a\u0446\u0438\u0438, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0435\u0435, \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0435. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432 \u044d\u0442\u0438\u0445 \u0441\u0435\u043a\u0446\u0438\u044f\u0445:<\/p>\n<pre><code class=\"bash\">% rake 'show:symbols:text[a]' arm-none-eabi-objdump build\/module_a.o -j .text -t  build\/module_a.o:     file format elf32-littlearm  SYMBOL TABLE: 00000000 l    d  .text  00000000 .text 00000000 g     F .text  00000034 public_function <\/code><\/pre>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0435\u043c man \u043f\u043e objdump \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0443\u043b\u044c\u0442\u0430\u0446\u0438\u0438. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0434\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430: <code>.text<\/code> \u2014 \u044d\u0442\u043e \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0435\u043a\u0446\u0438\u0438, <code>public_function<\/code> \u2014 \u044d\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0414\u043b\u044f <code>local_function<\/code> \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043d\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u043a\u0430\u043a <code>static<\/code>, \u0442.\u0435., \u043e\u043d\u0430 \u043d\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"bash\">% rake 'show:symbols:data[a]' arm-none-eabi-objdump build\/module_a.o -j .data -j .bss -t  build\/module_a.o:     file format elf32-littlearm  SYMBOL TABLE: 00000000 l    d  .data  00000000 .data 00000000 l    d  .bss 00000000 .bss 00000000 l     O .data  00000004 preset_counter 00000000 l     O .bss 00000004 counter <\/code><\/pre>\n<p>  \u0412 \u0441\u0435\u043a\u0446\u0438\u044f\u0445 <code>.data<\/code> \u0438 <code>.bss<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0432\u0430 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u2014 <code>preset_counter<\/code> \u0438 <code>counter<\/code>. \u041e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u044f\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 <code>preset_counter<\/code> \u0435\u0441\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0432 <code>.data<\/code>:<\/p>\n<pre><code class=\"bash\">% rake 'show:contents[a,.data]' arm-none-eabi-objdump build\/module_a.o -j .data -s  build\/module_a.o:     file format elf32-littlearm  Contents of section .data:  0000 05000000 <\/code><\/pre>\n<p>  \u0423 <code>counter<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043d \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043d\u043e\u043b\u044c \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0441\u0435\u043a\u0446\u0438\u044e <code>.bss<\/code>. \u0421\u0430\u043c\u0430 \u0441\u0435\u043a\u0446\u0438\u044f <code>.bss<\/code> \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043d\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u2014 \u044d\u0442\u043e \u043d\u0443\u043b\u0438. \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 <code>char buffer[1024]<\/code> \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430, \u0447\u0442\u043e \u043b\u0438\u0448\u0435\u043d\u043e \u0441\u043c\u044b\u0441\u043b\u0430.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u043f\u0430\u043b <code>external_counter<\/code>?<\/p>\n<pre><code class=\"bash\">% rake 'show:symbols:all[a]' arm-none-eabi-objdump build\/module_a.o -t  build\/module_a.o:     file format elf32-littlearm  SYMBOL TABLE: 00000000 l    df *ABS*  00000000 module_a.c 00000000 l    d  .text  00000000 .text 00000000 l    d  .data  00000000 .data 00000000 l    d  .bss 00000000 .bss 00000000 l    d  .rodata  00000000 .rodata 00000000 l     O .data  00000004 preset_counter 00000000 l     O .bss 00000004 counter 00000000 l    d  .comment 00000000 .comment 00000000 l    d  .ARM.attributes  00000000 .ARM.attributes 00000000 g     F .text  00000034 public_function 00000004       O *COM*  00000004 external_counter 00000000 g     O .rodata  00000004 constant <\/code><\/pre>\n<p>  <code>external_counter<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0432 \u0441\u0435\u043a\u0446\u0438\u044e <code>*COM*<\/code>. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043d, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0423\u0436\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 <i>ld<\/i> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u0438\u043b\u0438 \u0435\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u043c\u0443 \u2014 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <code>.bss<\/code>. \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e <code>const int constant<\/code> \u043f\u043e\u043f\u0430\u043b \u0432 <code>.rodata<\/code>. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0434\u0443 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443, \u0442\u0430\u043a \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u043e \u0444\u043b\u0435\u0448-\u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <code>.comment<\/code>:  <\/p>\n<pre><code class=\"bash\">% rake 'show:contents[a,.comment]' arm-none-eabi-objdump build\/module_a.o -j .comment -s  build\/module_a.o:     file format elf32-littlearm  Contents of section .comment:  0000 00474343 3a202847 4e552054 6f6f6c73  .GCC: (GNU Tools  0010 20666f72 2041524d 20456d62 65646465   for ARM Embedde  0020 64205072 6f636573 736f7273 2920342e  d Processors) 4.  0030 372e3320 32303133 30333132 20287265  7.3 20130312 (re  0040 6c656173 6529205b 41524d2f 656d6265  lease) [ARM\/embe  0050 64646564 2d345f37 2d627261 6e636820  dded-4_7-branch  0060 72657669 73696f6e 20313936 3631355d  revision 196615]  0070 00 <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 <code>.ARM.attributes<\/code>, \u043f\u0440\u0430\u0432\u0434\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 <i>objdump<\/i>, \u0430 <i>readelf<\/i>:  <\/p>\n<pre><code class=\"bash\">% rake 'show:attrs[a]' arm-none-eabi-readelf build\/module_a.o -A Attribute Section: aeabi File Attributes   Tag_CPU_name: &quot;Cortex-M0&quot;   Tag_CPU_arch: v6S-M   Tag_CPU_arch_profile: Microcontroller   Tag_THUMB_ISA_use: Thumb-1   Tag_ABI_PCS_wchar_t: 4   Tag_ABI_FP_denormal: Needed   Tag_ABI_FP_exceptions: Needed   Tag_ABI_FP_number_model: IEEE 754   Tag_ABI_align_needed: 8-byte   Tag_ABI_align_preserved: 8-byte, except leaf SP   Tag_ABI_enum_size: small   Tag_ABI_optimization_goals: Aggressive Speed <\/code><\/pre>\n<p>  \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0442\u0435\u0433\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"http:\/\/infocenter.arm.com\/help\/topic\/com.arm.doc.ihi0045d\/IHI0045D_ABI_addenda.pdf\">\u0438\u043d\u0444\u043e\u0446\u0435\u043d\u0442\u0440\u0435 ARM<\/a>.<\/p>\n<h4>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432 \u043a\u0443\u0447\u0443<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043a\u0430\u043a <i>ld<\/i> \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0445 \u0432 \u043e\u0434\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 <i>ld<\/i> \u0432\u0435\u0440\u0442\u0438\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u0430\u0440\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c, \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0434\u0438\u0440\u0430\u043d\u0438\u044f \u0441\u0435\u043a\u0446\u0438\u0439 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u0438\u0445 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u043c \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a. \u0412 \u00ab\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445\u00bb \u041e\u0421 \u044f\u0434\u0440\u043e \u0443\u043c\u0435\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u0430\u043c. \u0422\u0430\u043a\u0436\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0445\u043e\u0436\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0434\u043e\u0433\u0440\u0443\u0436\u0430\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044f \u043d\u0430 \u043d\u0438\u0445 \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438.<\/p>\n<p>  \u0421\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u043f\u0440\u043e\u0449\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u0431\u0435\u0440\u0435\u0442 \u0432\u0430\u0448 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0430 \u0444\u043b\u0435\u0448\u043a\u0443 \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0415\u0433\u043e \u043d\u0435 \u0432\u043e\u043b\u043d\u0443\u044e\u0442 \u043d\u0438 \u043c\u0430\u0447\u043e, \u043d\u0438 \u044d\u043b\u044c\u0444\u044b, \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c\u0438 \u0434\u0430\u043c\u043f\u0430\u043c\u0438.<\/p>\n<p>  \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u043e \u043a\u0443\u0441\u043e\u0447\u043a\u0430\u043c. <code>layout.ld:<\/code>  <\/p>\n<pre><code>MEMORY {    rom(RX)   : ORIGIN = 0x00000000, LENGTH = 0x8000    ram(WAIL) : ORIGIN = 0x10000000, LENGTH = 0x2000 }  ENTRY(public_function)  SECTIONS {   .text : { *(.text) } &gt; rom   _data_start = .;   .data : { *(.data) } &gt; ram AT&gt; rom   _bss_start = .;   .bss  : { *(.bss) }  &gt; ram   _bss_end = .; } <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0435\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c (\u0433\u0434\u0435-\u0442\u043e \u043e\u043a\u043e\u043b\u043e 0xFFFFFFFF \u0431\u0430\u0439\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 32-\u0431\u0438\u0442\u043d\u043e\u0433\u043e ARM). \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0440\u0435\u0433\u0438\u043e\u043d\u044b \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c: <code>rom<\/code> \u0438 <code>ram<\/code>. \u0411\u0443\u043a\u0432\u044b \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b: \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435, \u0437\u0430\u043f\u0438\u0441\u044c, \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u0421\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043a\u0438\u0434\u0430\u043d\u044b \u043f\u043e \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c \u0441 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u0430, \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u043e\u0442\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u0441\u0432\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a: <code>error: no memory region specified for loadable section `.data'<\/code>.<\/p>\n<p>  \u0414\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, <code>ORIGIN<\/code> \u0438 <code>LENGTH<\/code>, \u0437\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u0438 \u0434\u043b\u0438\u043d\u0443 \u0440\u0435\u0433\u0438\u043e\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b <code>org<\/code>, <code>o<\/code>, <code>len<\/code> \u0438 <code>l<\/code>, \u043e\u043d\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0442.\u0435., \u0432 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u044b <code>K<\/code>, <code>M<\/code>, \u0438 \u0442.\u043f. \u0417\u0430\u043f\u0438\u0441\u044c <code>LENGTH = 0x8000<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a: <code>l = 32K<\/code>.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0444\u0430\u0439\u043b\u0430 \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u043a\u0446\u0438\u0439. \u0412 \u0446\u0435\u043b\u043e\u043c, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <s>\u0438\u0437 \u043e\u0434\u043d\u0438\u0445 \u043f\u0440\u043e\u0442\u043e\u0431\u0430\u0444\u043e\u0432 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u0431\u0430\u0444\u044b<\/s> \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0435 <code>\u0418\u041c\u042f_\u0424\u0410\u0419\u041b\u0410(\u0418\u041c\u042f_\u0421\u0415\u041a\u0426\u0418\u0418)<\/code>, \u0441\u0438\u043c\u0432\u043e\u043b <code>*<\/code> \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c <code>*(.text)<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442: \u0441\u0435\u043a\u0446\u0438\u0438 <code>.text<\/code> \u0438\u0437 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  \u0423 \u0441\u0435\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0430\u0434\u0440\u0435\u0441\u0430: LMA (Load Memory Address) \u2014 \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f, \u0438 VMA (Virtual Memory Address) \u2014 \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u0431\u044a\u044f\u0441\u043d\u044f\u044f \u043f\u0440\u043e\u0449\u0435, LMA \u2014 \u044d\u0442\u043e \u0433\u0434\u0435 \u043e\u043d\u0430 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u0430 VMA \u2014 \u044d\u0442\u043e \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u0442.\u0435., \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b \u0432 \u043a\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 VMA-\u0430\u0434\u0440\u0435\u0441.<\/p>\n<p>  \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u0440\u0438 \u0441\u0435\u043a\u0446\u0438\u0438 \u2014 \u043a\u043e\u0434, \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 (<code>.text<\/code>) \u0432\u043e \u0444\u043b\u0435\u0448-\u043f\u0430\u043c\u044f\u0442\u044c, \u0434\u0430\u043d\u043d\u044b\u0435 (<code>.data<\/code>) \u2013 \u0432\u043e \u0444\u043b\u0435\u0448-\u043f\u0430\u043c\u044f\u0442\u044c, \u043d\u043e \u0438\u0437 \u0440\u0430\u0441\u0447\u0435\u0442\u0430, \u0447\u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 <code>.bss<\/code> \u2014 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<p>  \u0414\u043b\u044f <code>.bss<\/code>, \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0442\u0430\u043a, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0430. \u041d\u043e \u0432\u043e\u0442 \u0441 <code>.data<\/code> \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u0437-\u0437\u0430 \u0434\u0432\u043e\u044f\u043a\u043e\u0439 \u043d\u0430\u0442\u0443\u0440\u044b. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442\u0430\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>preset_counter<\/code>), \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u043e \u0444\u043b\u0435\u0448-\u043f\u0430\u043c\u044f\u0442\u0438. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u043e \u0441\u0435\u043a\u0446\u0438\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u042d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 LMA \u0438 VMA, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043d\u0430 C, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0438\u0437 LMA \u0432 VMA. \u0414\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <code>.rodata<\/code>, \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0444\u043b\u0435\u0448-\u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  \u0423 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u0435\u0441\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u2014 \u044d\u0442\u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 LMA. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0431\u043b\u043e\u043a\u0430 SECTIONS \u043a\u0443\u0440\u0441\u043e\u0440 \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e \u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043c\u0435\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439. \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>.<\/code> (\u0442\u043e\u0447\u043a\u0430).<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b:  <\/p>\n<pre><code class=\"bash\">% rake 'show:map[a]' arm-none-eabi-ld -T layout.ld -M -o build\/out.elf build\/module_a.o  Allocating common symbols Common symbol       size              file  external_counter    0x4               build\/module_a.o  Memory Configuration  Name             Origin             Length             Attributes rom              0x0000000000000000 0x0000000000008000 xr ram              0x0000000010000000 0x0000000000002000 awl *default*        0x0000000000000000 0xffffffffffffffff <\/code><\/pre>\n<p>  \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0432\u044b\u043d\u043e\u0441\u0438\u0442 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u00ab\u043e\u0431\u0449\u0438\u0439\u00bb \u0441\u0438\u043c\u0432\u043e\u043b <code>external_counter<\/code>. \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u044b\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e).  <\/p>\n<pre><code class=\"bash\">Linker script and memory map   .text           0x0000000000000000       0x34  *(.text)  .text          0x0000000000000000       0x34 build\/module_a.o                 0x0000000000000000                public_function                 0x0000000000000034                _data_start = . <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438, \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c <code>.text<\/code>.  <\/p>\n<pre><code class=\"bash\">.rodata         0x0000000000000034        0x4  .rodata        0x0000000000000034        0x4 build\/module_a.o                 0x0000000000000034                constant  .glue_7         0x0000000000000038        0x0  .glue_7        0x0000000000000000        0x0 linker stubs  .glue_7t        0x0000000000000038        0x0  .glue_7t       0x0000000000000000        0x0 linker stubs  .vfp11_veneer   0x0000000000000038        0x0  .vfp11_veneer  0x0000000000000000        0x0 linker stubs  .v4_bx          0x0000000000000038        0x0  .v4_bx         0x0000000000000000        0x0 linker stubs  .iplt           0x0000000000000038        0x0  .iplt          0x0000000000000000        0x0 build\/module_a.o  .rel.dyn        0x0000000000000038        0x0  .rel.iplt      0x0000000000000000        0x0 build\/module_a.o <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u043e\u043c \u0438\u0434\u0443\u0442 \u0441\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u044f\u0432\u043d\u043e \u2014 <code>.rodata<\/code>, <code>.glue_7<\/code>, <code>.glue_7t<\/code>, <code>.vfp11_veneer<\/code>, <code>.v4_bx<\/code>, <code>.iplt<\/code>, <code>.rel.dyn<\/code>. \u0421 <code>.rodata<\/code> \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u0430\u043c \u0432 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0431\u0430\u0439\u0442\u0430\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043d\u0430\u0448\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 <code>constant<\/code>. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439, \u0442\u043e \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u043e \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0440\u0430\u043c\u043f\u043b\u0438\u043d\u0430\u043c \u0438\u0437 ARM \u0432 Thumb. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0441\u0435\u043a\u0446\u0438\u0438 <b>\u043f\u0443\u0441\u0442\u044b\u0435<\/b> \u0438 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437.  <\/p>\n<pre><code class=\"bash\">.data           0x0000000010000000        0x4 load address 0x0000000000000038  *(.data)  .data          0x0000000010000000        0x4 build\/module_a.o                 0x0000000010000004                _data_end = . <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u043d\u0430\u0448\u0430 \u0441\u0435\u043a\u0446\u0438\u044f <code>.data<\/code>, \u043a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043e\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>0x10000000<\/code>, \u0445\u043e\u0442\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>0x38<\/code> (\u0442.\u0435., \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 <code>.rodata<\/code>). \u0422\u0443\u0442 \u0436\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0439 \u0438\u0437 \u043a\u0443\u0440\u0441\u043e\u0440\u0430, <code>_data_end<\/code>.  <\/p>\n<pre><code class=\"bash\">.igot.plt       0x0000000010000004        0x0 load address 0x000000000000003c  .igot.plt      0x0000000000000000        0x0 build\/module_a.o  .bss            0x0000000010000004        0x8 load address 0x000000000000003c  *(.bss)  .bss           0x0000000010000004        0x4 build\/module_a.o  COMMON         0x0000000010000008        0x4 build\/module_a.o                 0x0000000010000008                external_counter                 0x000000001000000c                _bss_end = . <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f, \u0441\u043b\u0435\u0434\u043e\u043c \u0437\u0430 \u043d\u0435\u0439 \u2014 <code>.bss<\/code>.  <\/p>\n<pre><code class=\"bash\">LOAD build\/module_a.o OUTPUT(build\/out.elf elf32-littlearm)  .comment        0x0000000000000000       0x70  .comment       0x0000000000000000       0x70 build\/module_a.o                                          0x71 (size before relaxing)  .ARM.attributes                 0x0000000000000000       0x31  .ARM.attributes                 0x0000000000000000       0x31 build\/module_a.o <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, <i>ld<\/i> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0438 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438. \u0412\u0440\u043e\u0434\u0435 \u0432\u0441\u0435?<\/p>\n<pre><code class=\"bash\">                0x0000000000000034                _data_start = . ... .data           0x0000000010000000        0x4 load address 0x0000000000000038 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e <code>.data<\/code>, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0442\u0443\u0434\u0430! \u0410 \u0432\u0435\u0434\u044c \u0438 \u043f\u0440\u0430\u0432\u0434\u0430, \u043a\u0443\u0440\u0441\u043e\u0440 \u043f\u043e\u0441\u043b\u0435 <code>.text<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0435\u0433\u043e \u043a\u043e\u043d\u0435\u0446. \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0435\u0435 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432\u043d\u0443\u0442\u0440\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">.data : {   _data_start = .;   *(.data)   _data_end = .; } &gt; ram AT&gt; rom <\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c:  <\/p>\n<pre><code class=\"bash\">% rake 'show:map[a]' SCRIPT=layout2.ld arm-none-eabi-ld -T layout2.ld -M -o build\/module_a.elf build\/module_a.o  ...  .data           0x0000000010000000        0x4 load address 0x0000000000000038                 0x0000000010000000                _data_start = .  *(.data)  .data          0x0000000010000000        0x4 build\/module_a.o                 0x0000000010000004                _data_end = .  ... <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.<\/p>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u2014 \u0430 \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u043c \u0434\u0435\u043b\u043e, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <code>.data<\/code>? \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u043e \u0444\u043b\u0435\u0448\u0435, \u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>.data<\/code> \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0430 \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430, \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u044e.<\/p>\n<h4>\u0423\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443<\/h4>\n<p>  \u0421 \u043e\u0434\u043d\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043d\u0430\u043c <code>external_counter<\/code> \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 C++: <code>module_b.cpp<\/code>  <\/p>\n<pre><code class=\"cpp\">int external_counter; extern &quot;C&quot; int public_function();  void function_b() {     external_counter += public_function(); }  void function_c() { }  void function_d() { } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 C++ \u0438\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u00ab\u043c\u0430\u043d\u0433\u043b\u0438\u043d\u0433\u00bb, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u0438\u043f\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0438\u043c\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438\u043c\u0435\u043d:  <\/p>\n<pre><code class=\"bash\">% rake 'show:symbols:text[b]' arm-none-eabi-gcc -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -mthumb -O2 -mcpu=cortex-m0 -c module_b.cpp -o build\/module_b.o arm-none-eabi-objdump build\/module_b.o -j .text -t  build\/module_b.o:     file format elf32-littlearm  SYMBOL TABLE: 00000000 l    d  .text  00000000 .text 00000000 g     F .text  00000014 _Z10function_bv 00000014 g     F .text  00000002 _Z10function_cv 00000018 g     F .text  00000002 _Z10function_dv <\/code><\/pre>\n<p>  \u041c\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 <code>-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables<\/code>, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u043a\u0446\u0438\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439. \u0418\u043c\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u044b\u043b\u0438 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u043d \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>public_function<\/code> \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f <code>a<\/code>. \u041a\u043e\u043c\u043f\u043e\u043d\u0443\u0435\u043c \u043e\u0431\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0440\u0430\u0437\u0443:  <\/p>\n<pre><code class=\"bash\">% rake 'show:map[a|b]' SCRIPT=layout2.ld arm-none-eabi-ld -T layout2.ld -M -o build\/out.elf build\/module_a.o build\/module_b.o  ...   .text          0x0000000000000000       0x34 build\/module_a.o                 0x0000000000000000                public_function  .text          0x0000000000000034       0x1c build\/module_b.o                 0x0000000000000034                function_b()                 0x0000000000000048                function_c()                 0x000000000000004c                function_d()  ... <\/code><\/pre>\n<p>  \u0411\u043b\u043e\u043a \u043e\u0431\u0449\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043f\u0440\u043e\u043f\u0430\u043b, \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445. \u0421\u0435\u043a\u0446\u0438\u0438 <code>.text<\/code>, \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435, \u043a\u043e\u043c\u043f\u043e\u043d\u0443\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<h4>\u0421\u043e\u0431\u0435\u0440\u0435\u043c \u043c\u0443\u0441\u043e\u0440!<\/h4>\n<p>  \u0414\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u0430\u043a \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u0435\u043d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u0435\u0440\u0442\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0431\u044b\u043b\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u043e. \u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u0435\u043a\u0446\u0438\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043b\u0430\u0433\u0430 <code>--gc-sections<\/code>:<\/p>\n<pre><code class=\"bash\">% rake 'show:map[a|b]' SCRIPT=layout2.ld GC=1 arm-none-eabi-ld --gc-sections -T layout2.ld -M -o build\/out.elf build\/module_a.o build\/module_b.o  Discarded input sections   .rodata        0x0000000000000000        0x4 build\/module_a.o  COMMON         0x0000000000000000        0x0 build\/module_a.o  .text          0x0000000000000000       0x1c build\/module_b.o  .data          0x0000000000000000        0x0 build\/module_b.o  ...  .text           0x0000000000000000       0x34  *(.text)  .text          0x0000000000000000       0x34 build\/module_a.o                 0x0000000000000000                public_function  ... <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0441\u0435\u043a\u0446\u0438\u044f <code>.text<\/code> \u0438\u0437 <code>build\/module_b.o<\/code> \u0431\u044b\u043b\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438! \u0417\u0430\u043e\u0434\u043d\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u043b \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u043e\u043b\u043d\u0430\u044f, \u0432 \u0447\u0435\u043c \u043c\u044b \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430, \u0441\u043c. <code>module_c.cpp<\/code>  <\/p>\n<pre><code class=\"cpp\">void function_b();  extern &quot;C&quot; int public_function() {     function_b(); } <\/code><\/pre>\n<p>  \u041c\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c <code>a<\/code> \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c <code>c<\/code> \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043c\u043e\u0436\u0435\u0442 \u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"bash\">% rake 'show:map[b|c]' SCRIPT=layout2.ld GC=1 arm-none-eabi-gcc -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -mthumb -O2 -mcpu=cortex-m0 -c module_c.cpp -o build\/module_c.o arm-none-eabi-ld --gc-sections -T layout2.ld -M -o build\/out.elf build\/module_b.o build\/module_c.o  Discarded input sections   .data          0x0000000000000000        0x0 build\/module_b.o  .data          0x0000000000000000        0x0 build\/module_c.o  .bss           0x0000000000000000        0x0 build\/module_c.o  ...  .text           0x0000000000000000       0x24  *(.text)  .text          0x0000000000000000       0x1c build\/module_b.o                 0x0000000000000000                function_b()                 0x0000000000000014                function_c()                 0x0000000000000018                function_d()  .text          0x000000000000001c        0x8 build\/module_c.o                 0x000000000000001c                public_function <\/code><\/pre>\n<p>  \u0425\u043e\u0442\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u0439 (\u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u043f\u0443\u0441\u0442\u044b\u0445) \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0443\u0434\u0430\u043b\u043e\u0441\u044c, \u043d\u043e \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0442\u0435\u0440\u044f\u0435\u043c \u0431\u0435\u0441\u0446\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>function_c()<\/code> \u0438 <code>function_d()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u0447\u0442\u043e \u0438 <code>function_b()<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430. \u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0434\u0443\u0442 \u0444\u043b\u0430\u0433\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438: <code>-ffunction-sections<\/code> \u0438 <code>-fdata-sections<\/code>:  <\/p>\n<pre><code class=\"cpp\">% rake clean && rake 'show:symbols:all[b]' SPLIT_SECTIONS=1 arm-none-eabi-gcc -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -mthumb -O2 -mcpu=cortex-m0 -c module_b.cpp -o build\/module_b.o arm-none-eabi-objdump build\/module_b.o -t  build\/module_b.o:     file format elf32-littlearm  SYMBOL TABLE: 00000000 l    df *ABS*  00000000 module_b.cpp 00000000 l    d  .text  00000000 .text 00000000 l    d  .data  00000000 .data 00000000 l    d  .bss 00000000 .bss 00000000 l    d  .text._Z10function_bv  00000000 .text._Z10function_bv 00000000 l    d  .text._Z10function_cv  00000000 .text._Z10function_cv 00000000 l    d  .text._Z10function_dv  00000000 .text._Z10function_dv 00000000 l    d  .bss.external_counter  00000000 .bss.external_counter 00000000 l    d  .comment 00000000 .comment 00000000 l    d  .ARM.attributes  00000000 .ARM.attributes 00000000 g     F .text._Z10function_bv  00000014 _Z10function_bv 00000000         *UND*  00000000 public_function 00000000 g     F .text._Z10function_cv  00000002 _Z10function_cv 00000000 g     F .text._Z10function_dv  00000002 _Z10function_dv 00000000 g     O .bss.external_counter  00000004 external_counter <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0442 \u043d\u0438\u0445 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f:  <\/p>\n<pre><code class=\"cpp\">% rake clean && rake 'show:map[b|c]' SCRIPT=layout2.ld GC=1 SPLIT_SECTIONS=1 arm-none-eabi-gcc -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -mthumb -O2 -mcpu=cortex-m0 -c module_b.cpp -o build\/module_b.o arm-none-eabi-gcc -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -mthumb -O2 -mcpu=cortex-m0 -c module_c.cpp -o build\/module_c.o arm-none-eabi-ld --gc-sections -T layout2.ld -M -o build\/out.elf build\/module_b.o build\/module_c.o  Discarded input sections   .text          0x0000000000000000        0x0 build\/module_b.o  .data          0x0000000000000000        0x0 build\/module_b.o  .bss           0x0000000000000000        0x0 build\/module_b.o  .text._Z10function_cv                 0x0000000000000000        0x4 build\/module_b.o  .text._Z10function_dv                 0x0000000000000000        0x4 build\/module_b.o  .text          0x0000000000000000        0x0 build\/module_c.o  .data          0x0000000000000000        0x0 build\/module_c.o  .bss           0x0000000000000000        0x0 build\/module_c.o  ... <\/code><\/pre>\n<h4>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u043e\u0431\u044a\u0435\u043c \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0442\u0435\u0442, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0430 \u2014 \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0442\u0435\u043c\u0430, \u0438 \u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u043e\u0441\u0438\u043b\u0438\u0442\u044c \u00ab\u0432\u043b\u0435\u0442\u00bb. \u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u0434\u0435\u043b\u044e \u043c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  P.S. \u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"http:\/\/habrahabr.ru\/users\/pfactum\/\" class=\"user_link\">pfactum<\/a> \u0437\u0430 \u0432\u044b\u0447\u0438\u0442\u043a\u0443 \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<h6><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/3.0\/deed.ru\"><img decoding=\"async\" alt=\"\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f Creative Commons\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a58\/dd6\/778\/a58dd6778494eefb36a9b5ccee5d6187.png\"\/><\/a> \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e <a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/3.0\/deed.ru\">\u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 Creative Commons \u00abAttribution-NonCommercial-NoDerivs\u00bb 3.0 Unported<\/a>. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a rel=\"license\" href=\"http:\/\/unlicense.org\">\u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 Unlicense<\/a> (\u0435\u0441\u043b\u0438 \u0438\u043d\u043e\u0435 \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u0445 \u0444\u0430\u0439\u043b\u043e\u0432). \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0435 \u0430\u0444\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u0430.<\/h6>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/191058\/\"> http:\/\/habrahabr.ru\/post\/191058\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/438\/be0\/c60\/438be0c60295fa01fbec0ec54947c008.jpg\"\/><br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441 \u043d\u0443\u043b\u044f \u0434\u043b\u044f ARM, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0437\u0430\u0442\u0440\u043e\u043d\u0443 \u0442\u0435\u043c\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u0434\u043b\u044f GNU <i>ld<\/i>. \u042d\u0442\u0430 \u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u043a\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043d\u043e \u0438 \u0442\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u0425\u043e\u0442\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0442\u0443\u043b\u0447\u0435\u0439\u043d\u0435 arm-none-eabi, \u0441\u0443\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 \u0442\u0430 \u0436\u0435 \u0438 \u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 Visual Studio, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0438\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:  <\/p>\n<ul>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/189484\/\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/a><\/li>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/190032\/\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445: \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?<\/a><\/li>\n<\/ul>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438: <a href=\"https:\/\/github.com\/farcaller\/arm-demos\">https:\/\/github.com\/farcaller\/arm-demos<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-191058","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/191058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=191058"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/191058\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}