aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libtool/files/libtool-v1.5.patch
blob: 485dfc7eb488ac9d99a041d3e45918242a73b8b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -35,7 +35,7 @@ progpath="$0"
 
 # The name of this program:
 progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
+modename="OpenWrt-$progname-patched-1.5"
 
 # Global variables:
 EXIT_SUCCESS=0
@@ -297,8 +297,8 @@ func_infer_tag ()
 	# line option must be used.
 	if test -z "$tagname"; then
 	  $echo "$modename: unable to infer tagged configuration"
-	  $echo "$modename: specify a tag with \`--tag'" 1>&2
-	  exit $EXIT_FAILURE
+	  $echo "$modename: defaulting to \`CC'"
+	  $echo "$modename: if this is not correct, specify a tag with \`--tag'"
 #        else
 #          $echo "$modename: using $tagname tagged configuration"
 	fi
@@ -2462,8 +2462,14 @@ EOF
 	    absdir="$abs_ladir"
 	    libdir="$abs_ladir"
 	  else
-	    dir="$libdir"
-	    absdir="$libdir"
+	    # Adding 'libdir' from the .la file to our library search paths
+	    # breaks crosscompilation horribly.  We cheat here and don't add
+	    # it, instead adding the path where we found the .la.  -CL
+	    dir="$lt_sysroot$abs_ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	    #dir="$libdir"
+	    #absdir="$libdir"
 	  fi
 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 	else
@@ -2602,7 +2608,7 @@ EOF
 	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
 	  if test "$installed" = no; then
 	    notinst_deplibs="$notinst_deplibs $lib"
-	    need_relink=yes
+	    need_relink=no
 	  fi
 	  # This is a shared library
 
@@ -2804,7 +2810,6 @@ EOF
 	    if test "$hardcode_direct" = yes; then
 	      add="$libdir/$linklib"
 	    elif test "$hardcode_minus_L" = yes; then
-	      add_dir="-L$libdir"
 	      add="-l$name"
 	    elif test "$hardcode_shlibpath_var" = yes; then
 	      case :$finalize_shlibpath: in
@@ -2820,8 +2825,6 @@ EOF
 	        add="$libdir/$linklib"
 	      fi
 	    else
-	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
 	      # Try looking first in the location we're being installed to.
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
@@ -5687,6 +5690,10 @@ fi\
 	    # Replace all uninstalled libtool libraries with the installed ones
 	    newdependency_libs=
 	    for deplib in $dependency_libs; do
+	      # Replacing uninstalled with installed can easily break crosscompilation,
+	      # since the installed path is generally the wrong architecture.  -CL
+	      newdependency_libs="$newdependency_libs $deplib"
+	      continue
 	      case $deplib in
 	      *.la)
 		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
@@ -5999,8 +6006,12 @@ relink_command=\"$relink_command\""
 	dir="$dir$objdir"
 
 	if test -n "$relink_command"; then
+	  # Strip any trailing slash from the destination.
+	  s_libdir=`$echo "X$libdir" | $Xsed -e 's%/$%%'`
+	  s_destdir=`$echo "X$destdir" | $Xsed -e 's%/$%%'`
+
 	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+	  inst_prefix_dir=`$echo "$s_destdir" | $SED "s%$s_libdir\$%%"`
 
 	  # Don't allow the user to place us outside of our expected
 	  # location b/c this prevents finding dependent libraries that
@@ -6008,10 +6019,13 @@ relink_command=\"$relink_command\""
 	  # At present, this check doesn't affect windows .dll's that
 	  # are installed into $libdir/../bin (currently, that works fine)
 	  # but it's something to keep an eye on.
-	  if test "$inst_prefix_dir" = "$destdir"; then
-	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
+	  #
+	  # This breaks install into our staging area.  -PB
+	  #
+	  # if test "$inst_prefix_dir" = "$destdir"; then
+	  #   $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+	  #   exit $EXIT_FAILURE
+	  # fi
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
@@ -6020,6 +6034,9 @@ relink_command=\"$relink_command\""
 	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
 	  fi
 
+	  relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/lib[^[:space:]]*%%"`
+	  relink_command=`$ECHO "$relink_command" | $SED "s%-L[[:space:]]*/usr/lib[^[:space:]]*%%"`
+
 	  $echo "$modename: warning: relinking \`$file'" 1>&2
 	  $show "$relink_command"
 	  if $run eval "$relink_command"; then :
ck(&mtd_partitions_mutex); - list_for_each_entry(p, &mtd_partitions, list) - if (p->master == master) { - if ((start >= p->offset) && - (start < (p->offset + p->mtd.size))) - goto err_inv; - - if ((end >= p->offset) && - (end < (p->offset + p->mtd.size))) - goto err_inv; - } + if (dup_check) { + list_for_each_entry(p, &mtd_partitions, list) + if (p->master == master) { + if ((start >= p->offset) && + (start < (p->offset + p->mtd.size))) + goto err_inv; + + if ((end >= p->offset) && + (end < (p->offset + p->mtd.size))) + goto err_inv; + } + } list_add(&new->list, &mtd_partitions); mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); + mtd_partition_split(master, new); return ret; err_inv: @@ -604,6 +612,12 @@ err_inv: } EXPORT_SYMBOL_GPL(mtd_add_partition); +int mtd_add_partition(struct mtd_info *master, const char *name, + long long offset, long long length) +{ + return __mtd_add_partition(master, name, offset, length, true); +} + int mtd_del_partition(struct mtd_info *master, int partno) { struct mtd_part *slave, *next; @@ -627,6 +641,74 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); +static inline unsigned long +mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) +{ + unsigned long mask = mtd->erasesize - 1; + + len += offset & mask; + len = (len + mask) & ~mask; + len -= offset & mask; + return len; +} + +#define UBOOT_MAGIC 0x27051956 + +static void split_uimage(struct mtd_info *master, struct mtd_part *part) +{ + struct { + __be32 magic; + __be32 pad[2]; + __be32 size; + } hdr; + size_t len; + + if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr)) + return; + + if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC)) + return; + + len = be32_to_cpu(hdr.size) + 0x40; + len = mtd_pad_erasesize(master, part->offset, len); + if (len + master->erasesize > part->mtd.size) + return; + + __mtd_add_partition(master, "rootfs", part->offset + len, + part->mtd.size - len, false); +} + +#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME +#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME +#else +#define SPLIT_FIRMWARE_NAME "unused" +#endif + +static void split_firmware(struct mtd_info *master, struct mtd_part *part) +{ + if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT)) + split_uimage(master, part); +} + +void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, + int offset, int size) +{ +} + +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) +{ + static int rootfs_found = 0; + + if (rootfs_found) + return; + + if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && + config_enabled(CONFIG_MTD_SPLIT_FIRMWARE)) + split_firmware(master, part); + + arch_split_mtd_part(master, part->mtd.name, part->offset, + part->mtd.size); +} /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to @@ -656,6 +738,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); + mtd_partition_split(master, slave); cur_offset = slave->offset + slave->mtd.size; } --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -84,5 +84,7 @@ int mtd_add_partition(struct mtd_info *m long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); uint64_t mtd_get_device_size(const struct mtd_info *mtd); +extern void __weak arch_split_mtd_part(struct mtd_info *master, + const char *name, int offset, int size); #endif