public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* RE: SOM support
@ 2006-08-25 17:59 ZIGLIO, Frediano, VF-IT
  0 siblings, 0 replies; 2+ messages in thread
From: ZIGLIO, Frediano, VF-IT @ 2006-08-25 17:59 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]

 
> 
> Hi,
>   yesterday I tried to compile cross toolchains for HP-UX 11.00. I
> discovered that ld do not support SOM and also others utility do not
> compile without HP includes... so I research with google and 
> I found an
> old mail (2001) were someone construct some distributable headers from
> hp documentation. However today binutils seems to not compile som
> support. After some file copy and some small changes to bfd/som.c and
> bfd/som.h I was able to compile some cross utils however ld 
> seems to not
> support som at all. Is this expected? Is someone workink on som?
> 

I finally wrote this patch (for 2.17)

So at least cross compile should work for hppa. There is some work to do
for BSD SOM.

freddy77


[-- Attachment #2: som_hppa.diff --]
[-- Type: application/octet-stream, Size: 12879 bytes --]

diff -ruN binutils-2.17/bfd/sombfd.h binutils-2.17.my/bfd/sombfd.h
--- binutils-2.17/bfd/sombfd.h	1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.17.my/bfd/sombfd.h	2006-08-25 17:23:35.420903431 +0200
@@ -0,0 +1,350 @@
+
+/*
+ * Informations from:
+ * - linux/som.h and binfmt_som.c
+ * - a.out man page
+ * - rad_11_0_32.pdf 
+ * - Google
+ * - trying compile, seeing where constants are used
+ */
+
+struct sys_clock
+{
+  unsigned int secs;
+  unsigned int nanosecs;
+};
+
+/* this is the SOM header */
+struct header
+{
+  short system_id;		/* magic number - system */
+  short a_magic;		/* magic number - file type */
+  unsigned int version_id;	/* versiod ID: YYMMDDHH */
+  struct sys_clock file_time;	/* system clock */
+  unsigned int entry_space;	/* space for entry point */
+  unsigned int entry_subspace;	/* subspace for entry point */
+  unsigned int entry_offset;	/* offset of entry point */
+  unsigned int aux_header_location;	/* auxiliary header location */
+  unsigned int aux_header_size;	/* auxiliary header size */
+  unsigned int som_length;	/* length of entire SOM */
+  unsigned int presumed_dp;	/* compiler's DP value */
+  unsigned int space_location;	/* space dictionary location */
+  unsigned int space_total;	/* number of space entries */
+  unsigned int subspace_location;	/* subspace entries location */
+  unsigned int subspace_total;	/* number of subspace entries */
+  unsigned int loader_fixup_location;	/* MPE/iX loader fixup */
+  unsigned int loader_fixup_total;	/* number of fixup records */
+  unsigned int space_strings_location;	/* (sub)space names */
+  unsigned int space_strings_size;	/* size of strings area */
+  unsigned int init_array_location;	/* reserved */
+  unsigned int init_array_total;	/* reserved */
+  unsigned int compiler_location;	/* module dictionary */
+  unsigned int compiler_total;	/* number of modules */
+  unsigned int symbol_location;	/* symbol dictionary */
+  unsigned int symbol_total;	/* number of symbols */
+  unsigned int fixup_request_location;	/* fixup requests */
+  unsigned int fixup_request_total;	/* number of fixup requests */
+  unsigned int symbol_strings_location;	/* module & symbol names area */
+  unsigned int symbol_strings_size;	/* size of strings area */
+  unsigned int unloadable_sp_location;	/* unloadable spaces location */
+  unsigned int unloadable_sp_size;	/* size of data */
+  unsigned int checksum;
+};
+
+#if 0
+/* values for system_id */
+#define SOM_SID_PARISC_1_0      0x020b
+#define SOM_SID_PARISC_1_1      0x0210
+#define SOM_SID_PARISC_2_0      0x0214
+#endif
+
+/* values for a_magic */
+#define EXECLIBMAGIC 0x104
+#define RELOC_MAGIC  0x106
+#define EXEC_MAGIC   0x107
+#define SHARE_MAGIC  0x108
+#define DEMAND_MAGIC 0x10b
+#define DL_MAGIC     0x10d
+#define SHL_MAGIC    0x10e
+#define LIBMAGIC     0x0619
+
+/* values for version_id.  Decimal not hex, yes.  Grr. */
+#define VERSION_ID     85082112
+#define NEW_VERSION_ID 87102412
+
+struct aux_id
+{
+  unsigned int mandatory:1;	/* the linker must understand this */
+  unsigned int copy:1;		/* Must be copied by the linker */
+  unsigned int append:1;	/* Must be merged by the linker */
+  unsigned int ignore:1;	/* Discard section if unknown */
+  unsigned int reserved:12;
+  unsigned int type:16;		/* Header type */
+  unsigned int length;		/* length of _following_ data */
+};
+
+/* Values for the aux_id.type field */
+#define HPUX_AUX_ID           4
+#define VERSION_AUX_ID        6
+#define COPYRIGHT_AUX_ID      9
+#define SHLIB_VERSION_AUX_ID 10
+
+/* The Exec Auxiliary Header.  Called The HP-UX Header within HP apparently. */
+struct som_exec_auxhdr
+{
+  struct aux_id som_auxhdr;
+  int exec_tsize;		/* Text size in bytes */
+  int exec_tmem;		/* Address to load text at */
+  int exec_tfile;		/* Location of text in file */
+  int exec_dsize;		/* Data size in bytes */
+  int exec_dmem;		/* Address to load data at */
+  int exec_dfile;		/* Location of data in file */
+  int exec_bsize;		/* Uninitialised data (bss) */
+  int exec_entry;		/* Address to start executing */
+  int exec_flags;		/* loader flags */
+  int exec_bfill;		/* initialisation value for bss */
+};
+
+/* Oh, the things people do to avoid casts.  Shame it'll break with gcc's
+ * new aliasing rules really.
+ */
+union name_pt
+{
+  char *n_name;
+  unsigned int n_strx;
+};
+
+/* The Space Dictionary */
+struct space_dictionary_record
+{
+  union name_pt name;		/* index to subspace name */
+  unsigned int is_loadable:1;	/* loadable */
+  unsigned int is_defined:1;	/* defined within file */
+  unsigned int is_private:1;	/* not sharable */
+  unsigned int has_intermediate_code:1;	/* contains intermediate code */
+  unsigned int is_tspecific:1;	/* thread specific */
+  unsigned int reserved:11;	/* for future expansion */
+  unsigned int sort_key:8;	/* for linker */
+  unsigned int reserved2:8;	/* for future expansion */
+
+  int space_number;		/* index */
+  int subspace_index;		/* index into subspace dict */
+  unsigned int subspace_quantity;	/* number of subspaces */
+  int loader_fix_index;		/* for loader */
+  unsigned int loader_fix_quantity;	/* for loader */
+  int init_pointer_index;	/* data pointer array index */
+  unsigned int init_pointer_quantity;	/* number of data pointers */
+};
+
+/* The Subspace Dictionary */
+struct subspace_dictionary_record
+{
+  int space_index;
+  unsigned int access_control_bits:7;
+  unsigned int memory_resident:1;
+  unsigned int dup_common:1;
+  unsigned int is_common:1;
+  unsigned int quadrant:2;
+  unsigned int initially_frozen:1;
+  unsigned int is_first:1;
+  unsigned int code_only:1;
+  unsigned int sort_key:8;
+  unsigned int replicate_init:1;
+  unsigned int continuation:1;
+  unsigned int is_tspecific:1;
+  unsigned int is_comdat:1;
+  unsigned int reserved:4;
+
+  int file_loc_init_value;
+  unsigned int initialization_length;
+  unsigned int subspace_start;
+  unsigned int subspace_length;
+
+  unsigned int reserved2:5;
+  unsigned int alignment:27;
+
+  union name_pt name;
+  int fixup_request_index;
+  unsigned int fixup_request_quantity;
+};
+
+
+struct compilation_unit
+{
+  union name_pt name;
+  union name_pt language_name;
+  union name_pt product_id;
+  union name_pt version_id;
+  unsigned int reserved:31;
+  unsigned int chunk_flag:1;
+  struct sys_clock compile_time;
+  struct sys_clock source_time;
+};
+
+#define COMPUNIT struct compilation_unit
+#define COMPUNITSZ sizeof(COMPUNIT)
+
+#define R_NO_RELOCATION    0x00
+#define R_ZEROES           0x20
+#define R_UNINIT           0x22
+#define R_RELOCATION       0x24
+#define R_DATA_ONE_SYMBOL  0x25
+#define R_DATA_PLABEL      0x27
+#define R_SPACE_REF        0x29
+#define R_REPEATED_INIT    0x2a
+#define R_RESERVED         0xe0
+#define R_PCREL_CALL       0x30
+#define R_SHORT_PCREL_MODE 0x3e
+#define R_ABS_CALL         0x40
+#define R_DP_RELATIVE      0x50
+#define R_CODE_ONE_SYMBOL  0x80
+#define R_MILLI_REL        0xae
+#define R_CODE_PLABEL      0xb0
+#define R_BREAKPOINT       0xb2
+#define R_ENTRY            0xb3
+#define R_ALT_ENTRY        0xb5
+#define R_EXIT             0xb6
+#define R_BEGIN_TRY        0xb7
+#define R_END_TRY          0xb8
+#define R_BEGIN_BRTAB      0xbb
+#define R_END_BRTAB        0xbc
+#define R_STATEMENT        0xbd
+#define R_DATA_EXPR        0xc0
+#define R_CODE_EXPR        0xc1
+#define R_FSEL             0xc2
+#define R_LSEL             0xc3
+#define R_RSEL             0xc4
+#define R_N_MODE           0xc5
+#define R_S_MODE           0xc6
+#define R_D_MODE           0xc7
+#define R_R_MODE           0xc8
+#define R_DATA_OVERRIDE    0xc9
+#define R_TRANSLATED       0xce
+#define R_COMP1            0xd0
+#define R_COMP2            0xd1
+#define R_COMP3            0xd2
+#define R_PREV_FIXUP       0xd3
+
+struct lst_header
+{
+  short int system_id;
+  short int a_magic;
+  unsigned int version_id;
+  struct sys_clock file_time;
+  unsigned int hash_loc;
+  unsigned int hash_size;
+  unsigned int module_count;
+  unsigned int module_limit;
+  unsigned int dir_loc;
+  unsigned int export_loc;
+  unsigned int export_count;
+  unsigned int import_loc;
+  unsigned int aux_loc;
+  unsigned int aux_size;
+  unsigned int string_loc;
+  unsigned int string_size;
+  unsigned int free_list;
+  unsigned int file_end;
+  unsigned int checksum;
+};
+
+#define SLSTHDR sizeof(struct lst_header)
+
+struct som_entry
+{
+  unsigned int location;
+  unsigned int length;
+};
+
+struct user_string_aux_hdr
+{
+  struct aux_id header_id;
+  unsigned int string_length;
+  char user_string[1];
+};
+
+struct copyright_aux_hdr
+{
+  struct aux_id header_id;
+  unsigned int string_length;
+  char copyright[1];
+};
+
+struct symbol_dictionary_record
+{
+  unsigned int hidden:1;
+  unsigned int secondary_def:1;
+  unsigned int symbol_type:6;
+  unsigned int symbol_scope:4;
+  unsigned int check_level:3;
+  unsigned int must_qualify:1;
+  unsigned int initially_frozen:1;
+  unsigned int memory_resident:1;
+  unsigned int is_common:1;
+  unsigned int dup_common:1;
+  unsigned int xleast:2;
+  unsigned int arg_reloc:10;
+  union name_pt name;
+  union name_pt qualifier_name;
+  unsigned int has_long_return:1;
+  unsigned int no_relocation:1;
+  unsigned int is_comdat:1;
+  unsigned int reserved:5;
+  unsigned int symbol_info:24;
+  unsigned int symbol_value;
+};
+
+/* Values taken from an old a.out manual */
+/* Values for symbol_type */
+#define ST_NULL      0		/* unused symbol entry */
+#define ST_ABSOLUTE  1		/* non-relocatable symbol */
+#define ST_DATA      2		/* initialized data symbol */
+#define ST_CODE      3		/* generic code symbol */
+#define ST_PRI_PROG  4		/* program entry point */
+#define ST_SEC_PROG  5		/* secondary prog entry point */
+#define ST_ENTRY     6		/* procedure entry point */
+#define ST_STORAGE   7		/* storage request */
+#define ST_STUB      8		/* MPE-only */
+#define ST_MODULE    9		/* Pascal module name */
+#define ST_SYM_EXT   10		/* symbol extension record */
+#define ST_ARG_EXT   11		/* argument extension record */
+#define ST_MILLICODE 12		/* millicode entry point */
+#define ST_PLABEL    13		/* MPE-only */
+#define ST_OCT_DIS   14		/* Used by OCT only--ptr to translated code */
+#define ST_MILLI_EXT 15		/* address of external millicode */
+#define ST_TSTORAGE  16		/* TLS common symbol */
+
+/* Values for symbol_scope */
+#define SS_UNSAT     0		/* unsatisfied reference */
+#define SS_EXTERNAL  1		/* import request to external symbol */
+#define SS_LOCAL     2		/* local symbol */
+#define SS_UNIVERSAL 3		/* global symbol */
+
+struct lst_symbol_record
+{
+  unsigned int hidden:1;
+  unsigned int secondary_def:1;
+  unsigned int symbol_type:6;
+  unsigned int symbol_scope:4;
+  unsigned int check_level:3;
+  unsigned int must_qualify:1;
+  unsigned int initially_frozen:1;
+  unsigned int memory_resident:1;
+  unsigned int is_common:1;
+  unsigned int dup_common:1;
+  unsigned int xleast:2;
+  unsigned int arg_reloc:10;
+  union name_pt name;
+  union name_pt qualifier_name;
+  unsigned int symbol_info;
+  unsigned int symbol_value;
+  unsigned int symbol_descriptor;
+  unsigned int reserved:8;
+  unsigned int max_num_args:8;
+  unsigned int min_num_args:8;
+  unsigned int num_args:8;
+  unsigned int som_index;
+  unsigned int symbol_key;
+  unsigned int next_entry;
+};
+
diff -ruN binutils-2.17/bfd/som.c binutils-2.17.my/bfd/som.c
--- binutils-2.17/bfd/som.c	2005-11-20 20:21:06.000000000 +0100
+++ binutils-2.17.my/bfd/som.c	2006-08-25 14:34:46.804992357 +0200
@@ -27,7 +27,7 @@
 #include "bfd.h"
 #include "sysdep.h"
 
-#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX)
+//#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX)
 
 #include "libbfd.h"
 #include "som.h"
@@ -35,7 +35,7 @@
 
 #include <sys/param.h>
 #include <signal.h>
-#include <machine/reg.h>
+//#include <machine/reg.h>
 #include <sys/file.h>
 
 static bfd_reloc_status_type hppa_som_reloc
@@ -6324,4 +6324,4 @@
   NULL
 };
 
