060-v6.0-01-tools-build-Add-feature-test-for-init_disassemble_in.patch 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. From 598ada195606eb0e577db0487dd59a2536f206ce Mon Sep 17 00:00:00 2001
  2. From: Andres Freund <[email protected]>
  3. Date: Sun, 31 Jul 2022 18:38:27 -0700
  4. Subject: [PATCH 1/5] tools build: Add feature test for init_disassemble_info
  5. API changes
  6. binutils changed the signature of init_disassemble_info(), which now causes
  7. compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
  8. Relevant binutils commit:
  9. https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
  10. This commit adds a feature test to detect the new signature. Subsequent
  11. commits will use it to fix the build failures.
  12. Signed-off-by: Andres Freund <[email protected]>
  13. Acked-by: Quentin Monnet <[email protected]>
  14. Cc: Alexei Starovoitov <[email protected]>
  15. Cc: Ben Hutchings <[email protected]>
  16. Cc: Jiri Olsa <[email protected]>
  17. Cc: Quentin Monnet <[email protected]>
  18. Cc: Sedat Dilek <[email protected]>
  19. Cc: [email protected]
  20. Link: http://lore.kernel.org/lkml/[email protected]
  21. Link: https://lore.kernel.org/r/[email protected]
  22. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  23. (cherry picked from commit cfd59ca91467056bb2c36907b2fa67b8e1af9952)
  24. ---
  25. tools/build/Makefile.feature | 1 +
  26. tools/build/feature/Makefile | 4 ++++
  27. tools/build/feature/test-all.c | 4 ++++
  28. tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
  29. 4 files changed, 22 insertions(+)
  30. create mode 100644 tools/build/feature/test-disassembler-init-styled.c
  31. --- a/tools/build/Makefile.feature
  32. +++ b/tools/build/Makefile.feature
  33. @@ -69,6 +69,7 @@ FEATURE_TESTS_BASIC :=
  34. libaio \
  35. libzstd \
  36. disassembler-four-args \
  37. + disassembler-init-styled \
  38. file-handle
  39. # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
  40. --- a/tools/build/feature/Makefile
  41. +++ b/tools/build/feature/Makefile
  42. @@ -18,6 +18,7 @@ FILES=
  43. test-libbfd.bin \
  44. test-libbfd-buildid.bin \
  45. test-disassembler-four-args.bin \
  46. + test-disassembler-init-styled.bin \
  47. test-reallocarray.bin \
  48. test-libbfd-liberty.bin \
  49. test-libbfd-liberty-z.bin \
  50. @@ -239,6 +240,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
  51. $(OUTPUT)test-disassembler-four-args.bin:
  52. $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
  53. +$(OUTPUT)test-disassembler-init-styled.bin:
  54. + $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
  55. +
  56. $(OUTPUT)test-reallocarray.bin:
  57. $(BUILD)
  58. --- a/tools/build/feature/test-all.c
  59. +++ b/tools/build/feature/test-all.c
  60. @@ -166,6 +166,10 @@
  61. # include "test-disassembler-four-args.c"
  62. #undef main
  63. +#define main main_test_disassembler_init_styled
  64. +# include "test-disassembler-init-styled.c"
  65. +#undef main
  66. +
  67. #define main main_test_libzstd
  68. # include "test-libzstd.c"
  69. #undef main
  70. --- /dev/null
  71. +++ b/tools/build/feature/test-disassembler-init-styled.c
  72. @@ -0,0 +1,13 @@
  73. +// SPDX-License-Identifier: GPL-2.0
  74. +#include <stdio.h>
  75. +#include <dis-asm.h>
  76. +
  77. +int main(void)
  78. +{
  79. + struct disassemble_info info;
  80. +
  81. + init_disassemble_info(&info, stdout,
  82. + NULL, NULL);
  83. +
  84. + return 0;
  85. +}