[tip: objtool/core] objtool: Rework header include paths

2021-01-18 Thread tip-bot2 for Vasily Gorbik
The following commit has been merged into the objtool/core branch of tip:

Commit-ID: 7786032e52cb02982a7154993b5d88c9c7a31ba5
Gitweb:
https://git.kernel.org/tip/7786032e52cb02982a7154993b5d88c9c7a31ba5
Author:Vasily Gorbik 
AuthorDate:Fri, 13 Nov 2020 00:03:32 +01:00
Committer: Josh Poimboeuf 
CommitterDate: Wed, 13 Jan 2021 18:13:14 -06:00

objtool: Rework header include paths

Currently objtool headers are being included either by their base name
or included via ../ from a parent directory. In case of a base name usage:

 #include "warn.h"
 #include "arch_elf.h"

it does not make it apparent from which directory the file comes from.
To make it slightly better, and actually to avoid name clashes some arch
specific files have "arch_" suffix. And files from an arch folder have
to revert to including via ../ e.g:
 #include "../../elf.h"

With additional architectures support and the code base growth there is
a need for clearer headers naming scheme for multiple reasons:
1. to make it instantly obvious where these files come from (objtool
   itself / objtool arch|generic folders / some other external files),
2. to avoid name clashes of objtool arch specific headers, potential
   obtool arch generic headers and the system header files (there is
   /usr/include/elf.h already),
3. to avoid ../ includes and improve code readability.
4. to give a warm fuzzy feeling to developers who are mostly kernel
   developers and are accustomed to linux kernel headers arranging
   scheme.

Doesn't this make it instantly obvious where are these files come from?

 #include 
 #include 

And doesn't it look nicer to avoid ugly ../ includes? Which also
guarantees this is elf.h from the objtool and not /usr/include/elf.h.

 #include 

This patch defines and implements new objtool headers arranging
scheme. Which is:
- all generic headers go to include/objtool (similar to include/linux)
- all arch headers go to arch/$(SRCARCH)/include/arch (to get arch
  prefix). This is similar to linux arch specific "asm/*" headers but we
  are not abusing "asm" name and calling it what it is. This also helps
  to prevent name clashes (arch is not used in system headers or kernel
  exports).

To bring objtool to this state the following things are done:
1. current top level tools/objtool/ headers are moved into
   include/objtool/ subdirectory,
2. arch specific headers, currently only arch/x86/include/ are moved into
   arch/x86/include/arch/ and were stripped of "arch_" suffix,
3. new -I$(srctree)/tools/objtool/include include path to make
   includes like  possible,
4. rewriting file includes,
5. make git not to ignore include/objtool/ subdirectory.

Signed-off-by: Vasily Gorbik 
Acked-by: Peter Zijlstra (Intel) 
Acked-by: Masami Hiramatsu 
Signed-off-by: Josh Poimboeuf 
---
 tools/objtool/.gitignore |   2 +-
 tools/objtool/Makefile   |   1 +-
 tools/objtool/arch.h |  93 +-
 tools/objtool/arch/x86/decode.c  |   8 +-
 tools/objtool/arch/x86/include/arch/cfi_regs.h   |  25 ++-
 tools/objtool/arch/x86/include/arch/elf.h|   6 +-
 tools/objtool/arch/x86/include/arch/endianness.h |   9 +-
 tools/objtool/arch/x86/include/arch/special.h|  20 ++-
 tools/objtool/arch/x86/include/arch_elf.h|   6 +-
 tools/objtool/arch/x86/include/arch_endianness.h |   9 +-
 tools/objtool/arch/x86/include/arch_special.h|  20 +--
 tools/objtool/arch/x86/include/cfi_regs.h|  25 +--
 tools/objtool/arch/x86/special.c |   4 +-
 tools/objtool/builtin-check.c|   4 +-
 tools/objtool/builtin-orc.c  |   4 +-
 tools/objtool/builtin.h  |  16 +-
 tools/objtool/cfi.h  |  38 +
 tools/objtool/check.c|  16 +-
 tools/objtool/check.h|  69 +--
 tools/objtool/elf.c  |   6 +-
 tools/objtool/elf.h  | 150 +--
 tools/objtool/endianness.h   |  38 +
 tools/objtool/include/objtool/arch.h |  93 +-
 tools/objtool/include/objtool/builtin.h  |  16 +-
 tools/objtool/include/objtool/cfi.h  |  38 -
 tools/objtool/include/objtool/check.h|  69 ++-
 tools/objtool/include/objtool/elf.h  | 150 ++-
 tools/objtool/include/objtool/endianness.h   |  38 -
 tools/objtool/include/objtool/objtool.h  |  32 +++-
 tools/objtool/include/objtool/special.h  |  41 -
 tools/objtool/include/objtool/warn.h |  66 ++-
 tools/objtool/objtool.c  |   6 +-
 tools/objtool/objtool.h  |  32 +---
 tools/objtool/orc_dump.c |   6 +-
 tools/objtool/orc_gen.c  |   6 +-
 tools/objtool/special.c

