300-012_check_ldrunpath_length.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh -e
  2. ## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
  3. ##
  4. ## All lines beginning with `## DP:' are a description of the patch.
  5. ## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
  6. ## DP: cases where -rpath isn't specified. (#151024)
  7. if [ $# -ne 1 ]; then
  8. echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
  9. exit 1
  10. fi
  11. [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
  12. patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
  13. case "$1" in
  14. -patch) patch $patch_opts -p1 < $0;;
  15. -unpatch) patch $patch_opts -p1 -R < $0;;
  16. *)
  17. echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
  18. exit 1;;
  19. esac
  20. exit 0
  21. @DPATCH@
  22. diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
  23. --- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
  24. +++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
  25. @@ -692,6 +692,8 @@
  26. && command_line.rpath == NULL)
  27. {
  28. lib_path = (const char *) getenv ("LD_RUN_PATH");
  29. + if ((lib_path) && (strlen (lib_path) == 0))
  30. + lib_path = NULL;
  31. if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
  32. force))
  33. break;
  34. @@ -871,6 +873,8 @@
  35. rpath = command_line.rpath;
  36. if (rpath == NULL)
  37. rpath = (const char *) getenv ("LD_RUN_PATH");
  38. + if ((rpath) && (strlen (rpath) == 0))
  39. + rpath = NULL;
  40. if (! (bfd_elf_size_dynamic_sections
  41. (output_bfd, command_line.soname, rpath,
  42. command_line.filter_shlib,