app_smem_pinned.ld 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2021 Intel Corporation.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /*
  7. * This hackish way of including files is due to CMake issues:
  8. * https://gitlab.kitware.com/cmake/cmake/issues/11985
  9. * https://gitlab.kitware.com/cmake/cmake/issues/13718
  10. *
  11. * When using the "Unix Makefiles" generator, CMake simply
  12. * greps for "#include" to generate dependency list.
  13. * So if doing it normally, both files are being included
  14. * in the dependency list. This creates weird dependency
  15. * issue:
  16. *
  17. * 1. Using A.ld to create a linker script A.cmd.
  18. * 2. Using A.cmd to generate A_prebuilt.elf.
  19. * 3. Using A_prebuilt.elf to create B.ld.
  20. * 4. Creating B.cmd with B.ld.
  21. * 5. Creating B_prebuilt.elf using B.cmd.
  22. *
  23. * Since the dependency list of A.cmd contains both
  24. * A.ld and B.ld, when make is invoked again, B.ld
  25. * is newer than A.cmd so everything from this point on
  26. * gets rebuilt. In order to break this cycle, this
  27. * hackish needs to be used since CMake does not parse
  28. * macros, and thus these will not appear in
  29. * the dependency list. The dependencies should then be
  30. * put in CMakeLists.txt instead.
  31. *
  32. * Note: Ninja generator does not suffer from this issue.
  33. */
  34. #ifdef LINKER_APP_SMEM_UNALIGNED
  35. #define APP_SMEM_LD <app_smem_pinned_unaligned.ld>
  36. #else
  37. #define APP_SMEM_LD <app_smem_pinned_aligned.ld>
  38. #endif
  39. #include APP_SMEM_LD
  40. #undef APP_SMEM_LD