What is '(+ 304 bytes shared)' in the .map and .lst file?

Technical Note 29512

Targets:
430, AVR, AVR32, 8051, M16C, M32C, R32C, CF, CR16C, H8, HCS12, MAXQ, S08, SAM8, V850

Component:
Linker

Updated:
12/5/2007 11:03 AM

Introduction

Information about the generated amount of bytes is collected and shown. Still some parts of this information can be hard to decipher. This tech note focuses on 'bytes shared'. (Products using IAR ILINK Linkerâ„¢ are not covered by this Tech Note.)

Details

Information about the generated amount of bytes for functions and data for each memory is directed to stdout and displayed on the screen. Some of the bytes might be reported as shared. Example and more information below.

Example

---calendar.lst-------------------------------------------------------------

5 646 bytes of CODE  memory (+ 304 bytes shared)
656 bytes of CONST memory
288 bytes of DATA memory

Errors: none
Warnings: none

---calendar.s**-------------------------------------------------------------

      PUBWEAK `?*?DATA_ID`
MULTWEAK ??BKP_DeInit??rT
MULTWEAK ??BKP_ReadBackupRegister??rT
MULTWEAK ??BKP_WriteBackupRegister??rT

---STM32F10x_Demo.map-------------------------------------------------------

DATA_ID
Segment part 87. NOT NEEDED.
ENTRY ADDRESS REF BY
===== ======= ======
?*?DATA_ID

----------------------------------------------------------------------------

Above example has 304 bytes shared as shown in the *.lst file and stdout. Looking in the assembler file *.s** entries with PUBWEAK and MULTWEAK are the ones marked with shared. Finally the entries are also seen in the *.map file as NOT NEEDED.

Options enabled to get the information

  • IAR Embedded Workbench IDE > Project > Options... > C/C++ Compiler > List > select 'Output assembler file'
  • IAR Embedded Workbench IDE > Project > Options... > Linker > List > select 'Include suppressed entries'

Generate .\Release\List\*.map

  • IAR Embedded Workbench IDE > Project > Options... > Category: Linker > Diagnostics > select 'Always generate output'
  • IAR Embedded Workbench IDE > Project > Options... > Category: Linker > List > select 'Generate linker listing' and 'Module summary'

To see sizes and the command line used in stdout

  • IAR Embedded Workbench IDE > Tools > Options... > IDE Options > Messages > Show build messages > select 'All'

To get more debug information from the compiler

  • IAR Embedded Workbench IDE > Project > Options... > C/C++ Compiler > List > select 'Output list file' and 'Diagnostics'
  • IAR Embedded Workbench IDE > Project > Options... > C/C++ Compiler > Diagnostics > select 'Enable remarks'

More information

Shared objects are functions or data objects that are shared between modules. If any of these occur in more than one module, only one copy will be retained. For example, in some cases inline functions are not inlined, which means that they are marked as shared, because only one instance of each function will be included in the final application. This mechanism is sometimes also used for compiler-generated code or data not directly associated with a particular function or variable, and when only one instance is required in the final application.

All product names are trademarks or registered trademarks of their respective owners.

Related Tech Notes

© IAR Systems 1995-2016 - All rights reserved.