* Restructured (and partly rewritten) by:
* Björn Ekwall <bj0rn@blox.se> February 1999
*
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "modutils.h"
-#include <libgen.h>
#include <sys/utsname.h>
#if ENABLE_FEATURE_INSMOD_LOADINKMEM
#define USE_SINGLE
#endif
+/* NDS32 support */
+#if defined(__nds32__) || defined(__NDS32__)
+#define CONFIG_USE_GOT_ENTRIES
+#define CONFIG_GOT_ENTRY_SIZE 4
+#define CONFIG_USE_SINGLE
+
+#if defined(__NDS32_EB__)
+#define MATCH_MACHINE(x) (x == EM_NDS32)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
+#endif
+
+#if defined(__NDS32_EL__)
+#define MATCH_MACHINE(x) (x == EM_NDS32)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
+#endif
+#endif
+
/* blackfin */
#if defined(BFIN)
#define MATCH_MACHINE(x) (x == EM_BLACKFIN)
bb_error_msg_and_die("symbol for parameter %s not found", param);
/* Number of parameters */
+ min = max = 1;
if (isdigit(*pinfo)) {
- min = strtoul(pinfo, &pinfo, 10);
+ min = max = strtoul(pinfo, &pinfo, 10);
if (*pinfo == '-')
max = strtoul(pinfo + 1, &pinfo, 10);
- else
- max = min;
- } else
- min = max = 1;
+ }
contents = f->sections[sym->secidx]->contents;
loc = contents + sym->value;
/* Parse parameter values */
n = 0;
p = val;
- while (*p != 0) {
+ while (*p) {
+ char sv_ch;
char *endp;
if (++n > max)
switch (*pinfo) {
case 's':
len = strcspn(p, ",");
- p[len] = 0;
+ sv_ch = p[len];
+ p[len] = '\0';
obj_string_patch(f, sym->secidx,
loc - contents, p);
loc += tgt_sizeof_char_p;
p += len;
+ *p = sv_ch;
break;
case 'c':
len = strcspn(p, ",");
- p[len] = 0;
+ sv_ch = p[len];
+ p[len] = '\0';
if (len >= charssize)
bb_error_msg_and_die("string too long for %s (max %ld)", param,
charssize - 1);
strcpy((char *) loc, p);
loc += charssize;
p += len;
+ *p = sv_ch;
break;
case 'b':
*loc++ = strtoul(p, &endp, 0);
else if (errno == EACCES)
kernel_has_tainted = 1;
else {
- perror(TAINT_FILENAME);
+ bb_simple_perror_msg(TAINT_FILENAME);
kernel_has_tainted = 0;
}
}