summaryrefslogtreecommitdiffstats
path: root/usr.bin/ldd
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2004-02-15 22:01:23 +0000
committerdwmalone <dwmalone@FreeBSD.org>2004-02-15 22:01:23 +0000
commit0bde518078a4f8e75cc5a1aefef23fae5993de52 (patch)
treed41a6f045aa396c7a94017e31f4c4cbea516f50f /usr.bin/ldd
parente6420ce89a50adc6c0752b88bcae7b6bf4a14d04 (diff)
downloadFreeBSD-src-0bde518078a4f8e75cc5a1aefef23fae5993de52.zip
FreeBSD-src-0bde518078a4f8e75cc5a1aefef23fae5993de52.tar.gz
Fix a few WARNS:
1) Include string.h for strcpy. 2) Don't make duplicate declaration of dump_file, we now include extern.h. 3) Help out with some constness. 4) Cast to slightly better types in some comparisons.
Diffstat (limited to 'usr.bin/ldd')
-rw-r--r--usr.bin/ldd/sods.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ldd/sods.c b/usr.bin/ldd/sods.c
index 195651e..cdc5e78 100644
--- a/usr.bin/ldd/sods.c
+++ b/usr.bin/ldd/sods.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <stab.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include "extern.h"
@@ -72,7 +73,6 @@ __FBSDID("$FreeBSD$");
#ifdef STANDALONE
static
#endif
-void dump_file(const char *);
static void dump_rels(const char *, const struct relocation_info *,
unsigned long, const char *(*)(unsigned long), unsigned char *);
@@ -182,7 +182,7 @@ dump_file(const char *fname)
file_base = (const char *) objbase; /* Makes address arithmetic easier */
- if (IS_ELF(*(Elf32_Ehdr*) file_base)) {
+ if (IS_ELF(*(const Elf32_Ehdr*) file_base)) {
warnx("%s: this is an ELF program; use objdump to examine", fname);
++error_count;
munmap(objbase, sb.st_size);
@@ -286,13 +286,13 @@ dump_file(const char *fname)
(const struct relocation_info *) (text_addr + sdt->sdt_rel);
rtrel_count = (sdt->sdt_hash - sdt->sdt_rel) / sizeof rtrel_base[0];
assert(rtrel_count * sizeof rtrel_base[0] ==
- sdt->sdt_hash - sdt->sdt_rel);
+ (size_t)(sdt->sdt_hash - sdt->sdt_rel));
rtsym_base = (const struct nzlist *) (text_addr + sdt->sdt_nzlist);
rtsym_count = (sdt->sdt_strings - sdt->sdt_nzlist) /
sizeof rtsym_base[0];
assert(rtsym_count * sizeof rtsym_base[0] ==
- sdt->sdt_strings - sdt->sdt_nzlist);
+ (size_t)(sdt->sdt_strings - sdt->sdt_nzlist));
if (rtsym_count != 0) {
rtsym_used = (unsigned char *) calloc(rtsym_count,
@@ -338,8 +338,8 @@ dump_rels(const char *label, const struct relocation_info *base,
size = 1u << r->r_length;
- if (origin <= r->r_address
- && r->r_address < origin + ex->a_text + ex->a_data
+ if (origin <= (unsigned long)r->r_address
+ && (unsigned long)r->r_address < origin + ex->a_text + ex->a_data
&& 1 <= size && size <= 4) {
/*
* XXX - This can cause unaligned accesses. OK for the
OpenPOWER on IntegriCloud