Skip to content

Add support for compiling with -ffunction-sections -fdata-sections

Tim Abbott lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 12 repliesIn review
  2. v24 patches 20 repliesSuperseded
  3. v14 patches 4 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Make section names compatible with -ffunction-sections -fdata-sectionsDocumentation/mutex-design.txt arch/alpha/kernel/head.S arch/alpha/kernel/init_task.c +138 more+356 -34866 replies
2/3modpost: Check the section flags, not name, to catch missing "ax"/"aw"scripts/mod/modpost.c+19 -320 replies
3/3modpost: Support objects with more than 64k sectionsscripts/mod/file2alias.c scripts/mod/modpost.c scripts/mod/modpost.h+113 -300 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchPaul MundtSam RavnborgHirokazu Takata
1/3A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/3] Add support for compiling with -ffunction-sections -fdata-sections
Quoted 2 lines · Linus Torvalds

I'd be ok with merging it, but I haven't really gotten a strong feeling that anybody is going to enable it or use it.

Linus,

Would you be willing to merge the first 3 patches in this patch series at this point? I'm resending these patches to resolve some conflicts that was recently introduced.

To summarize the discussion, there are three uses for this code that have significant interest.

One is decreasing the kernel size. Denys Vlasenko has numbers that using the linker's --gc-sections option (for which these patches are a prerequisite) saves 10% of the kernel size when CONFIG_MODULES=n, and 1% when CONFIG_MODULES=y. Paul Mundt thinks many embedded users would use this if it were available.

A related use is cleaning up a lot of ifdefs that exist only to decrease the kernel size. Several developers commented favorably on the direction of using section garbage collection for dead code removal.

Finally, Ksplice depends on the option added by this patch series.

The first 3 patches in this patch series fix problems associated with using -ffunction-sections. As there are some architectures currently using -ffunction-sections, these should ideally be merged now, especially the first patch which involves scattered changes.

-Tim Abbott