ld-gold.patch 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. diff --git a/configure b/configure
  2. index fc023d0..b71c1f9 100755
  3. --- a/configure
  4. +++ b/configure
  5. @@ -630,7 +630,8 @@ SED
  6. MAKEINFO
  7. MSGFMT
  8. MAKE
  9. -LD
  10. +LD_GOLD
  11. +LD_BFD
  12. AS
  13. OBJCOPY
  14. OBJDUMP
  15. @@ -4593,17 +4594,22 @@ if test $ac_verc_fail = yes; then
  16. AS=: critic_missing="$critic_missing as"
  17. fi
  18. -for ac_prog in $LD
  19. +LD_BFD=
  20. +LD_GOLD=
  21. +ld_is_gold="`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"
  22. +if test -z "$ld_is_gold"; then
  23. + LD_BFD=$LD
  24. + for ac_prog in $LD_BFD
  25. do
  26. # Extract the first word of "$ac_prog", so it can be a program name with args.
  27. set dummy $ac_prog; ac_word=$2
  28. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  29. $as_echo_n "checking for $ac_word... " >&6; }
  30. -if ${ac_cv_prog_LD+:} false; then :
  31. +if ${ac_cv_prog_LD_BFD+:} false; then :
  32. $as_echo_n "(cached) " >&6
  33. else
  34. - if test -n "$LD"; then
  35. - ac_cv_prog_LD="$LD" # Let the user override the test.
  36. + if test -n "$LD_BFD"; then
  37. + ac_cv_prog_LD_BFD="$LD_BFD" # Let the user override the test.
  38. else
  39. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  40. for as_dir in $PATH
  41. @@ -4612,7 +4618,7 @@ do
  42. test -z "$as_dir" && as_dir=.
  43. for ac_exec_ext in '' $ac_executable_extensions; do
  44. if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
  45. - ac_cv_prog_LD="$ac_prog"
  46. + ac_cv_prog_LD_BFD="$ac_prog"
  47. $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  48. break 2
  49. fi
  50. @@ -4622,26 +4628,26 @@ IFS=$as_save_IFS
  51. fi
  52. fi
  53. -LD=$ac_cv_prog_LD
  54. -if test -n "$LD"; then
  55. - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
  56. -$as_echo "$LD" >&6; }
  57. +LD_BFD=$ac_cv_prog_LD_BFD
  58. +if test -n "$LD_BFD"; then
  59. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD_BFD" >&5
  60. +$as_echo "$LD_BFD" >&6; }
  61. else
  62. { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  63. $as_echo "no" >&6; }
  64. fi
  65. - test -n "$LD" && break
  66. + test -n "$LD_BFD" && break
  67. done
  68. -if test -z "$LD"; then
  69. +if test -z "$LD_BFD"; then
  70. ac_verc_fail=yes
  71. else
  72. # Found it, now check the version.
  73. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
  74. -$as_echo_n "checking version of $LD... " >&6; }
  75. - ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
  76. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD_BFD" >&5
  77. +$as_echo_n "checking version of $LD_BFD... " >&6; }
  78. + ac_prog_version=`$LD_BFD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
  79. case $ac_prog_version in
  80. '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  81. 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
  82. @@ -4653,9 +4659,80 @@ $as_echo_n "checking version of $LD... " >&6; }
  83. $as_echo "$ac_prog_version" >&6; }
  84. fi
  85. if test $ac_verc_fail = yes; then
  86. - LD=: critic_missing="$critic_missing ld"
  87. + LD_BFD=:
  88. fi
  89. +else
  90. +# Accept gold 1.11 or higher.
  91. + LD_GOLD=$LD
  92. + for ac_prog in $LD_GOLD
  93. +do
  94. + # Extract the first word of "$ac_prog", so it can be a program name with args.
  95. +set dummy $ac_prog; ac_word=$2
  96. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  97. +$as_echo_n "checking for $ac_word... " >&6; }
  98. +if ${ac_cv_prog_LD_GOLD+:} false; then :
  99. + $as_echo_n "(cached) " >&6
  100. +else
  101. + if test -n "$LD_GOLD"; then
  102. + ac_cv_prog_LD_GOLD="$LD_GOLD" # Let the user override the test.
  103. +else
  104. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  105. +for as_dir in $PATH
  106. +do
  107. + IFS=$as_save_IFS
  108. + test -z "$as_dir" && as_dir=.
  109. + for ac_exec_ext in '' $ac_executable_extensions; do
  110. + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
  111. + ac_cv_prog_LD_GOLD="$ac_prog"
  112. + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  113. + break 2
  114. + fi
  115. +done
  116. + done
  117. +IFS=$as_save_IFS
  118. +
  119. +fi
  120. +fi
  121. +LD_GOLD=$ac_cv_prog_LD_GOLD
  122. +if test -n "$LD_GOLD"; then
  123. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD_GOLD" >&5
  124. +$as_echo "$LD_GOLD" >&6; }
  125. +else
  126. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  127. +$as_echo "no" >&6; }
  128. +fi
  129. +
  130. +
  131. + test -n "$LD_GOLD" && break
  132. +done
  133. +
  134. +if test -z "$LD_GOLD"; then
  135. + ac_verc_fail=yes
  136. +else
  137. + # Found it, now check the version.
  138. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD_GOLD" >&5
  139. +$as_echo_n "checking version of $LD_GOLD... " >&6; }
  140. + ac_prog_version=`$LD_GOLD --version 2>&1 | sed -n 's/^.*GNU gold.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
  141. + case $ac_prog_version in
  142. + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  143. + 1.1[1-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*)
  144. + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  145. + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  146. +
  147. + esac
  148. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5
  149. +$as_echo "$ac_prog_version" >&6; }
  150. +fi
  151. +if test $ac_verc_fail = yes; then
  152. + LD_GOLD=:
  153. +fi
  154. +
  155. +fi
  156. +# Neither ld nor gold are new enough.
  157. +if test -z "$LD_BFD" && test -z "$LD_GOLD"; then
  158. + critic_missing="$critic_missing ld"
  159. +fi
  160. # These programs are version sensitive.
  161. @@ -6391,6 +6468,16 @@ $as_echo "$libc_cv_use_default_link" >&6; }
  162. use_default_link=$libc_cv_use_default_link
  163. fi
  164. +# The gold linker has no builtin default linker script,
  165. +# and the fallback of editing the builtin linker
  166. +# script is not available. Therefore if use_default_link
  167. +# is `no' then we can't use gold. This check is independent
  168. +# of gold's version and is used to sanity check that the
  169. +# linker continues to produce a useful shared link.
  170. +if test "$ld_is_gold" && test "$use_default_link" = "no"; then
  171. + as_fn_error $? "$LD did not generate a useful shared link. Try using GNU ld.bfd?" "$LINENO" 5
  172. +fi
  173. +
  174. { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
  175. $as_echo_n "checking linker output format... " >&6; }
  176. if ${libc_cv_output_format+:} false; then :
  177. @@ -6409,6 +6496,17 @@ fi
  178. $as_echo "$libc_cv_output_format" >&6; }
  179. +# The gold linker has no builtin default linker script,
  180. +# and the fallback of parsing the builtin linker
  181. +# script to determine the target is not available.
  182. +# Therefore if libc_cv_output_format is `unknown' then
  183. +# we can't use gold. This check is independent of gold's
  184. +# version and is used to sanity check that the linker
  185. +# continues to support --print-output-format.
  186. +if test "$ld_is_gold" && test "$libc_cv_output_format" = "unknown"; then
  187. + as_fn_error $? "$LD did not support --print-output-format. Try using GNU ld.bfd?" "$LINENO" 5
  188. +fi
  189. +
  190. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-toplevel-reorder -fno-section-anchors" >&5
  191. $as_echo_n "checking for -fno-toplevel-reorder -fno-section-anchors... " >&6; }
  192. if ${libc_cv_fno_toplevel_reorder+:} false; then :