#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:
Blocking:

Description

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 03/11/16 at 00:12:28 by Joel Sherrill

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

comment:2 Changed on 03/11/16 at 00:12:40 by Joel Sherrill

Owner: set to Joel Sherrill
Status: newassigned

comment:3 Changed on 03/11/16 at 00:12:47 by Joel Sherrill

Resolution: fixed
Status: assignedclosed

comment:4 Changed on 05/11/17 at 07:31:02 by Sebastian Huber

Milestone: 4.124.12.0

comment:5 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.