Skip to content

RFC linux: add linker tables

Luis R. Rodriguez linux-arch linux-s390 lkml xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest7 patches 38 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7sections.h: add sections header to collect all section infoDocumentation/DocBook/Makefile Documentation/DocBook/sections.tmpl include/linux/sections.h+325 -14 replies
2/7tables.h: add linker table supportDocumentation/DocBook/Makefile Documentation/DocBook/linker-tables.tmpl Documentation/kbuild/makefiles.txt +8 more+929 -99 replies
3/7firmware: port built-in section to linker tablearch/x86/kernel/cpu/microcode/core.c drivers/base/firmware_class.c firmware/Makefile +1 more+9 -1813 replies
4/7asm/sections: add a generic push_section_tbl()include/asm-generic/sections.h+10 -05 replies
5/7jump_label: port __jump_table to linker tablesarch/arm/include/asm/jump_label.h arch/arm64/include/asm/jump_label.h arch/mips/include/asm/jump_label.h +8 more+33 -310 replies
6/7dynamic_debug: port to use linker tablesinclude/asm-generic/vmlinux.lds.h include/linux/dynamic_debug.h kernel/module.c +1 more+11 -150 replies
7/7kprobes: port to linker tablearch/arc/kernel/vmlinux.lds.S arch/arm/kernel/entry-armv.S arch/arm/kernel/vmlinux.lds.S +36 more+41 -725 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC v2 0/7] linux: add linker tables

This is my v2 of the original linker table work [0], now with six proof of concepts ports of existing code using custom section with custom linker script modifications:

* DEFINE_LINKTABLE_TEXT(char, kprobes);
* DEFINE_LINKTABLE_DATA(struct jump_entry, __jump_table);
* DEFINE_LINKTABLE_DATA(struct _ddebug, __verbose);
* DEFINE_LINKTABLE_RO(struct builtin_fw, builtin_fw);
* DEFINE_LINKTABLE_INIT(struct x86_init_fn, x86_init_fns);
* DEFINE_LINKTABLE_INIT_DATA(unsigned long, _kprobe_blacklist);

I've tested all except jump tables, I'd appreaciate some help with that.

As requested by hpa I've used standard sections and by doing so it gives us the ability to simply categorize any custom table by actual section used.

To help avoid further unnecessary linker script modifications, and to help bring some clarify to how all these works I went to some lengths to give documentating standard kernel sections a shot.

The implementation deviates now from iPXE's linker table solution more in favor for what we're used to and expect on Linux. This series leaves out the paravirt_enabled() changes, and the x86 use of linker tables. The paravirt_enabled() stuff is now being dealt with separately [1] [2], and the x86 use case for this will be sent as a separate series for review.

Although the diffstat is large, that's mostly documentation and the new code. If you skip that you get:

 54 files changed, 104 insertions(+), 136 deletions(-)

Most of the savings come from the ability to skip custom linker table entries. The users space solutoin has a new home [3].

[0] http://[email protected]
[1] http://kernelnewbies.org/KernelProjects/remove-paravirt-enabled
[2] http://lkml.kernel.org/r/[email protected]
[3] https://git.kernel.org/cgit/linux/kernel/git/mcgrof/linker-tables.git/

