[patch] aix ld import symbols

Tom Rix trix@redhat.com
Tue Aug 21 06:52:00 GMT 2001


New handling of XMC_XO and syscall symbols from import files.  Cleaned up old
broken method. 

Tom
-- 
Tom Rix 
GCC Engineer
trix@redhat.com
256.704.9201
2001-08-20  Tom Rix <trix@redhat.com> 

	* xcofflink.c (bfd_xcoff_import_symbol): Handle import file XMC_XO 
	and syscall symbols.
	(write_global_symbol) : Same.	
	(bfd_xcoff_export_symbol): Remove unused syscall param.
	* libxcoff.h: Change prototype of bfd_xcoff_export symbol and 
	bfd_xcoff_import_symbol.
 
Index: libxcoff.h
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/libxcoff.h,v
retrieving revision 1.1.2.1
diff -c -p -r1.1.2.1 libxcoff.h
*** libxcoff.h	2001/01/30 21:37:03	1.1.2.1
--- libxcoff.h	2001/08/20 17:48:47
*************** extern boolean bfd_xcoff_link_record_set
*** 229,238 ****
  	   bfd_size_type));
  extern boolean bfd_xcoff_import_symbol
    PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
! 	   bfd_vma, const char *, const char *, const char *));
  extern boolean bfd_xcoff_export_symbol
!   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
! 	   boolean));
  extern boolean bfd_xcoff_link_count_reloc
    PARAMS ((bfd *, struct bfd_link_info *, const char *));
  extern boolean bfd_xcoff_record_link_assignment
--- 229,237 ----
  	   bfd_size_type));
  extern boolean bfd_xcoff_import_symbol
    PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
! 	   bfd_vma, const char *, const char *, const char *, unsigned int));
  extern boolean bfd_xcoff_export_symbol
!   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
  extern boolean bfd_xcoff_link_count_reloc
    PARAMS ((bfd *, struct bfd_link_info *, const char *));
  extern boolean bfd_xcoff_record_link_assignment
Index: xcofflink.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/xcofflink.c,v
retrieving revision 1.75.86.5
diff -c -p -r1.75.86.5 xcofflink.c
*** xcofflink.c	2001/08/13 17:55:42	1.75.86.5
--- xcofflink.c	2001/08/20 17:48:47
*************** bfd_xcoff_link_record_set (output_bfd, i
*** 2620,2626 ****
  
  boolean
  bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
! 			 impmember)
       bfd *output_bfd;
       struct bfd_link_info *info;
       struct bfd_link_hash_entry *harg;
--- 2620,2626 ----
  
  boolean
  bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
! 			 impmember, syscall_flag)
       bfd *output_bfd;
       struct bfd_link_info *info;
       struct bfd_link_hash_entry *harg;
*************** bfd_xcoff_import_symbol (output_bfd, inf
*** 2628,2633 ****
--- 2628,2634 ----
       const char *imppath;
       const char *impfile;
       const char *impmember;
+      unsigned int syscall_flag;
  {
    struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
  
*************** bfd_xcoff_import_symbol (output_bfd, inf
*** 2670,2676 ****
  	h = hds;
      }
  
!   h->flags |= XCOFF_IMPORT;
  
    if (val != (bfd_vma) -1)
      {
--- 2671,2677 ----
  	h = hds;
      }
  
!   h->flags |= (XCOFF_IMPORT | syscall_flag);
  
    if (val != (bfd_vma) -1)
      {
*************** bfd_xcoff_import_symbol (output_bfd, inf
*** 2737,2747 ****
  /* Export a symbol.  */
  
  boolean
! bfd_xcoff_export_symbol (output_bfd, info, harg, syscall)
       bfd *output_bfd;
       struct bfd_link_info *info;
       struct bfd_link_hash_entry *harg;
-      boolean syscall ATTRIBUTE_UNUSED;
  {
    struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
  
--- 2738,2747 ----
  /* Export a symbol.  */
  
  boolean
! bfd_xcoff_export_symbol (output_bfd, info, harg)
       bfd *output_bfd;
       struct bfd_link_info *info;
       struct bfd_link_hash_entry *harg;
  {
    struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
  
*************** xcoff_write_global_symbol (h, p)
*** 5477,5483 ****
      if (((h->flags & XCOFF_DEF_REGULAR) == 0 && 
  	 (h->flags & XCOFF_DEF_DYNAMIC) != 0) || 
  	(h->flags & XCOFF_IMPORT) != 0) {
!       ldsym->l_smtype |= L_IMPORT;
      }
  
      if (((h->flags & XCOFF_DEF_REGULAR) != 0 && 
--- 5477,5486 ----
      if (((h->flags & XCOFF_DEF_REGULAR) == 0 && 
  	 (h->flags & XCOFF_DEF_DYNAMIC) != 0) || 
  	(h->flags & XCOFF_IMPORT) != 0) {
!       /* Clear l_smtype 
! 	 Import symbols are defined so the check above will make the l_smtype
! 	 XTY_SD.  But this is not correct, it should be cleared. */
!       ldsym->l_smtype = L_IMPORT;
      }
  
      if (((h->flags & XCOFF_DEF_REGULAR) != 0 && 
*************** xcoff_write_global_symbol (h, p)
*** 5496,5501 ****
--- 5499,5527 ----
  
      ldsym->l_smclas = h->smclas;
  
+     if (ldsym->l_smtype & L_IMPORT)
+       {
+ 	if ((h->root.type == bfd_link_hash_defined ||
+ 	     h->root.type == bfd_link_hash_defweak) &&
+ 	    (h->root.u.def.value != 0))
+ 	  {
+ 	    ldsym->l_smclas = XMC_XO;
+ 	  }
+ 	else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) ==
+ 		 (XCOFF_SYSCALL32 | XCOFF_SYSCALL64))
+ 	  {
+ 	    ldsym->l_smclas = XMC_SV3264;
+ 	  }
+ 	else if (h->flags & XCOFF_SYSCALL32) 
+ 	  {
+ 	    ldsym->l_smclas = XMC_SV;
+ 	  }
+ 	else if (h->flags & XCOFF_SYSCALL64) 
+ 	  {
+ 	    ldsym->l_smclas = XMC_SV64;
+ 	  }
+       }
+        
      if (ldsym->l_ifile == (bfd_size_type) -1) {
        ldsym->l_ifile = 0;
  


More information about the Binutils mailing list