[tip: objtool/core] objtool: Rework header include paths

2020-10-07 Thread tip-bot2 for Vasily Gorbik
The following commit has been merged into the objtool/core branch of tip:

Commit-ID: a23b701ae9b334f86aabdcba5dd57fc0e81b51b6
Gitweb:
https://git.kernel.org/tip/a23b701ae9b334f86aabdcba5dd57fc0e81b51b6
Author:Vasily Gorbik 
AuthorDate:Mon, 05 Oct 2020 17:50:41 +02:00
Committer: Josh Poimboeuf 
CommitterDate: Tue, 06 Oct 2020 09:37:57 -05:00

objtool: Rework header include paths

Currently objtool headers are being included either by their base name
or included via ../ from a parent directory. In case of a base name usage:

 #include "warn.h"
 #include "arch_elf.h"

it does not make it apparent from which directory the file comes from.
To make it slightly better, and actually to avoid name clashes some arch
specific files have "arch_" suffix. And files from an arch folder have
to revert to including via ../ e.g:
 #include "../../elf.h"

With additional architectures support and the code base growth there is
a need for clearer headers naming scheme for multiple reasons:
1. to make it instantly obvious where these files come from (objtool
   itself / objtool arch|generic folders / some other external files),
2. to avoid name clashes of objtool arch specific headers, potential
   obtool arch generic headers and the system header files (there is
   /usr/include/elf.h already),
3. to avoid ../ includes and improve code readability.
4. to give a warm fuzzy feeling to developers who are mostly kernel
   developers and are accustomed to linux kernel headers arranging
   scheme.

Doesn't this make it instantly obvious where are these files come from?

 #include 
 #include 

And doesn't it look nicer to avoid ugly ../ includes? Which also
guarantees this is elf.h from the objtool and not /usr/include/elf.h.

 #include 

This patch defines and implements new objtool headers arranging
scheme. Which is:
- all generic headers go to include/objtool (similar to include/linux)
- all arch headers go to arch/$(SRCARCH)/include/arch (to get arch
  prefix). This is similar to linux arch specific "asm/*" headers but we
  are not abusing "asm" name and calling it what it is. This also helps
  to prevent name clashes (arch is not used in system headers or kernel
  exports).

To bring objtool to this state the following things are done:
1. current top level tools/objtool/ headers are moved into
   include/objtool/ subdirectory,
2. arch specific headers, currently only arch/x86/include/ are moved into
   arch/x86/include/arch/ and were stripped of "arch_" suffix,
3. new -I$(srctree)/tools/objtool/include include path to make
   includes like  possible,
4. rewriting file includes,
5. make git not to ignore include/objtool/ subdirectory.

Signed-off-by: Vasily Gorbik 
Signed-off-by: Josh Poimboeuf 
---
 tools/objtool/.gitignore |   2 +-
 tools/objtool/Makefile   |   1 +-
 tools/objtool/arch.h |  93 +-
 tools/objtool/arch/x86/decode.c  |   8 +-
 tools/objtool/arch/x86/include/arch/cfi_regs.h   |  25 ++-
 tools/objtool/arch/x86/include/arch/elf.h|   6 +-
 tools/objtool/arch/x86/include/arch/endianness.h |   9 +-
 tools/objtool/arch/x86/include/arch/special.h|  20 ++-
 tools/objtool/arch/x86/include/arch_elf.h|   6 +-
 tools/objtool/arch/x86/include/arch_endianness.h |   9 +-
 tools/objtool/arch/x86/include/arch_special.h|  20 +--
 tools/objtool/arch/x86/include/cfi_regs.h|  25 +--
 tools/objtool/arch/x86/special.c |   4 +-
 tools/objtool/builtin-check.c|   4 +-
 tools/objtool/builtin-orc.c  |   4 +-
 tools/objtool/builtin.h  |  16 +--
 tools/objtool/cfi.h  |  38 +
 tools/objtool/check.c|  16 +-
 tools/objtool/check.h|  69 +---
 tools/objtool/elf.c  |   6 +-
 tools/objtool/elf.h  | 148 +--
 tools/objtool/endianness.h   |  38 +
 tools/objtool/include/objtool/arch.h |  93 +-
 tools/objtool/include/objtool/builtin.h  |  16 ++-
 tools/objtool/include/objtool/cfi.h  |  38 -
 tools/objtool/include/objtool/check.h|  69 +++-
 tools/objtool/include/objtool/elf.h  | 148 ++-
 tools/objtool/include/objtool/endianness.h   |  38 -
 tools/objtool/include/objtool/objtool.h  |  32 +++-
 tools/objtool/include/objtool/special.h  |  41 -
 tools/objtool/include/objtool/warn.h |  66 ++-
 tools/objtool/objtool.c  |   6 +-
 tools/objtool/objtool.h  |  32 +---
 tools/objtool/orc_dump.c |   6 +-
 tools/objtool/orc_gen.c  |   6 +-
 tools/objtool/special.c  |  10 +-
 tools/objtool/special.h