summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-04-17 11:24:56 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-04-17 11:24:56 +0100
commit34ec5204dc2f2e6130f611b0710d475f7dd9d609 (patch)
tree26413040541380af66826b17635779071d55d110 /com32
parent42c79110981c7117d6f337305c90dfdc6fb8d645 (diff)
parent88cebcdc03a4aefa978b20b5f60e7ea10f07b797 (diff)
downloadsyslinux-34ec5204dc2f2e6130f611b0710d475f7dd9d609.tar.gz
Merge branches 'auto-extension' and 'fix-build-warnings' into elflink
Conflicts: com32/elflink/ldlinux/ldlinux.c
Diffstat (limited to 'com32')
-rw-r--r--com32/elflink/ldlinux/adv.c2
-rw-r--r--com32/elflink/ldlinux/cli.c4
-rw-r--r--com32/elflink/ldlinux/config.h4
-rw-r--r--com32/elflink/ldlinux/eprintf.c1
-rw-r--r--com32/elflink/ldlinux/execute.c11
-rw-r--r--com32/elflink/ldlinux/get_key.c6
-rw-r--r--com32/elflink/ldlinux/kernel.c3
-rw-r--r--com32/elflink/ldlinux/ldlinux.c18
-rw-r--r--com32/elflink/ldlinux/readconfig.c16
-rw-r--r--com32/hdt/hdt-common.h3
-rw-r--r--com32/include/com32.h2
-rw-r--r--com32/include/klibc/compiler.h7
-rw-r--r--com32/include/sys/module.h32
-rw-r--r--com32/lib/getcwd.c1
-rw-r--r--com32/lib/lmalloc.c9
-rw-r--r--com32/lib/lstrdup.c2
-rw-r--r--com32/lib/sys/fileclose.c1
-rw-r--r--com32/lib/sys/fileread.c1
-rw-r--r--com32/lib/sys/module/common.c9
-rw-r--r--com32/lib/sys/module/common.h8
-rw-r--r--com32/lib/sys/module/elf_module.c20
-rw-r--r--com32/lib/sys/module/elfutils.c4
-rw-r--r--com32/lib/sys/module/elfutils.h2
-rw-r--r--com32/lib/sys/module/shallow_module.c8
-rw-r--r--com32/lib/sys/open.c1
-rw-r--r--com32/lib/syslinux/idle.c1
-rw-r--r--com32/modules/hello.c2
-rw-r--r--com32/modules/meminfo.c10
-rw-r--r--com32/modules/vesainfo.c4
29 files changed, 98 insertions, 94 deletions
diff --git a/com32/elflink/ldlinux/adv.c b/com32/elflink/ldlinux/adv.c
index 78695471..b81361f2 100644
--- a/com32/elflink/ldlinux/adv.c
+++ b/com32/elflink/ldlinux/adv.c
@@ -40,7 +40,7 @@ void *__syslinux_adv_ptr;
size_t __syslinux_adv_size;
extern void adv_init(void);
-void __syslinux_init(void)
+void __constructor __syslinux_init(void)
{
static com32sys_t reg;
diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c
index fb041aeb..498644e2 100644
--- a/com32/elflink/ldlinux/cli.c
+++ b/com32/elflink/ldlinux/cli.c
@@ -99,7 +99,7 @@ static const char * cmd_reverse_search(int *cursor)
break;
}
- while (last_found != &cli_history_head) {
+ while (!list_is_last(&last_found->list, &cli_history_head)) {
p = strstr(last_found->command, buf);
if (p)
break;
@@ -139,7 +139,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ ,
bool done = false;
const char *ret;
int width = 0;
- struct cli_command *comm_counter;
+ struct cli_command *comm_counter = NULL;
if (!width) {
int height;
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index c34b2cc6..cab4c70b 100644
--- a/com32/elflink/ldlinux/config.h
+++ b/com32/elflink/ldlinux/config.h
@@ -37,7 +37,11 @@ extern const char *default_cmd; //"default" command line
extern const char *onerror; //"onerror" command line
extern void cat_help_file(int key);
+extern struct menu_entry *find_label(const char *str);
+extern void print_labels(const char *prefix, size_t len);
extern void eprintf(const char *filename, ...);
+extern int new_linux_kernel(char *okernel, char *ocmdline);
+
#endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/eprintf.c b/com32/elflink/ldlinux/eprintf.c
index d8858ff9..f15edc6e 100644
--- a/com32/elflink/ldlinux/eprintf.c
+++ b/com32/elflink/ldlinux/eprintf.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
+#include <core.h>
#define BUFFER_SIZE 4096
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index 269b74d8..afe999e2 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -20,6 +20,7 @@
#include "core.h"
#include "menu.h"
#include "fs.h"
+#include "config.h"
/* Must match enum kernel_type */
const char *const kernel_types[] = {
@@ -84,8 +85,8 @@ void execute(const char *cmdline, enum kernel_type type)
if (type == KT_COM32) {
/* new entry for elf format c32 */
- lfree(kernel);
- create_args_and_load(cmdline);
+ lfree((void *)kernel);
+ create_args_and_load((char *)cmdline);
} else if (type == KT_CONFIG) {
char *argv[] = { "ldlinux.c32", NULL };
@@ -96,7 +97,7 @@ void execute(const char *cmdline, enum kernel_type type)
if (*args)
mangle_name(config_cwd, args);
- start_ldlinux("ldlinux.c32", 1, argv);
+ start_ldlinux(argv);
} else if (type == KT_LOCALBOOT) {
/* process the image need int 22 support */
ireg.eax.w[0] = 0x0014; /* Local boot */
@@ -105,10 +106,10 @@ void execute(const char *cmdline, enum kernel_type type)
} else {
/* Need add one item for kernel load, as we don't use
* the assembly runkernel.inc any more */
- new_linux_kernel(kernel, cmdline);
+ new_linux_kernel((char *)kernel, (char *)cmdline);
}
- lfree(kernel);
+ lfree((void *)kernel);
/* If this returns, something went bad; return to menu */
}
diff --git a/com32/elflink/ldlinux/get_key.c b/com32/elflink/ldlinux/get_key.c
index 42ff5c12..5841d022 100644
--- a/com32/elflink/ldlinux/get_key.c
+++ b/com32/elflink/ldlinux/get_key.c
@@ -148,10 +148,10 @@ int get_key_decode(char *buffer, int nc, int *code)
int get_key(FILE * f, clock_t timeout)
{
- unsigned char buffer[KEY_MAXLEN];
- int nc, i, rv;
+ char buffer[KEY_MAXLEN];
+ int nc, rv;
int another;
- unsigned char ch;
+ char ch;
clock_t start;
int code;
diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c
index 375dab04..62eec75e 100644
--- a/com32/elflink/ldlinux/kernel.c
+++ b/com32/elflink/ldlinux/kernel.c
@@ -15,7 +15,7 @@ const char *append = NULL;
/* Will be called from readconfig.c */
int new_linux_kernel(char *okernel, char *ocmdline)
{
- const char *kernel_name;
+ const char *kernel_name = NULL;
struct initramfs *initramfs = NULL;
char *temp;
void *kernel_data;
@@ -23,7 +23,6 @@ int new_linux_kernel(char *okernel, char *ocmdline)
bool opt_quiet = false;
char initrd_name[256];
char cmdline_buf[256], *cmdline;
- int i;
dprintf("okernel = %s, ocmdline = %s", okernel, ocmdline);
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index fcb30701..da93c544 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -2,6 +2,7 @@
#include <sys/times.h>
#include <fcntl.h>
#include <stdbool.h>
+#include <string.h>
#include <core.h>
#include <fs.h>
#include "cli.h"
@@ -44,7 +45,7 @@ static inline const char *find_command(const char *str)
return p;
}
-static enum kernel_type parse_kernel_type(char *kernel)
+static enum kernel_type parse_kernel_type(const char *kernel)
{
const struct file_ext *ext;
const char *p;
@@ -222,11 +223,10 @@ static void enter_cmdline(void)
}
}
-int main(int argc, char **argv)
+int main(int argc __unused, char **argv __unused)
{
- com32sys_t ireg, oreg;
- uint8_t *adv;
- int count = 0;
+ const void *adv;
+ size_t count = 0;
char *config_argv[2] = { NULL, NULL };
openconsole(&dev_rawcon_r, &dev_ansiserial_w);
@@ -236,17 +236,17 @@ int main(int argc, char **argv)
parse_configs(config_argv);
- __syslinux_init();
adv = syslinux_getadv(ADV_BOOTONCE, &count);
if (adv && count) {
/*
* We apparently have a boot-once set; clear it and
* then execute the boot-once.
*/
- uint8_t *src, *dst, *cmdline;
- int i;
+ const char *cmdline;
+ char *src, *dst;
+ size_t i;
- src = adv;
+ src = (char *)adv;
cmdline = dst = malloc(count + 1);
if (!dst) {
printf("Failed to allocate memory for ADV\n");
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 4f7a4d22..70fe3461 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -1121,7 +1121,8 @@ do_include:
* display/font/kbdmap are rather similar, open a file then do sth
*/
else if (looking_at(p, "display")) {
- char *filename, *dst = KernelName;
+ const char *filename;
+ char *dst = KernelName;
size_t len = FILENAME_MAX - 1;
filename = refstrdup(skipspace(p + 7));
@@ -1133,7 +1134,8 @@ do_include:
get_msg_file(KernelName);
refstr_put(filename);
} else if (looking_at(p, "font")) {
- char *filename, *dst = KernelName;
+ const char *filename;
+ char *dst = KernelName;
size_t len = FILENAME_MAX - 1;
filename = refstrdup(skipspace(p + 4));
@@ -1145,8 +1147,8 @@ do_include:
loadfont(KernelName);
refstr_put(filename);
} else if (looking_at(p, "kbdmap")) {
- com32sys_t reg;
- char *filename, *dst = KernelName;
+ const char *filename;
+ char *dst = KernelName;
size_t len = FILENAME_MAX - 1;
filename = refstrdup(skipspace(p + 4));
@@ -1189,7 +1191,6 @@ do_include:
/* serial setting, bps, flow control */
else if (looking_at(p, "serial")) {
- com32sys_t ireg;
uint16_t port, flow;
uint32_t baud;
@@ -1309,7 +1310,8 @@ do_include:
eprintf("%s\n", p+4);
} else if (looking_at(p, "path")) {
/* PATH-based lookup */
- char *new_path, *_p;
+ const char *new_path;
+ char *_p;
size_t len, new_len;
new_path = refstrdup(skipspace(p + 4));
@@ -1348,7 +1350,7 @@ static int parse_one_config(const char *filename)
if (config_cwd[0]) {
chdir(config_cwd);
- config_cwd[0] = NULL;
+ config_cwd[0] = '\0';
}
return 0;
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index d37fcc8a..fec213d9 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -54,9 +54,6 @@
#include <acpi/acpi.h>
#include <libupload/upload_backend.h>
-/* Declare a variable or data structure as unused. */
-#define __unused __attribute__ (( unused ))
-
/* This two values are used for switching for the menu to the CLI mode */
#define HDT_SWITCH_TO_CLI "hdt_switch_to_cli"
#define HDT_DUMP "hdt_dump"
diff --git a/com32/include/com32.h b/com32/include/com32.h
index f49f9eab..6b142082 100644
--- a/com32/include/com32.h
+++ b/com32/include/com32.h
@@ -120,7 +120,7 @@ extern const com32sys_t __com32_zero_regs;
/*
* Lowmem allocation functions
*/
-void *clmalloc(size_t);
+void *lmalloc(size_t);
void *lzalloc(size_t);
void lfree(void *);
char *lstrdup(const char *);
diff --git a/com32/include/klibc/compiler.h b/com32/include/klibc/compiler.h
index b5919d67..210971f1 100644
--- a/com32/include/klibc/compiler.h
+++ b/com32/include/klibc/compiler.h
@@ -108,6 +108,13 @@
# define __unusedfunc
#endif
+/* Declare a variable or data structure as unused. */
+#ifdef __GNUC__
+# define __unused __attribute__((unused))
+#else
+# define __unused
+#endif
+
/* Used symbol */
#define __used __attribute__((used))
diff --git a/com32/include/sys/module.h b/com32/include/sys/module.h
index a9ddb60d..fb6a1eb3 100644
--- a/com32/include/sys/module.h
+++ b/com32/include/sys/module.h
@@ -120,23 +120,6 @@ struct elf_module {
};
-static inline void dump_elf_module(struct elf_module *module)
-{
- /*
- dprintf("module name = %s", module->name);
- printf("base_addr = 0x%p, module_size = %d\n", module->base_addr, module->module_size);
- printf("hash tlb = 0x%p, ghash tbl = 0x%p\n", module->hash_table, module->ghash_table);
- printf("str tbl = 0x%p, size = %d\n", module->str_table, module->strtable_size);
- printf("sym tbl = 0x%p, entry = %d, size = %d\n", module->sym_table, module->syment_size, module->symtable_size);
- printf("init: %p", module->init_func);
- printf("main: %p", module->main_func);
- printf("exit: %p", module->exit_func);
- printf("", module->base_addr);
- printf("", module->base_addr);
- printf("", module->base_addr);
- */
-}
-
/**
* struct module_dep - structure encapsulating a module dependency need
*
@@ -263,9 +246,10 @@ extern int module_load_shallow(struct elf_module *module, Elf32_Addr base_addr);
* module_unload - unloads the module from the system.
* @module: the module descriptor structure.
*
- * The function checks to see whether the module can be safely removed, then
- * it releases all the associated memory. This function can be applied both
- * for standard modules and for shallow modules.
+ * The function checks to see whether the module can be safely
+ * removed, then it executes any destructors and releases all the
+ * associated memory. This function can be applied both for standard
+ * modules and for shallow modules.
*
* A module can be safely removed from the system when no other modules reference
* symbols from it.
@@ -273,6 +257,14 @@ extern int module_load_shallow(struct elf_module *module, Elf32_Addr base_addr);
extern int module_unload(struct elf_module *module);
/**
+ * _module_unload - unloads the module without running destructors
+ *
+ * This function is the same as module_unload(), except that the
+ * module's destructors are not executed.
+ */
+extern int _module_unload(struct elf_module *module);
+
+/**
* module_unload - unloads the module from the system.
* @module: the module descriptor structure.
*
diff --git a/com32/lib/getcwd.c b/com32/lib/getcwd.c
index 2939c07c..d5fa9d7d 100644
--- a/com32/lib/getcwd.c
+++ b/com32/lib/getcwd.c
@@ -4,6 +4,7 @@
#include <com32.h>
#include <syslinux/pmapi.h>
+#include <fs.h>
char *getcwd(char *buf, size_t size)
{
diff --git a/com32/lib/lmalloc.c b/com32/lib/lmalloc.c
index 9d532c80..3e69ac1d 100644
--- a/com32/lib/lmalloc.c
+++ b/com32/lib/lmalloc.c
@@ -31,15 +31,6 @@
#include <string.h>
#include <syslinux/pmapi.h>
-void *clmalloc(size_t size)
-{
- void *p;
- p = lmalloc(size);
- if (!p)
- errno = ENOMEM;
- return p;
-}
-
void *lzalloc(size_t size)
{
void *p;
diff --git a/com32/lib/lstrdup.c b/com32/lib/lstrdup.c
index 6747ef3a..d11efe7e 100644
--- a/com32/lib/lstrdup.c
+++ b/com32/lib/lstrdup.c
@@ -9,7 +9,7 @@
char *lstrdup(const char *s)
{
int l = strlen(s) + 1;
- char *d = clmalloc(l);
+ char *d = lmalloc(l);
if (d)
memcpy(d, s, l);
diff --git a/com32/lib/sys/fileclose.c b/com32/lib/sys/fileclose.c
index 26e15082..699dbe32 100644
--- a/com32/lib/sys/fileclose.c
+++ b/com32/lib/sys/fileclose.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <com32.h>
#include <string.h>
+#include <fs.h>
#include "file.h"
int __file_close(struct file_info *fp)
diff --git a/com32/lib/sys/fileread.c b/com32/lib/sys/fileread.c
index 7d9e1b91..26b0ceb6 100644
--- a/com32/lib/sys/fileread.c
+++ b/com32/lib/sys/fileread.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <string.h>
#include <com32.h>
+#include <pmapi.h>
#include <syslinux/pmapi.h>
#include <minmax.h>
#include "file.h"
diff --git a/com32/lib/sys/module/common.c b/com32/lib/sys/module/common.c
index e26163f1..eeb26075 100644
--- a/com32/lib/sys/module/common.c
+++ b/com32/lib/sys/module/common.c
@@ -322,7 +322,7 @@ int check_symbols(struct elf_module *module)
for(i = 1; i < module->symtable_size; i++)
{
- crt_sym = (Elf32_Sym*)(module->sym_table + i * module->syment_size);
+ crt_sym = symbol_get_entry(module, i);
crt_name = module->str_table + crt_sym->st_name;
strong_count = 0;
@@ -434,7 +434,7 @@ static Elf32_Sym *module_find_symbol_sysv(const char *name, struct elf_module *m
while (crt_index != STN_UNDEF) {
- crt_sym = (Elf32_Sym*)(module->sym_table + crt_index*module->syment_size);
+ crt_sym = symbol_get_entry(module, crt_index);
if (strcmp(name, module->str_table + crt_sym->st_name) == 0)
return crt_sym;
@@ -489,8 +489,7 @@ static Elf32_Sym *module_find_symbol_gnu(const char *name, struct elf_module *mo
do {
if (((*hasharr ^ h ) >> 1) == 0) {
- Elf32_Sym *crt_sym = (Elf32_Sym*)(module->sym_table +
- (hasharr - gnu_chain_zero) * module->syment_size);
+ Elf32_Sym *crt_sym = symbol_get_entry(module, (hasharr - gnu_chain_zero));
if (strcmp(name, module->str_table + crt_sym->st_name) == 0) {
return crt_sym;
@@ -511,7 +510,7 @@ static Elf32_Sym *module_find_symbol_iterate(const char *name,struct elf_module
for (i=1; i < module->symtable_size; i++)
{
- crt_sym = (Elf32_Sym*)(module->sym_table + i*module->syment_size);
+ crt_sym = symbol_get_entry(module, i);
if (strcmp(name, module->str_table + crt_sym->st_name) == 0)
{
return crt_sym;
diff --git a/com32/lib/sys/module/common.h b/com32/lib/sys/module/common.h
index 6259df51..54f0ec4b 100644
--- a/com32/lib/sys/module/common.h
+++ b/com32/lib/sys/module/common.h
@@ -27,6 +27,14 @@
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
+static inline Elf32_Sym *symbol_get_entry(struct elf_module *module, int entry)
+{
+ char *sym_table = (char *)module->sym_table;
+ int index = entry * module->syment_size;
+
+ return (Elf32_Sym *)(sym_table + index);
+}
+
//#define ELF_DEBUG
#ifdef ELF_DEBUG
diff --git a/com32/lib/sys/module/elf_module.c b/com32/lib/sys/module/elf_module.c
index 6b4d548d..cc913048 100644
--- a/com32/lib/sys/module/elf_module.c
+++ b/com32/lib/sys/module/elf_module.c
@@ -14,6 +14,7 @@
#include <linux/list.h>
#include <sys/module.h>
+#include <sys/exec.h>
#include "elfutils.h"
#include "common.h"
@@ -50,7 +51,7 @@ static int check_header(Elf32_Ehdr *elf_hdr) {
static int load_segments(struct elf_module *module, Elf32_Ehdr *elf_hdr) {
int i;
int res = 0;
- void *pht = NULL;
+ char *pht = NULL;
Elf32_Phdr *cr_pht;
Elf32_Addr min_addr = 0x00000000; // Min. ELF vaddr
@@ -136,8 +137,8 @@ static int load_segments(struct elf_module *module, Elf32_Ehdr *elf_hdr) {
// headers
Elf32_Off aux_off = module->u.l._cr_offset - cr_pht->p_offset;
- if (image_read(module_get_absolute(cr_pht->p_vaddr, module) + aux_off,
- cr_pht->p_filesz - aux_off, module) < 0) {
+ if (image_read((char *)module_get_absolute(cr_pht->p_vaddr, module) + aux_off,
+ cr_pht->p_filesz - aux_off, module) < 0) {
res = -1;
goto out;
}
@@ -259,8 +260,7 @@ static int perform_relocation(struct elf_module *module, Elf32_Rel *rel) {
// Find out details about the symbol
// The symbol reference
- Elf32_Sym *sym_ref =
- (Elf32_Sym*)(module->sym_table + sym * module->syment_size);
+ Elf32_Sym *sym_ref = symbol_get_entry(module, sym);
// The symbol definition
sym_def =
@@ -321,9 +321,9 @@ static int resolve_symbols(struct elf_module *module) {
int res;
Elf32_Word plt_rel_size = 0;
- void *plt_rel = NULL;
+ char *plt_rel = NULL;
- void *rel = NULL;
+ char *rel = NULL;
Elf32_Word rel_size = 0;
Elf32_Word rel_entry = 0;
@@ -467,7 +467,7 @@ static int extract_operations(struct elf_module *module) {
// Loads the module into the system
int module_load(struct elf_module *module) {
- int res, i;
+ int res;
Elf32_Sym *main_sym;
Elf32_Ehdr elf_hdr;
module_ctor_t *ctor;
@@ -504,8 +504,6 @@ int module_load(struct elf_module *module) {
nr_needed = 0;
CHECKED(res, prepare_dynlinking(module), error);
//printf("check... 4\n");
- //
- //dump_elf_module(module);
/* Find modules we need to load as dependencies */
if (module->str_table) {
@@ -534,7 +532,7 @@ int module_load(struct elf_module *module) {
}
if (*p++ == '/') {
- char argv[2] = { p, NULL };
+ char *argv[2] = { p, NULL };
spawn_load(p, 1, argv);
}
}
diff --git a/com32/lib/sys/module/elfutils.c b/com32/lib/sys/module/elfutils.c
index 64be0770..b7d760b4 100644
--- a/com32/lib/sys/module/elfutils.c
+++ b/com32/lib/sys/module/elfutils.c
@@ -37,7 +37,7 @@ struct memalign_info {
};
int elf_malloc(void **memptr, size_t alignment, size_t size) {
- void *start_addr = NULL;
+ char *start_addr = NULL;
struct memalign_info *info;
if ((alignment & (alignment - 1)) != 0)
@@ -63,7 +63,7 @@ int elf_malloc(void **memptr, size_t alignment, size_t size) {
return 0;
}
-void elf_free(void *memptr) {
+void elf_free(char *memptr) {
struct memalign_info *info = (struct memalign_info*)(memptr -
sizeof(struct memalign_info));
diff --git a/com32/lib/sys/module/elfutils.h b/com32/lib/sys/module/elfutils.h
index b18968f3..a901ff48 100644
--- a/com32/lib/sys/module/elfutils.h
+++ b/com32/lib/sys/module/elfutils.h
@@ -59,6 +59,6 @@ extern int elf_malloc(void **memptr, size_t alignment, size_t size);
* elf_free - Releases memory previously allocated by elf_malloc.
* @memptr: the address of the allocated block
*/
-extern void elf_free(void *memptr);
+extern void elf_free(char *memptr);
#endif /*ELF_UTILS_H_*/
diff --git a/com32/lib/sys/module/shallow_module.c b/com32/lib/sys/module/shallow_module.c
index fbcf781b..8a88e403 100644
--- a/com32/lib/sys/module/shallow_module.c
+++ b/com32/lib/sys/module/shallow_module.c
@@ -32,8 +32,8 @@ static int check_header_shallow(Elf32_Ehdr *elf_hdr) {
static int load_shallow_sections(struct elf_module *module, Elf32_Ehdr *elf_hdr) {
int i;
int res = 0;
- void *sht = NULL;
- void *buffer = NULL;
+ char *sht = NULL;
+ char *buffer = NULL;
Elf32_Shdr *crt_sht;
Elf32_Off buff_offset;
@@ -100,8 +100,8 @@ static int load_shallow_sections(struct elf_module *module, Elf32_Ehdr *elf_hdr)
// Setup module information
module->module_size = max_offset - min_offset;
- module->str_table = (char*)(module->module_addr + (str_offset - min_offset));
- module->sym_table = module->module_addr + (sym_offset - min_offset);
+ module->str_table = (char *)module->module_addr + (str_offset - min_offset);
+ module->sym_table = (char *)module->module_addr + (sym_offset - min_offset);
out:
// Release the SHT
diff --git a/com32/lib/sys/open.c b/com32/lib/sys/open.c
index a0ef1597..3221bb60 100644
--- a/com32/lib/sys/open.c
+++ b/com32/lib/sys/open.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <fs.h>
#include "file.h"
/*
diff --git a/com32/lib/syslinux/idle.c b/com32/lib/syslinux/idle.c
index 6413d331..33e8035c 100644
--- a/com32/lib/syslinux/idle.c
+++ b/com32/lib/syslinux/idle.c
@@ -33,6 +33,7 @@
#include <stddef.h>
#include <com32.h>
+#include <core.h>
#include <syslinux/pmapi.h>
#include <syslinux/idle.h>
diff --git a/com32/modules/hello.c b/com32/modules/hello.c
index f28d38d3..d3d4d299 100644
--- a/com32/modules/hello.c
+++ b/com32/modules/hello.c
@@ -13,7 +13,7 @@
#define NUM_COUNT 10
#define MAX_NUM 100
-int main(int argc, char **argv)
+int main(int argc __unused, char **argv __unused)
{
int *nums = NULL;
diff --git a/com32/modules/meminfo.c b/com32/modules/meminfo.c
index 00d0e14d..34b3e91d 100644
--- a/com32/modules/meminfo.c
+++ b/com32/modules/meminfo.c
@@ -44,9 +44,9 @@ static void dump_e820(void)
uint32_t type;
void *low_ed;
- low_ed = lmalloc(sizeof ed);
- if (!low_ed)
- return;
+ low_ed = lmalloc(sizeof ed);
+ if (!low_ed)
+ return;
memset(&ireg, 0, sizeof ireg);
@@ -90,7 +90,7 @@ static void dump_e820(void)
ireg.ebx.l = oreg.ebx.l;
} while (ireg.ebx.l);
- free(low_ed);
+ lfree(low_ed);
}
static void dump_legacy(void)
@@ -122,7 +122,7 @@ static void dump_legacy(void)
oreg.ecx.w[0], oreg.ecx.w[0], oreg.edx.w[0], oreg.edx.w[0] << 6);
}
-int main(int argc, char **argv)
+int main(int argc __unused, char **argv __unused)
{
dump_legacy();
dump_e820();
diff --git a/com32/modules/vesainfo.c b/com32/modules/vesainfo.c
index 86a43657..66b121d7 100644
--- a/com32/modules/vesainfo.c
+++ b/com32/modules/vesainfo.c
@@ -79,11 +79,11 @@ static void print_modes(void)
}
exit:
- free(vesa);
+ lfree(vesa);
return;
}
-int main(int argc, char **argv)
+int main(int argc __unused, char **argv __unused)
{
print_modes();
return 0;