#2407 closed enhancement (fixed)

Enable function and data sections

Reported by: Sebastian Huber Owned by: Joel Sherrill
Priority: normal Milestone: 5.1
Component: build Version: 4.10
Severity: normal Keywords:
Cc: Blocked By:


In order to reduce the size of executables it is beneficial to put all global functions and data into separate sections. This enables the linker to perform a garbage collection which removes all items not directly referenced. The following steps are necessary:

  1. Modify the build system to use the following compiler and linker flags:

CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += -Wl,--gc-sections

  1. Review all linker command files and ensure that linker sets and global constructor sections are not affected by the garbage collection (e.g. use the KEEP() directive of GNU ld).

Change History (5)

comment:1 Changed on Mar 11, 2016 at 12:12:28 AM by Joel Sherrill

Closing. This has been done and distributed to other tickets when specific issues were encountered.

comment:2 Changed on Mar 11, 2016 at 12:12:40 AM by Joel Sherrill

Owner: set to Joel Sherrill
Status: newassigned

comment:3 Changed on Mar 11, 2016 at 12:12:47 AM by Joel Sherrill

Resolution: fixed
Status: assignedclosed

comment:4 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber


comment:5 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.