logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://anongit.hacktivis.me/git/bootstrap-initrd.git/

pdpmake-2.0.2-fix_single_suffix.patch (1793B)


  1. From 89025d0698f8b5a5dbb49670729151997350498c Mon Sep 17 00:00:00 2001
  2. From: Ron Yorston <rmy@pobox.com>
  3. Date: Mon, 20 Jan 2025 21:46:44 +0000
  4. Subject: [PATCH] Fix single-suffix inference rule regression
  5. Commit a64a52f (Extend inference rule search) added code to handle
  6. inference rules with arbitrary suffixes. Unfortunately it failed
  7. to check for a single-suffix rule in the case where no known suffix
  8. was found. Add the necessary code.
  9. (GitHub issue #72)
  10. ---
  11. rules.c | 19 ++++++++++++++-----
  12. 1 file changed, 14 insertions(+), 5 deletions(-)
  13. diff --git a/rules.c b/rules.c
  14. index 4e88191..964b69a 100644
  15. --- pdpmake-2.0.2/rules.c
  16. +++ pdpmake-2.0.2/rules.c
  17. @@ -147,22 +147,34 @@ dyndep(struct name *np, struct rule *infrule, const char **ptsuff)
  18. // targets of the form lib.a(member.o).
  19. if (!posix && member == NULL) {
  20. struct name *xp = newname(".SUFFIXES");
  21. + int found_suffix = FALSE;
  22. +
  23. for (struct rule *rp = xp->n_rule; rp; rp = rp->r_next) {
  24. for (struct depend *dp = rp->r_dep; dp; dp = dp->d_next) {
  25. tsuff = dp->d_name->n_name;
  26. base = has_suffix(name, tsuff);
  27. if (base) {
  28. + found_suffix = TRUE;
  29. pp = dyndep0(base, tsuff, infrule);
  30. free(base);
  31. if (pp) {
  32. - if (ptsuff)
  33. - *ptsuff = tsuff;
  34. goto done;
  35. }
  36. }
  37. }
  38. }
  39. + if (!found_suffix) {
  40. + // The name didn't have a known suffix. Try single-suffix rule.
  41. + tsuff = "";
  42. + pp = dyndep0(name, tsuff, infrule);
  43. + if (pp) {
  44. + done:
  45. + if (ptsuff) {
  46. + *ptsuff = tsuff;
  47. + }
  48. + }
  49. + }
  50. } else
  51. #endif
  52. {
  53. @@ -173,9 +185,6 @@ dyndep(struct name *np, struct rule *infrule, const char **ptsuff)
  54. pp = dyndep0(base, tsuff, infrule);
  55. free((void *)tsuff);
  56. }
  57. -#if ENABLE_FEATURE_MAKE_EXTENSIONS
  58. - done:
  59. -#endif
  60. free(name);
  61. return pp;