-#endif /* HOST_HPPAHPUX || HOST_HPPABSD || HOST_HPPAOSF */
+//#endif /* HOST_HPPAHPUX || HOST_HPPABSD || HOST_HPPAOSF */
diff -ruN binutils-2.17/bfd/som.h binutils-2.17.my/bfd/som.h
--- binutils-2.17/bfd/som.h	2005-05-22 22:02:16.000000000 +0200
+++ binutils-2.17.my/bfd/som.h	2006-08-25 15:20:48.892361104 +0200
@@ -31,16 +31,9 @@
 #define PA_2_0
 
 #include <a.out.h>
-#include <lst.h>
+#include "sombfd.h"
 #include <ar.h>
 
-/* The SOM BFD backend doesn't currently use anything from these
-   two include files, but it's likely to need them in the future.  */
-#ifdef R_DLT_REL
-#include <shl.h>
-#include <dl.h>
-#endif
-
 #if defined(HOST_HPPABSD) || defined (HOST_HPPAOSF)
 /* BSD uses a completely different scheme for object file identification.
    so for now, define _PA_RISC_ID to accept any random value for a model

^ permalink raw reply	[flat|nested] 2+ messages in thread

* SOM support
@ 2006-08-24 13:07 ZIGLIO, Frediano, VF-IT
  0 siblings, 0 replies; 2+ messages in thread
From: ZIGLIO, Frediano, VF-IT @ 2006-08-24 13:07 UTC (permalink / raw)
  To: binutils

Hi,
  yesterday I tried to compile cross toolchains for HP-UX 11.00. I
discovered that ld do not support SOM and also others utility do not
compile without HP includes... so I research with google and I found an
old mail (2001) were someone construct some distributable headers from
hp documentation. However today binutils seems to not compile som
support. After some file copy and some small changes to bfd/som.c and
bfd/som.h I was able to compile some cross utils however ld seems to not
support som at all. Is this expected? Is someone workink on som?

bye
  freddy77

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-25 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-25 17:59 SOM support ZIGLIO, Frediano, VF-IT
  -- strict thread matches above, loose matches on Subject: below --
2006-08-24 13:07 ZIGLIO, Frediano, VF-IT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).