[Courgette] Refactor: Store Label Annotation in AssemblyProgram for patch generation.

For Courgette-gen, label adjustment needs lists of abs32 & rel32 Label*
sorted by file offset. Let these lists be "Label Annotations".
Previously these were extracted during label adjustment from list of
instructions in AssemblyProgram, but now we wish to remove these stored
instructions.

This CL make AssemblyProgram store Label annotations. These are computed
only when needed (Courgette-gen / -gen1a). Details:

- Add ParseDetecteExecutableWithAnnotation() alongside
  ParseDetecteExecutable(), to avoid affecting flows that don't require
  Label Annotations.
- AssemblyProgram: Add |*_label_annotations_| as storage vectors. These
  are optionally populated in InstructionStoreReceptor when
  Disassembler::Disassemble() gets called.
  - InstructionCountReceptor now put into use.
- Simplify Label adjustment: AssemblyProgram::HandleInstructionLabels()
  is replaced with visiting AssemblyProgram's Label Annotations.
- Subtle: GraphAdjuster now includes abs64. The class doesn't get used,
  but the change is logical anyway.

BUG=660980

Review-Url: https://codereview.chromium.org/2793153003
Cr-Original-Commit-Position: refs/heads/master@{#464536}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c4155eb674ece85b214aaf4cb781510d7377d390
12 files changed
tree: 9cbf3bb4bc8c5492fd0c96078598922d92b37c8c
  1. testdata/
  2. third_party/
  3. adjustment_method.cc
  4. adjustment_method.h
  5. adjustment_method_2.cc
  6. adjustment_method_unittest.cc
  7. analyze_mem_test
  8. analyze_stress_test
  9. assembly_program.cc
  10. assembly_program.h
  11. base_test_unittest.cc
  12. base_test_unittest.h
  13. bsdiff_memory_unittest.cc
  14. BUILD.gn
  15. consecutive_range_visitor.h
  16. consecutive_range_visitor_unittest.cc
  17. courgette.h
  18. courgette_application.png
  19. courgette_generation.png
  20. courgette_minimal_tool.cc
  21. courgette_tool.cc
  22. crc.cc
  23. crc.h
  24. DEPS
  25. description.html
  26. description.md
  27. difference_estimator.cc
  28. difference_estimator.h
  29. difference_estimator_unittest.cc
  30. disassembler.cc
  31. disassembler.h
  32. disassembler_elf_32.cc
  33. disassembler_elf_32.h
  34. disassembler_elf_32_arm.cc
  35. disassembler_elf_32_arm.h
  36. disassembler_elf_32_x86.cc
  37. disassembler_elf_32_x86.h
  38. disassembler_elf_32_x86_unittest.cc
  39. disassembler_win32.cc
  40. disassembler_win32.h
  41. disassembler_win32_x64.cc
  42. disassembler_win32_x64.h
  43. disassembler_win32_x64_unittest.cc
  44. disassembler_win32_x86.cc
  45. disassembler_win32_x86.h
  46. disassembler_win32_x86_unittest.cc
  47. encode_decode_unittest.cc
  48. encoded_program.cc
  49. encoded_program.h
  50. encoded_program_fuzz_unittest.cc
  51. encoded_program_unittest.cc
  52. ensemble.cc
  53. ensemble.h
  54. ensemble_apply.cc
  55. ensemble_create.cc
  56. ensemble_unittest.cc
  57. image_utils.h
  58. image_utils_unittest.cc
  59. instruction_utils.h
  60. label_manager.cc
  61. label_manager.h
  62. label_manager_unittest.cc
  63. memory_allocator.cc
  64. memory_allocator.h
  65. memory_allocator_unittest.cc
  66. memory_monitor.cc
  67. OWNERS
  68. patch_generator_x86_32.h
  69. patcher_x86_32.h
  70. program_detector.cc
  71. program_detector.h
  72. program_detector_unittest.cc
  73. region.h
  74. rel32_finder.cc
  75. rel32_finder.h
  76. rel32_finder_unittest.cc
  77. rel32_finder_x64.cc
  78. rel32_finder_x64.h
  79. rel32_finder_x86.cc
  80. rel32_finder_x86.h
  81. run_mem_test
  82. run_stress_test
  83. simple_delta.cc
  84. simple_delta.h
  85. streams.cc
  86. streams.h
  87. streams_unittest.cc
  88. stress_test_common
  89. typedrva_unittest.cc
  90. types_elf.h
  91. types_win_pe.h
  92. versioning_unittest.cc