Revision 8fcd3692 dyngen.c
b/dyngen.c | ||
---|---|---|
272 | 272 |
return data; |
273 | 273 |
} |
274 | 274 |
|
275 |
int strstart(const char *str, const char *val, const char **ptr) |
|
275 |
static int strstart(const char *str, const char *val, const char **ptr)
|
|
276 | 276 |
{ |
277 | 277 |
const char *p, *q; |
278 | 278 |
p = str; |
... | ... | |
288 | 288 |
return 1; |
289 | 289 |
} |
290 | 290 |
|
291 |
void pstrcpy(char *buf, int buf_size, const char *str) |
|
291 |
static void pstrcpy(char *buf, int buf_size, const char *str)
|
|
292 | 292 |
{ |
293 | 293 |
int c; |
294 | 294 |
char *q = buf; |
... | ... | |
305 | 305 |
*q = '\0'; |
306 | 306 |
} |
307 | 307 |
|
308 |
void swab16s(uint16_t *p) |
|
308 |
static void swab16s(uint16_t *p)
|
|
309 | 309 |
{ |
310 | 310 |
*p = bswap16(*p); |
311 | 311 |
} |
312 | 312 |
|
313 |
void swab32s(uint32_t *p) |
|
313 |
static void swab32s(uint32_t *p)
|
|
314 | 314 |
{ |
315 | 315 |
*p = bswap32(*p); |
316 | 316 |
} |
317 | 317 |
|
318 |
void swab32ss(int32_t *p) |
|
318 |
static void swab32ss(int32_t *p)
|
|
319 | 319 |
{ |
320 | 320 |
*p = bswap32(*p); |
321 | 321 |
} |
322 | 322 |
|
323 |
void swab64s(uint64_t *p) |
|
323 |
static void swab64s(uint64_t *p)
|
|
324 | 324 |
{ |
325 | 325 |
*p = bswap64(*p); |
326 | 326 |
} |
327 | 327 |
|
328 |
void swab64ss(int64_t *p) |
|
328 |
static void swab64ss(int64_t *p)
|
|
329 | 329 |
{ |
330 | 330 |
*p = bswap64(*p); |
331 | 331 |
} |
332 | 332 |
|
333 |
uint16_t get16(uint16_t *p) |
|
333 |
static uint16_t get16(uint16_t *p)
|
|
334 | 334 |
{ |
335 | 335 |
uint16_t val; |
336 | 336 |
val = *p; |
... | ... | |
339 | 339 |
return val; |
340 | 340 |
} |
341 | 341 |
|
342 |
uint32_t get32(uint32_t *p) |
|
342 |
static uint32_t get32(uint32_t *p)
|
|
343 | 343 |
{ |
344 | 344 |
uint32_t val; |
345 | 345 |
val = *p; |
... | ... | |
348 | 348 |
return val; |
349 | 349 |
} |
350 | 350 |
|
351 |
void put16(uint16_t *p, uint16_t val) |
|
351 |
static void put16(uint16_t *p, uint16_t val)
|
|
352 | 352 |
{ |
353 | 353 |
if (do_swap) |
354 | 354 |
val = bswap16(val); |
355 | 355 |
*p = val; |
356 | 356 |
} |
357 | 357 |
|
358 |
void put32(uint32_t *p, uint32_t val) |
|
358 |
static void put32(uint32_t *p, uint32_t val)
|
|
359 | 359 |
{ |
360 | 360 |
if (do_swap) |
361 | 361 |
val = bswap32(val); |
... | ... | |
378 | 378 |
struct elfhdr ehdr; |
379 | 379 |
char *strtab; |
380 | 380 |
|
381 |
int elf_must_swap(struct elfhdr *h) |
|
381 |
static int elf_must_swap(struct elfhdr *h)
|
|
382 | 382 |
{ |
383 | 383 |
union { |
384 | 384 |
uint32_t i; |
... | ... | |
390 | 390 |
(swaptest.b[0] == 0); |
391 | 391 |
} |
392 | 392 |
|
393 |
void elf_swap_ehdr(struct elfhdr *h) |
|
393 |
static void elf_swap_ehdr(struct elfhdr *h)
|
|
394 | 394 |
{ |
395 | 395 |
swab16s(&h->e_type); /* Object file type */ |
396 | 396 |
swab16s(&h-> e_machine); /* Architecture */ |
... | ... | |
407 | 407 |
swab16s(&h-> e_shstrndx); /* Section header string table index */ |
408 | 408 |
} |
409 | 409 |
|
410 |
void elf_swap_shdr(struct elf_shdr *h) |
|
410 |
static void elf_swap_shdr(struct elf_shdr *h)
|
|
411 | 411 |
{ |
412 | 412 |
swab32s(&h-> sh_name); /* Section name (string tbl index) */ |
413 | 413 |
swab32s(&h-> sh_type); /* Section type */ |
... | ... | |
421 | 421 |
swabls(&h-> sh_entsize); /* Entry size if section holds table */ |
422 | 422 |
} |
423 | 423 |
|
424 |
void elf_swap_phdr(struct elf_phdr *h) |
|
424 |
static void elf_swap_phdr(struct elf_phdr *h)
|
|
425 | 425 |
{ |
426 | 426 |
swab32s(&h->p_type); /* Segment type */ |
427 | 427 |
swabls(&h->p_offset); /* Segment file offset */ |
... | ... | |
433 | 433 |
swabls(&h->p_align); /* Segment alignment */ |
434 | 434 |
} |
435 | 435 |
|
436 |
void elf_swap_rel(ELF_RELOC *rel) |
|
436 |
static void elf_swap_rel(ELF_RELOC *rel)
|
|
437 | 437 |
{ |
438 | 438 |
swabls(&rel->r_offset); |
439 | 439 |
swabls(&rel->r_info); |
... | ... | |
442 | 442 |
#endif |
443 | 443 |
} |
444 | 444 |
|
445 |
struct elf_shdr *find_elf_section(struct elf_shdr *shdr, int shnum, const char *shstr,
|
|
446 |
const char *name) |
|
445 |
static struct elf_shdr *find_elf_section(struct elf_shdr *shdr, int shnum,
|
|
446 |
const char *shstr, const char *name)
|
|
447 | 447 |
{ |
448 | 448 |
int i; |
449 | 449 |
const char *shname; |
... | ... | |
460 | 460 |
return NULL; |
461 | 461 |
} |
462 | 462 |
|
463 |
int find_reloc(int sh_index) |
|
463 |
static int find_reloc(int sh_index)
|
|
464 | 464 |
{ |
465 | 465 |
struct elf_shdr *sec; |
466 | 466 |
int i; |
... | ... | |
489 | 489 |
} |
490 | 490 |
|
491 | 491 |
/* load an elf object file */ |
492 |
int load_object(const char *filename) |
|
492 |
static int load_object(const char *filename)
|
|
493 | 493 |
{ |
494 | 494 |
int fd; |
495 | 495 |
struct elf_shdr *sec, *symtab_sec, *strtab_sec, *text_sec; |
... | ... | |
1227 | 1227 |
#endif /* CONFIG_FORMAT_MACH */ |
1228 | 1228 |
|
1229 | 1229 |
/* return true if the expression is a label reference */ |
1230 |
int get_reloc_expr(char *name, int name_size, const char *sym_name) |
|
1230 |
static int get_reloc_expr(char *name, int name_size, const char *sym_name)
|
|
1231 | 1231 |
{ |
1232 | 1232 |
const char *p; |
1233 | 1233 |
|
... | ... | |
1294 | 1294 |
#define MAX_ARGS 3 |
1295 | 1295 |
|
1296 | 1296 |
/* generate op code */ |
1297 |
void gen_code(const char *name, host_ulong offset, host_ulong size, |
|
1298 |
FILE *outfile, int gen_switch) |
|
1297 |
static void gen_code(const char *name, host_ulong offset, host_ulong size,
|
|
1298 |
FILE *outfile, int gen_switch)
|
|
1299 | 1299 |
{ |
1300 | 1300 |
int copy_size = 0; |
1301 | 1301 |
uint8_t *p_start, *p_end; |
... | ... | |
2630 | 2630 |
} |
2631 | 2631 |
} |
2632 | 2632 |
|
2633 |
int gen_file(FILE *outfile, int out_type) |
|
2633 |
static int gen_file(FILE *outfile, int out_type)
|
|
2634 | 2634 |
{ |
2635 | 2635 |
int i; |
2636 | 2636 |
EXE_SYM *sym; |
... | ... | |
2742 | 2742 |
return 0; |
2743 | 2743 |
} |
2744 | 2744 |
|
2745 |
void usage(void) |
|
2745 |
static void usage(void)
|
|
2746 | 2746 |
{ |
2747 | 2747 |
printf("dyngen (c) 2003 Fabrice Bellard\n" |
2748 | 2748 |
"usage: dyngen [-o outfile] [-c] objfile\n" |
Also available in: Unified diff