Skip to content

Commit

Permalink
src/ssDDM.c: disambiguate addLM with 2 and 5 parameters
Browse files Browse the repository at this point in the history
Detected prototype mismatch when built -flto -Werror=lto-type-mismatch as:

    load.c:101:13: error: type of 'addLM' does not match original declaration [-Werror=lto-type-mismatch]
      101 | extern void addLM (const char*, Elf64_Phdr*, int, ADDR, int);
          |             ^
    ssDDM.c:999:6: note: type mismatch in parameter 1
      999 | void addLM(ADDR adr, size_t len)
          |      ^
  • Loading branch information
trofi committed Aug 20, 2022
1 parent f19bba3 commit c4de04f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/exec.c
Expand Up @@ -277,7 +277,7 @@ Status breakEx(INSTINFO *info)
switch ((int)ARG0) {
case BREAK_DE_SVC_LOADED:
case BREAK_DE_LIB_LOADED:
addLM(ARG1, ARG2);
addLM2(ARG1, ARG2);
break;
case BREAK_DE_LIB_UNLOADED:
break;
Expand Down
2 changes: 1 addition & 1 deletion src/exec_hd.c
Expand Up @@ -477,7 +477,7 @@ void switchBanks(void);
void arithFlagsFromEflags(void);
void setIAmode(void);
void clearPdecode(ADDR adr, unsigned size);
void addLM(ADDR adr, size_t len);
void addLM2(ADDR adr, size_t len);
int isbpt(ADDR adr);

/* consider #include'ing trace.h instead of declaring the following var/fns */
Expand Down
10 changes: 5 additions & 5 deletions src/load.c
Expand Up @@ -98,7 +98,7 @@ static REG psrval = 0;
# define DEBUG(...) do { } while (0)
#endif

extern void addLM (const char*, Elf64_Phdr*, int, ADDR, int);
extern void addLM5 (const char*, Elf64_Phdr*, int, ADDR, int);

char *sim_root = NULL;
size_t sim_root_len = 0;
Expand Down Expand Up @@ -542,7 +542,7 @@ void mmapSyms(int fd, ADDR start, ADDR len, ADDR offset)

for (i = 0; i < ehdr->e_phnum; i++) {
if (phdr[i].p_type == PT_IA_64_UNWIND) {
addLM("shlib", phdr, ehdr->e_phnum, start, 0);
addLM5("shlib", phdr, ehdr->e_phnum, start, 0);
break;
}
}
Expand Down Expand Up @@ -795,7 +795,7 @@ static BOOL interp(int fd, off_t offset, unsigned sz)

for (i = 0; i < ehdr->e_phnum; i++) {
if (phdr[i].p_type == PT_IA_64_UNWIND) {
addLM("ld.so", phdr, ehdr->e_phnum, bias, 1);
addLM5("ld.so", phdr, ehdr->e_phnum, bias, 1);
unwind_base = bias + phdr[i].p_vaddr;
DEBUG("interp: PT_IA_64_UNWIND: %#llx\n", unwind_base);
}
Expand Down Expand Up @@ -934,7 +934,7 @@ BOOL elfSymLoad(const char *file_name)
text_end = text_base + phdr[i].p_memsz - 1;
}

addLM(file_name, phdr, ehdr->e_phnum, 0, 1);
addLM5(file_name, phdr, ehdr->e_phnum, 0, 1);
elf64_slurp_all_symbols(elfptr, ehdr, phdr, 0);
} else { /* ELFCLASS32 */
Elf32_Ehdr *ehdr;
Expand Down Expand Up @@ -1095,7 +1095,7 @@ BOOL elfLoad(const char *file_name, int s_argc, char *s_argv[])
#endif
case PT_IA_64_UNWIND:
/* TODO: account for ELF bias? */
addLM(file_name, phdr, ehdr->e_phnum, bias, 1);
addLM5(file_name, phdr, ehdr->e_phnum, bias, 1);
unwind_base = bias + phdr[i].p_vaddr;
/*unwind_end = bias + phdr[i].p_vaddr + phdr[i].p_filesz;*/
DEBUG("PT_IA_64_UNWIND: %#llx\n", unwind_base);
Expand Down
7 changes: 4 additions & 3 deletions src/ssDDM.c
Expand Up @@ -516,7 +516,6 @@ BOOL pagGProt(unsigned argc, char *argv[])

#endif

#ifdef HAVE_LIBUNWIND_IA64

struct load_module {
struct load_module *next;
Expand All @@ -528,7 +527,7 @@ struct load_module {
} *load_module_list;

void
addLM (const char *name, Elf64_Phdr *phdr, int phnum, ADDR load_base,
addLM5 (const char *name, Elf64_Phdr *phdr, int phnum, ADDR load_base,
int discontiguous)
{
struct load_module *lm;
Expand All @@ -547,6 +546,8 @@ addLM (const char *name, Elf64_Phdr *phdr, int phnum, ADDR load_base,
load_module_list = lm;
}

#ifdef HAVE_LIBUNWIND_IA64

static int
get_unwind_table (unw_dyn_info_t *di, unw_addr_space_t as,
struct load_module *lm)
Expand Down Expand Up @@ -996,7 +997,7 @@ fprintf(stderr, "read_tgt_mem called: %llx %x\n", src, (unsigned)nbytes);

#define ADDPTR(addr) (addr = (BitfX(addr,32,32) | BitfX(addr,32,2) << 61))

void addLM(ADDR adr, size_t len)
void addLM2(ADDR adr, size_t len)
{
#ifdef HAVE_UNWIND_SUPPORT
struct load_module_desc lmd;
Expand Down

0 comments on commit c4de04f

Please sign in to comment.