$NetBSD: patch-ab,v 1.3 2015/02/23 18:20:21 joerg 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 @@ -21,11 +21,11 @@ */ #include +#include +#include #include "x86_aout.h" -#ifndef __OUT_OK -#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 +34,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 +59,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 +92,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 +141,7 @@ long out_offset, in_offset, length; } } +void patch_bin(file_off, value) long file_off; int value; @@ -162,7 +165,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!");