$NetBSD: patch-ab,v 1.2 2011/08/29 01:39:12 dholland Exp $ - build on LP64 - fix mismatched return statements, which clang dislikes --- ld/catimage.c.orig 1997-07-22 21:38:12.000000000 +0000 +++ ld/catimage.c @@ -27,6 +27,8 @@ #error "Compile error: struct exec invalid (long not 32 bit ?)" #endif +static void patch_bin(long, int); + unsigned long text_offt[10]; /* Locations to patch (0=don't) */ unsigned long data_offt[10]; @@ -35,11 +37,12 @@ FILE * ofd; FILE * ifd = 0; struct exec header; +int main(argc, argv) int argc; char ** argv; { - long image_offset, text_off; + Long image_offset, text_off; int image_id; if( argc < 3 || argc > 11 ) @@ -59,8 +62,10 @@ char ** argv; open_obj(argv[image_id+2]); printf("File %-14s seg=0x%04lx text=0x%04lx data=0x%04lx\n", - input_file, (image_offset>>4), - (header.a_text>>4), (header.a_total>>4)); + input_file, + (unsigned long)(image_offset>>4), + (unsigned long)(header.a_text>>4), + (unsigned long)(header.a_total>>4)); text_off = image_offset; if( header.a_flags & A_SEP ) @@ -90,7 +95,7 @@ char ** argv; fputc('\0', ofd); fclose(ofd); - printf("Output file size %ldKb\n", ((image_offset+0x3FF)>>10)); + printf("Output file size %ldKb\n", (long)((image_offset+0x3FF)>>10)); if( ifd ) fclose(ifd); exit(0); @@ -139,6 +144,7 @@ long out_offset, in_offset, length; } } +void patch_bin(file_off, value) long file_off; int value; @@ -162,7 +168,7 @@ read_symtable() { struct nlist item; int nitems; - long base_off = 0; + Long base_off = 0; if( header.a_syms == 0 ) fatal("Input file has been stripped!");