This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to improve consistency in GAS



Please apply this patch to GAS.   Since this is my code, I feel pretty
good about the relative "safety" of this move.   It allows the .note
section to be generated for building under ELF while not bringing a bunch
of ELF-isms into obj-coff.

It should be considered independently from other work in the assembler
emulation stuff.

Thank you.
RJL




Wed Jan  8 23:24:05 CST 1997 Robert Lipe <robertl@dgii.com>

	* config/tc-i386.c (sco_id): Moved from here
 	  config/obj-elf.c (sco_id): to here.   Adding the
	  identifier really is an SCO ELF specific thing, not 
	  just a SCO x86 specific thing.

	


*** gas.orig/config/tc-i386.c	Tue Dec 17 03:05:30 1996
--- gas/config/tc-i386.c	Wed Jan  8 23:08:22 1997
***************
*** 3073,3171 ****
  
  #endif /* BFD_ASSEMBLER? */
  
- #ifdef SCO_ELF
- 
- /* Heavily plagarized from obj_elf_version.  The idea is to emit the
-    SCO specific identifier in the .notes section to satisfy the SCO
-    linker.
- 
-    This looks more complicated than it really is.  As opposed to the
-    "obvious" solution, this should handle the cross dev cases
-    correctly.  (i.e, hosting on a 64 bit big endian processor, but
-    generating SCO Elf code) Efficiency isn't a concern, as there
-    should be exactly one of these sections per object module.
- 
-    SCO OpenServer 5 identifies it's ELF modules with a standard ELF
-    .note section.
- 
-    int_32 namesz  = 4 ;  Name size 
-    int_32 descsz  = 12 ; Descriptive information 
-    int_32 type    = 1 ;  
-    char   name[4] = "SCO" ; Originator name ALWAYS SCO + NULL 
-    int_32 version = (major ver # << 16)  | version of tools ;
-    int_32 source  = (tool_id << 16 ) | 1 ;
-    int_32 info    = 0 ;    These are set by the SCO tools, but we
-                            don't know enough about the source 
- 			   environment to set them.  SCO ld currently
- 			   ignores them, and recommends we set them
- 			   to zero.  */
- 
- #define SCO_MAJOR_VERSION 0x1
- #define SCO_MINOR_VERSION 0x1
- 
- void
- sco_id ()
- {
-   char *name;
-   unsigned int c;
-   char ch;
-   char *p;
-   asection *seg = now_seg;
-   subsegT subseg = now_subseg;
-   Elf_Internal_Note i_note;
-   Elf_External_Note e_note;
-   asection *note_secp = (asection *) NULL;
-   int i, len;
- 
-   /* create the .note section */
- 
-   note_secp = subseg_new (".note", 0);
-   bfd_set_section_flags (stdoutput,
- 			 note_secp,
- 			 SEC_HAS_CONTENTS | SEC_READONLY);
- 
-   /* process the version string */
- 
-   i_note.namesz = 4; 
-   i_note.descsz = 12;		/* 12 descriptive bytes */
-   i_note.type = NT_VERSION;	/* Contains a version string */
- 
-   p = frag_more (sizeof (i_note.namesz));
-   md_number_to_chars (p, (valueT) i_note.namesz, 4);
- 
-   p = frag_more (sizeof (i_note.descsz));
-   md_number_to_chars (p, (valueT) i_note.descsz, 4);
- 
-   p = frag_more (sizeof (i_note.type));
-   md_number_to_chars (p, (valueT) i_note.type, 4);
- 
-   p = frag_more (4);
-   strcpy (p, "SCO"); 
- 
-   /* Note: this is the version number of the ELF we're representing */
-   p = frag_more (4);
-   md_number_to_chars (p, (SCO_MAJOR_VERSION << 16) | (SCO_MINOR_VERSION), 4);
- 
-   /* Here, we pick a magic number for ourselves (yes, I "registered"
-      it with SCO.  The bottom bit shows that we are compat with the
-      SCO ABI.  */
-   p = frag_more (4);
-   md_number_to_chars (p, 0x4c520000 | 0x0001, 4);
- 
-   /* If we knew (or cared) what the source language options were, we'd
-      fill them in here.  SCO has given us permission to ignore these
-      and just set them to zero.  */
-   p = frag_more (4);
-   md_number_to_chars (p, 0x0000, 4);
-  
-   frag_align (2, 0); 
- 
-   /* We probably can't restore the current segment, for there likely
-      isn't one yet...  */
-   if (seg && subseg)
-     subseg_set (seg, subseg);
- }
- 
- #endif /* SCO_ELF */
- 
  /* end of tc-i386.c */
