1From: Marek Vasut <marex@denx.de>
2Subject: [PATCH 07/12] libtool: Fix support for NIOS2 processor
3
4The name of the system contains the string "nios2". This string
5is caught by the some of the greedy checks for OS/2 in libtool,
6in particular the *os2* branches of switch statements match for
7the nios2 string, which results in incorrect behavior of libtool.
8
9This patch adds an explicit check for *nios2* before the *os2*
10checks to prevent the OS/2 check incorrectly trapping the nios2
11as well.
12
13Signed-off-by: Marek Vasut <marex@denx.de>
14Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
15
16Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00021.html]
17
18diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
19index 6fb58ed2..606f17be 100644
20--- a/build-aux/ltmain.in
21+++ b/build-aux/ltmain.in
22@@ -519,6 +519,12 @@ libtool_validate_options ()
23     test : = "$debug_cmd" || func_append preserve_args " --debug"
24
25     case $host in
26+      # For NIOS2, we want to make sure that it's not caught by the
27+      # more general OS/2 check below. Otherwise, NIOS2 is the same
28+      # as the default option.
29+      *nios2*)
30+        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
31+        ;;
32       # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
33       # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
34       *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
35@@ -6246,6 +6252,15 @@ func_mode_link ()
36 	if test -n "$library_names" &&
37 	   { test no = "$use_static_libs" || test -z "$old_library"; }; then
38 	  case $host in
39+	  *nios2*)
40+	    # For NIOS2, we want to make sure that it's not caught by the
41+	    # more general OS/2 check below. Otherwise, NIOS2 is the same
42+	    # as the default option.
43+	    if test no = "$installed"; then
44+	      func_append notinst_deplibs " $lib"
45+	      need_relink=yes
46+	    fi
47+	    ;;
48 	  *cygwin* | *mingw* | *cegcc* | *os2*)
49 	      # No point in relinking DLLs because paths are not encoded
50 	      func_append notinst_deplibs " $lib"
51@@ -6316,6 +6331,11 @@ func_mode_link ()
52 	    elif test -n "$soname_spec"; then
53 	      # bleh windows
54 	      case $host in
55+	      *nios2*)
56+		# For NIOS2, we want to make sure that it's not caught by the
57+		# more general OS/2 check below. Otherwise, NIOS2 is the same
58+		# as the default option.
59+		;;
60 	      *cygwin* | mingw* | *cegcc* | *os2*)
61 	        func_arith $current - $age
62 		major=$func_arith_result
63--
642.25.1
65
66