From mboxrd@z Thu Jan 1 00:00:00 1970 From: MFLD Subject: [PATCH PROPOSAL] a.out.h port to 64 bits Date: Mon, 13 Apr 2015 21:54:42 +0200 Message-ID: <552C1F02.8070302@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=JE5YaXNWJZ29/kdTbNb5Gw02wUJgOMU0vscZYV8tbEY=; b=QUbtptGvuvZJL18sC7Q2EgLfFbZT1/iDE38JMVDr3P260tRxFHrudFZkLdmh9abplM 87Xuq24wJBnizQMRFyfD0UZRfkgUSYp7z2yMS6W9vvdJV+qiPYy5d7U6+u8kuQa78Bx3 c4lEVEEgD1aFnB60kHtB30lRFj5twRNz2WX62NDs2FaI8z9FN6Asmux+xEhUqsqfIrXg TJlQrDP50/qzbNpHAOU1UjmntkrloS2BekeMTMbPEGjfEJRaWI3OVo/lzmDWgcta3tOD ePwDuPYEifAz6nvRYkUnWssy3IbrkXYiH95nU3EcCljiH/hbDf944KEGR9J/g2bw7Y00 7g+g== Sender: linux-8086-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: ELKS Hello, DIS88 fails to disassembly 8086 executables when it is built with a "64-linux-gnu" chain. This is because a.out.h uses non-portable integers types, resulting in incorrect structure size computation. Here is a patch that fixes the sizes of the a.out.h structures, using C99 fixed-size integers. Yes, I assume you build DEV86 with a C99 compliant compiler... MFLD diff --git a/libc/include/a.out.h b/libc/include/a.out.h index 677d73e..683e3ec 100644 --- a/libc/include/a.out.h +++ b/libc/include/a.out.h @@ -15,18 +15,18 @@ unsigned char a_hdrlen; /* length of header */ unsigned char a_unused; /* reserved for future use */ unsigned short a_version; /* version stamp (not used at present) */ - long a_text; /* size of text segement in bytes */ - long a_data; /* size of data segment in bytes */ - long a_bss; /* size of bss segment in bytes */ - long a_entry; /* entry point */ - long a_total; /* total memory allocated */ - long a_syms; /* size of symbol table */ + u_int32_t a_text; /* size of text segement in bytes */ + u_int32_t a_data; /* size of data segment in bytes */ + u_int32_t a_bss; /* size of bss segment in bytes */ + u_int32_t a_entry; /* entry point */ + u_int32_t a_total; /* total memory allocated */ + u_int32_t a_syms; /* size of symbol table */ /* SHORT FORM ENDS HERE */ - long a_trsize; /* text relocation size */ - long a_drsize; /* data relocation size */ - long a_tbase; /* text relocation base */ - long a_dbase; /* data relocation base */ + u_int32_t a_trsize; /* text relocation size */ + u_int32_t a_drsize; /* data relocation size */ + u_int32_t a_tbase; /* text relocation base */ + u_int32_t a_dbase; /* data relocation base */ }; #define A_MAGIC0 (unsigned char) 0x01 @@ -56,7 +56,7 @@ /* Offsets of various things. */ #define A_MINHDR 32 -#define A_TEXTPOS(X) ((long)(X).a_hdrlen) +#define A_TEXTPOS(X) ((u_int32_t)(X).a_hdrlen) #define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text) #define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR) #define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8)) @@ -68,7 +68,7 @@ ((X).a_trsize + (X).a_drsize) : 0)) struct reloc { - long r_vaddr; /* virtual address of reference */ + u_int32_t r_vaddr; /* virtual address of reference */ unsigned short r_symndx; /* internal segnum or extern symbol num */ unsigned short r_type; /* relocation type */ }; @@ -92,7 +92,7 @@ struct nlist { /* symbol table entry */ char n_name[8]; /* symbol name */ - long n_value; /* value */ + u_int32_t n_value; /* value */ unsigned char n_sclass; /* storage class */ unsigned char n_numaux; /* number of auxiliary entries (not used) */ unsigned short n_type; /* language base and derived type (not used) */