--- 3096,3099 ----
*** gas.orig/config/obj-elf.c	Tue Dec 17 03:05:25 1996
--- gas/config/obj-elf.c	Wed Jan  8 23:08:47 1997
***************
*** 1284,1289 ****
--- 1284,1386 ----
  #endif /* NEED_ECOFF_DEBUG */
  }
  
+ #ifdef SCO_ELF
+ 
+ /* Heavily plagarized from obj_elf_version.  The idea is to emit the
+    SCO specific identifier in the .notes section to satisfy the SCO
+    linker.
+ 
+    This looks more complicated than it really is.  As opposed to the
+    "obvious" solution, this should handle the cross dev cases
+    correctly.  (i.e, hosting on a 64 bit big endian processor, but
+    generating SCO Elf code) Efficiency isn't a concern, as there
+    should be exactly one of these sections per object module.
+ 
+    SCO OpenServer 5 identifies it's ELF modules with a standard ELF
+    .note section.
+ 
+    int_32 namesz  = 4 ;  Name size 
+    int_32 descsz  = 12 ; Descriptive information 
+    int_32 type    = 1 ;  
+    char   name[4] = "SCO" ; Originator name ALWAYS SCO + NULL 
+    int_32 version = (major ver # << 16)  | version of tools ;
+    int_32 source  = (tool_id << 16 ) | 1 ;
+    int_32 info    = 0 ;    These are set by the SCO tools, but we
+                            don't know enough about the source 
+ 			   environment to set them.  SCO ld currently
+ 			   ignores them, and recommends we set them
+ 			   to zero.  */
+ 
+ #define SCO_MAJOR_VERSION 0x1
+ #define SCO_MINOR_VERSION 0x1
+ 
+ void
+ sco_id ()
+ {
+ 
+   char *name;
+   unsigned int c;
+   char ch;
+   char *p;
+   asection *seg = now_seg;
+   subsegT subseg = now_subseg;
+   Elf_Internal_Note i_note;
+   Elf_External_Note e_note;
+   asection *note_secp = (asection *) NULL;
+   int i, len;
+ 
+   /* create the .note section */
+ 
+   note_secp = subseg_new (".note", 0);
+   bfd_set_section_flags (stdoutput,
+ 			 note_secp,
+ 			 SEC_HAS_CONTENTS | SEC_READONLY);
+ 
+   /* process the version string */
+ 
+   i_note.namesz = 4; 
+   i_note.descsz = 12;		/* 12 descriptive bytes */
+   i_note.type = NT_VERSION;	/* Contains a version string */
+ 
+   p = frag_more (sizeof (i_note.namesz));
+   md_number_to_chars (p, (valueT) i_note.namesz, 4);
+ 
+   p = frag_more (sizeof (i_note.descsz));
+   md_number_to_chars (p, (valueT) i_note.descsz, 4);
+ 
+   p = frag_more (sizeof (i_note.type));
+   md_number_to_chars (p, (valueT) i_note.type, 4);
+ 
+   p = frag_more (4);
+   strcpy (p, "SCO"); 
+ 
+   /* Note: this is the version number of the ELF we're representing */
+   p = frag_more (4);
+   md_number_to_chars (p, (SCO_MAJOR_VERSION << 16) | (SCO_MINOR_VERSION), 4);
+ 
+   /* Here, we pick a magic number for ourselves (yes, I "registered"
+      it with SCO.  The bottom bit shows that we are compat with the
+      SCO ABI.  */
+   p = frag_more (4);
+   md_number_to_chars (p, 0x4c520000 | 0x0001, 4);
+ 
+   /* If we knew (or cared) what the source language options were, we'd
+      fill them in here.  SCO has given us permission to ignore these
+      and just set them to zero.  */
+   p = frag_more (4);
+   md_number_to_chars (p, 0x0000, 4);
+  
+   frag_align (2, 0); 
+ 
+   /* We probably can't restore the current segment, for there likely
+      isn't one yet...  */
+   if (seg && subseg)
+     subseg_set (seg, subseg);
+ 
+ }
+ 
+ #endif /* SCO_ELF */
+ 
  const struct format_ops elf_format_ops =
  {
    bfd_target_elf_flavour,