Luis R. Rodriguez (7):
sections.h: add sections header to collect all section info tables.h: add linker table support
firmware: port built-in section to linker table asm/sections: add a generic push_section_tbl()
jump_label: port __jump_table to linker tables
dynamic_debug: port to use linker tables
kprobes: port to linker table

 Documentation/DocBook/Makefile           |   3 +-
 Documentation/DocBook/linker-tables.tmpl | 169 ++++++++
 Documentation/DocBook/sections.tmpl      |  99 +++++
 Documentation/kbuild/makefiles.txt       |  19 +
 arch/arc/kernel/vmlinux.lds.S            |   1 -
 arch/arm/include/asm/jump_label.h        |   4 +-
 arch/arm/kernel/entry-armv.S             |   2 +-
 arch/arm/kernel/vmlinux.lds.S            |   1 -
 arch/arm64/include/asm/jump_label.h      |   4 +-
 arch/avr32/kernel/entry-avr32b.S         |   4 +-
 arch/avr32/kernel/vmlinux.lds.S          |   1 -
 arch/blackfin/kernel/vmlinux.lds.S       |   1 -
 arch/c6x/kernel/vmlinux.lds.S            |   1 -
 arch/hexagon/kernel/vmlinux.lds.S        |   1 -
 arch/ia64/kernel/jprobes.S               |   2 +-
 arch/ia64/kernel/vmlinux.lds.S           |   1 -
 arch/ia64/lib/flush.S                    |   4 +-
 arch/metag/kernel/vmlinux.lds.S          |   1 -
 arch/microblaze/kernel/vmlinux.lds.S     |   1 -
 arch/mips/include/asm/jump_label.h       |   4 +-
 arch/mips/kernel/vmlinux.lds.S           |   1 -
 arch/mn10300/kernel/vmlinux.lds.S        |   1 -
 arch/nios2/kernel/vmlinux.lds.S          |   1 -
 arch/openrisc/kernel/vmlinux.lds.S       |   1 -
 arch/parisc/kernel/vmlinux.lds.S         |   1 -
 arch/powerpc/include/asm/jump_label.h    |   6 +-
 arch/powerpc/include/asm/ppc_asm.h       |   6 +-
 arch/powerpc/kernel/vmlinux.lds.S        |   1 -
 arch/s390/include/asm/jump_label.h       |   4 +-
 arch/s390/kernel/entry.S                 |   4 +-
 arch/s390/kernel/kprobes.c               |   2 +-
 arch/s390/kernel/mcount.S                |   2 +-
 arch/s390/kernel/vmlinux.lds.S           |   1 -
 arch/score/kernel/vmlinux.lds.S          |   1 -
 arch/sh/kernel/vmlinux.lds.S             |   1 -
 arch/sparc/include/asm/jump_label.h      |   4 +-
 arch/sparc/kernel/vmlinux.lds.S          |   1 -
 arch/sparc/mm/ultra.S                    |   2 +-
 arch/tile/kernel/vmlinux.lds.S           |   1 -
 arch/x86/include/asm/jump_label.h        |   9 +-
 arch/x86/kernel/cpu/microcode/core.c     |   7 +-
 arch/x86/kernel/kprobes/core.c           |  10 +-
 arch/x86/kernel/vmlinux.lds.S            |   1 -
 arch/x86/tools/relocs.c                  |   3 +
 drivers/base/firmware_class.c            |  11 +-
 firmware/Makefile                        |   2 +-
 include/asm-generic/sections.h           |  14 +-
 include/asm-generic/vmlinux.lds.h        |  47 +--
 include/linux/compiler.h                 |   3 +-
 include/linux/dynamic_debug.h            |   6 +-
 include/linux/jump_label.h               |   5 +-
 include/linux/kprobes.h                  |   7 +-
 include/linux/sections.h                 | 224 ++++++++++
 include/linux/tables.h                   | 696 +++++++++++++++++++++++++++++++
 kernel/jump_label.c                      |  16 +-
 kernel/kprobes.c                         |  16 +-
 kernel/module.c                          |   6 +-
 lib/dynamic_debug.c                      |  13 +-
 scripts/Makefile.build                   |   4 +-
 scripts/Makefile.clean                   |   1 +
 scripts/Makefile.lib                     |  12 +
 scripts/mod/modpost.c                    |   3 +-
 scripts/recordmcount.c                   |   3 +-
 scripts/recordmcount.pl                  |   2 +-
 tools/include/linux/sections.h           |  13 +
 65 files changed, 1355 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/DocBook/linker-tables.tmpl
 create mode 100644 Documentation/DocBook/sections.tmpl
 create mode 100644 include/linux/sections.h
 create mode 100644 include/linux/tables.h
 create mode 100644 tools/include/linux/sections.h
Signature · 1 line
2.7.0