The official git repository for OSD-Contiki, the open source OS for the Internet of Things
Go to file
Jesus Sanchez-Palencia 8ae392e66f x86: Reduce .eh_frame section size
When generating binaries, gcc will always add information of what it
calls "the exception handler framework" into its own section: .eh_frame.
This section is based on the DWARF format's call frame information (CFI) [1]
and holds information that can be useful for debuggers but also for language
constructs that relies on always having stack unwinding information (i.e. exceptions).
Such constructs, however, are pretty much useless for the C language and are
mainly just used on C++. Furthermore, this section is one of the loadable sections
of a binary, meaning it will take extra space on flash.

When .eh_frame is not present, debuggers can still get the exact same information
they need for unwinding a stack frame and for restoring registers thanks to yet
another section: .debug_frame. This section is generated by '-g' gcc option and
friends. It is actually defined by DWARF and, as opposed to .eh_frame, is not a
loadable section. In other words, it is 'strippable' while .eh_frame is not.

Since all we need is the debug information we can get from .debug_frame, we can
disable the generation of these large and unused information tables by using gcc's
'-fno-asynchronous-unwind-tables'. The .eh_frame section stays around but the code
size issue is heavily tackled. This is the same approach taken on other projects
that target small code size generation [2] [3].

Pratically speaking, on a DEBUG build of the all-timers appplication, before this
patch we had:
   text    data     bss     dec     hex filename
  21319    1188   12952   35459    8a83 all-timers.galileo

And now, after this patch:
   text    data     bss     dec     hex filename
  16347    1188   12952   30487    7717 all-timers.galileo

This means a ~5Kb reduction on the loadable text segment (.text + .rodata + .eh_frame).

The flag is applied regardless of build type, DEBUG or RELEASE, since it benefits both.
Note that when release builds apply --gc-sections, they will remove .eh_frame section entirely.

[1] http://comments.gmane.org/gmane.comp.standards.dwarf/222
[2] 0d74ad383b
[3] http://git.musl-libc.org/cgit/musl/commit/?id=b439c051c7eee4eb4b93fc382f993aa6305ce530
[4] https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2015-12-21 08:06:14 -02:00
apps Adaptive time synchronization for TSCH 2015-12-07 11:51:41 +01:00
core Merge pull request #1285 from simonduq/pr/tsch 2015-12-07 14:29:10 +01:00
cpu x86: Reduce .eh_frame section size 2015-12-21 08:06:14 -02:00
dev Merge pull request #1168 from bthebaudeau/enc28j60-fixes-and-improvements 2015-12-15 00:14:02 +01:00
doc Merge pull request #1133 from bkozak-scanimetrics/cc-gcc 2015-12-05 00:39:59 +01:00
examples examples: Add all-timers example 2015-12-21 08:06:14 -02:00
lib/newlib Implement generic Newlib syscalls 2015-12-16 19:50:49 +01:00
platform x86: Revise CFLAGS and LDFLAGS for LLVM Clang compatibility 2015-12-21 08:06:14 -02:00
regression-tests jn516x: remove temporary adjustements for compilation in a 802.15.4e-free Contiki 2015-12-07 11:51:50 +01:00
tools fixed make login for Zoul on MAC 2015-12-19 10:28:30 +01:00
.gitattributes Add binary files file extension 2015-10-22 16:19:39 +02:00
.gitignore gitignore: Add platform/galileo/bsp/libc/Makefile.libc 2015-12-21 08:06:14 -02:00
.gitmodules Align to current master 2015-09-04 17:01:04 +02:00
.travis.yml Merge pull request #1219 from simonduq/jn516x-port 2015-09-25 12:09:52 +02:00
CONTRIBUTING.md Updated CONTRIBUTING.md to reflect Contiki's new merging policy 2015-08-18 22:06:56 +02:00
LICENSE Removed the explicit year 2012 to make it more generic 2012-10-25 23:08:54 +02:00
Makefile.include Makefile.include: Remove unused MODULESSUBST 2015-06-01 22:09:58 +02:00
README-BUILDING.md Rename to md 2013-03-26 23:15:37 +01:00
README-EXAMPLES.md Several minor consistency improvements. 2013-07-31 00:55:31 +02:00
README.md Travis icon in README.md: show build status of the current master rather than latest build status (can be any pull request) 2015-08-19 09:21:38 +02:00

The Contiki Operating System

Build Status

Contiki is an open source operating system that runs on tiny low-power microcontrollers and makes it possible to develop applications that make efficient use of the hardware while providing standardized low-power wireless communication for a range of hardware platforms.

Contiki is used in numerous commercial and non-commercial systems, such as city sound monitoring, street lights, networked electrical power meters, industrial monitoring, radiation monitoring, construction site monitoring, alarm systems, remote house monitoring, and so on.

For more information, see the Contiki website:

http://contiki-os.org