@ -748,49 +748,53 @@ sunos_create_dynamic_sections (bfd *abfd,
/* The .dynamic section holds the basic dynamic information: the
sun4_dynamic structure , the dynamic debugger information , and
the sun4_dynamic_link structure . */
s = bfd_make_section_with_flags ( abfd , " .dynamic " , flags ) ;
s = bfd_make_section_anyway_ with_flags ( abfd , " .dynamic " , flags ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
/* The .got section holds the global offset table. The address
is put in the ld_got field . */
s = bfd_make_section_with_flags ( abfd , " .got " , flags ) ;
s = bfd_make_section_anyway_ with_flags ( abfd , " .got " , flags ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
/* The .plt section holds the procedure linkage table. The
address is put in the ld_plt field . */
s = bfd_make_section_with_flags ( abfd , " .plt " , flags | SEC_CODE ) ;
s = bfd_make_section_anyway_ with_flags ( abfd , " .plt " , flags | SEC_CODE ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
/* The .dynrel section holds the dynamic relocs. The address is
put in the ld_rel field . */
s = bfd_make_section_with_flags ( abfd , " .dynrel " , flags | SEC_READONLY ) ;
s = bfd_make_section_anyway_with_flags ( abfd , " .dynrel " ,
flags | SEC_READONLY ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
/* The .hash section holds the dynamic hash table. The address
is put in the ld_hash field . */
s = bfd_make_section_with_flags ( abfd , " .hash " , flags | SEC_READONLY ) ;
s = bfd_make_section_anyway_with_flags ( abfd , " .hash " ,
flags | SEC_READONLY ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
/* The .dynsym section holds the dynamic symbols. The address
is put in the ld_stab field . */
s = bfd_make_section_with_flags ( abfd , " .dynsym " , flags | SEC_READONLY ) ;
s = bfd_make_section_anyway_with_flags ( abfd , " .dynsym " ,
flags | SEC_READONLY ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
/* The .dynstr section holds the dynamic symbol string table.
The address is put in the ld_symbols field . */
s = bfd_make_section_with_flags ( abfd , " .dynstr " , flags | SEC_READONLY ) ;
s = bfd_make_section_anyway_with_flags ( abfd , " .dynstr " ,
flags | SEC_READONLY ) ;
if ( s = = NULL
| | ! bfd_set_section_alignment ( abfd , s , 2 ) )
return FALSE ;
@ -805,7 +809,7 @@ sunos_create_dynamic_sections (bfd *abfd,
dynobj = sunos_hash_table ( info ) - > dynobj ;
s = bfd_get_section_by_name ( dynobj , " .got " ) ;
s = bfd_get_linker_ section ( dynobj , " .got " ) ;
if ( s - > size = = 0 )
s - > size = BYTES_IN_WORD ;
@ -1325,11 +1329,11 @@ sunos_scan_std_relocs (struct bfd_link_info *info,
if ( ! sunos_create_dynamic_sections ( abfd , info , FALSE ) )
return FALSE ;
dynobj = sunos_hash_table ( info ) - > dynobj ;
splt = bfd_get_section_by_name ( dynobj , " .plt " ) ;
srel = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
splt = bfd_get_linker_ section ( dynobj , " .plt " ) ;
srel = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( splt ! = NULL & & srel ! = NULL ) ;
sgot = bfd_get_section_by_name ( dynobj , " .got " ) ;
sgot = bfd_get_linker_ section ( dynobj , " .got " ) ;
BFD_ASSERT ( sgot ! = NULL ) ;
if ( sgot - > size = = 0 )
sgot - > size = BYTES_IN_WORD ;
@ -1475,9 +1479,9 @@ sunos_scan_ext_relocs (struct bfd_link_info *info,
if ( ! sunos_create_dynamic_sections ( abfd , info , FALSE ) )
return FALSE ;
dynobj = sunos_hash_table ( info ) - > dynobj ;
splt = bfd_get_section_by_name ( dynobj , " .plt " ) ;
sgot = bfd_get_section_by_name ( dynobj , " .got " ) ;
srel = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
splt = bfd_get_linker_ section ( dynobj , " .plt " ) ;
sgot = bfd_get_linker_ section ( dynobj , " .got " ) ;
srel = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( splt ! = NULL & & sgot ! = NULL & & srel ! = NULL ) ;
/* Make sure we have an initial entry in the .got table. */
@ -1543,9 +1547,9 @@ sunos_scan_ext_relocs (struct bfd_link_info *info,
if ( ! sunos_create_dynamic_sections ( abfd , info , TRUE ) )
return FALSE ;
dynobj = sunos_hash_table ( info ) - > dynobj ;
splt = bfd_get_section_by_name ( dynobj , " .plt " ) ;
sgot = bfd_get_section_by_name ( dynobj , " .got " ) ;
srel = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
splt = bfd_get_linker_ section ( dynobj , " .plt " ) ;
sgot = bfd_get_linker_ section ( dynobj , " .got " ) ;
srel = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( splt ! = NULL & & sgot ! = NULL & & srel ! = NULL ) ;
}
@ -1590,9 +1594,9 @@ sunos_scan_ext_relocs (struct bfd_link_info *info,
if ( ! sunos_create_dynamic_sections ( abfd , info , FALSE ) )
return FALSE ;
dynobj = sunos_hash_table ( info ) - > dynobj ;
splt = bfd_get_section_by_name ( dynobj , " .plt " ) ;
sgot = bfd_get_section_by_name ( dynobj , " .got " ) ;
srel = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
splt = bfd_get_linker_ section ( dynobj , " .plt " ) ;
sgot = bfd_get_linker_ section ( dynobj , " .got " ) ;
srel = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( splt ! = NULL & & sgot ! = NULL & & srel ! = NULL ) ;
/* Make sure we have an initial entry in the .got table. */
@ -1815,7 +1819,7 @@ sunos_scan_dynamic_symbol (struct sunos_link_hash_entry *h, void * data)
regular symbols includes the debugging symbols , which have
long names and are often duplicated in several object files .
There are no debugging symbols in the dynamic symbols . */
s = bfd_get_section_by_name ( dynobj , " .dynstr " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynstr " ) ;
BFD_ASSERT ( s ! = NULL ) ;
contents = bfd_realloc ( s - > contents , s - > size + len + 1 ) ;
if ( contents = = NULL )
@ -1834,7 +1838,7 @@ sunos_scan_dynamic_symbol (struct sunos_link_hash_entry *h, void * data)
hash & = 0x7fffffff ;
hash % = sunos_hash_table ( info ) - > bucketcount ;
s = bfd_get_section_by_name ( dynobj , " .hash " ) ;
s = bfd_get_linker_ section ( dynobj , " .hash " ) ;
BFD_ASSERT ( s ! = NULL ) ;
if ( GET_SWORD ( dynobj , s - > contents + hash * HASH_ENTRY_SIZE ) = = - 1 )
@ -1931,14 +1935,14 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
+ + sunos_hash_table ( info ) - > dynsymcount ;
h - > dynindx = - 2 ;
}
s = bfd_get_linker_section ( dynobj , " .got " ) ;
BFD_ASSERT ( s ! = NULL ) ;
h - > root . root . type = bfd_link_hash_defined ;
h - > root . root . u . def . section = bfd_get_section_by_name ( dynobj , " .got " ) ;
h - > root . root . u . def . section = s ;
/* If the .got section is more than 0x1000 bytes, we set
__GLOBAL_OFFSET_TABLE_ to be 0x1000 bytes into the section ,
so that 13 bit relocations have a greater chance of working . */
s = bfd_get_section_by_name ( dynobj , " .got " ) ;
BFD_ASSERT ( s ! = NULL ) ;
if ( s - > size > = 0x1000 )
h - > root . root . u . def . value = 0x1000 ;
else
@ -1951,7 +1955,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
up the dynamic linking information . */
if ( sunos_hash_table ( info ) - > dynamic_sections_needed )
{
* sdynptr = bfd_get_section_by_name ( dynobj , " .dynamic " ) ;
* sdynptr = bfd_get_linker_ section ( dynobj , " .dynamic " ) ;
/* The .dynamic section is always the same size. */
s = * sdynptr ;
@ -1968,7 +1972,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
symbols . We build the dynamic symbol string table ( . dynstr )
in a traversal of the symbol table using
sunos_scan_dynamic_symbol . */
s = bfd_get_section_by_name ( dynobj , " .dynsym " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynsym " ) ;
BFD_ASSERT ( s ! = NULL ) ;
s - > size = dynsymcount * sizeof ( struct external_nlist ) ;
s - > contents = bfd_alloc ( output_bfd , s - > size ) ;
@ -1989,7 +1993,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
bucketcount = dynsymcount ;
else
bucketcount = 1 ;
s = bfd_get_section_by_name ( dynobj , " .hash " ) ;
s = bfd_get_linker_ section ( dynobj , " .hash " ) ;
BFD_ASSERT ( s ! = NULL ) ;
hashalloc = ( dynsymcount + bucketcount - 1 ) * HASH_ENTRY_SIZE ;
s - > contents = bfd_zalloc ( dynobj , hashalloc ) ;
@ -2013,7 +2017,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
/* The SunOS native linker seems to align the total size of the
symbol strings to a multiple of 8. I don ' t know if this is
important , but it can ' t hurt much . */
s = bfd_get_section_by_name ( dynobj , " .dynstr " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynstr " ) ;
BFD_ASSERT ( s ! = NULL ) ;
if ( ( s - > size & 7 ) ! = 0 )
{
@ -2032,7 +2036,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
/* Now that we have worked out the sizes of the procedure linkage
table and the dynamic relocs , allocate storage for them . */
s = bfd_get_section_by_name ( dynobj , " .plt " ) ;
s = bfd_get_linker_ section ( dynobj , " .plt " ) ;
BFD_ASSERT ( s ! = NULL ) ;
if ( s - > size ! = 0 )
{
@ -2056,7 +2060,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
}
}
s = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
if ( s - > size ! = 0 )
{
s - > contents = bfd_alloc ( dynobj , s - > size ) ;
@ -2068,7 +2072,7 @@ bfd_sunos_size_dynamic_sections (bfd *output_bfd,
s - > reloc_count = 0 ;
/* Make space for the global offset table. */
s = bfd_get_section_by_name ( dynobj , " .got " ) ;
s = bfd_get_linker_ section ( dynobj , " .got " ) ;
s - > contents = bfd_alloc ( dynobj , s - > size ) ;
if ( s - > contents = = NULL )
return FALSE ;
@ -2114,10 +2118,10 @@ sunos_write_dynamic_symbol (bfd *output_bfd,
bfd_vma r_address ;
dynobj = sunos_hash_table ( info ) - > dynobj ;
splt = bfd_get_section_by_name ( dynobj , " .plt " ) ;
splt = bfd_get_linker_ section ( dynobj , " .plt " ) ;
p = splt - > contents + h - > plt_offset ;
s = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
r_address = ( splt - > output_section - > vma
+ splt - > output_offset
@ -2301,7 +2305,7 @@ sunos_write_dynamic_symbol (bfd *output_bfd,
return TRUE ;
}
s = bfd_get_section_by_name ( sunos_hash_table ( info ) - > dynobj , " .dynsym " ) ;
s = bfd_get_linker_ section ( sunos_hash_table ( info ) - > dynobj , " .dynsym " ) ;
BFD_ASSERT ( s ! = NULL ) ;
outsym = ( ( struct external_nlist * )
( s - > contents + h - > dynindx * EXTERNAL_NLIST_SIZE ) ) ;
@ -2356,7 +2360,7 @@ sunos_check_dynamic_reloc (struct bfd_link_info *info,
asection * splt ;
/* Redirect the relocation to the PLT entry. */
splt = bfd_get_section_by_name ( dynobj , " .plt " ) ;
splt = bfd_get_linker_ section ( dynobj , " .plt " ) ;
* relocationp = ( splt - > output_section - > vma
+ splt - > output_offset
+ h - > plt_offset ) ;
@ -2451,7 +2455,7 @@ sunos_check_dynamic_reloc (struct bfd_link_info *info,
BFD_ASSERT ( got_offsetp ! = NULL & & * got_offsetp ! = 0 ) ;
sgot = bfd_get_section_by_name ( dynobj , " .got " ) ;
sgot = bfd_get_linker_ section ( dynobj , " .got " ) ;
/* We set the least significant bit to indicate whether we have
already initialized the GOT entry . */
@ -2473,7 +2477,7 @@ sunos_check_dynamic_reloc (struct bfd_link_info *info,
/* We need to create a GLOB_DAT or 32 reloc to tell the
dynamic linker to fill in this entry in the table . */
s = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( s ! = NULL ) ;
BFD_ASSERT ( s - > reloc_count * obj_reloc_entry_size ( dynobj )
< s - > size ) ;
@ -2603,7 +2607,7 @@ sunos_check_dynamic_reloc (struct bfd_link_info *info,
/* It looks like this is a reloc we are supposed to copy. */
s = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( s ! = NULL ) ;
BFD_ASSERT ( s - > reloc_count * obj_reloc_entry_size ( dynobj ) < s - > size ) ;
@ -2701,7 +2705,7 @@ sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info)
dynobj = sunos_hash_table ( info ) - > dynobj ;
sdyn = bfd_get_section_by_name ( dynobj , " .dynamic " ) ;
sdyn = bfd_get_linker_ section ( dynobj , " .dynamic " ) ;
BFD_ASSERT ( sdyn ! = NULL ) ;
/* Finish up the .need section. The linker emulation code filled it
@ -2731,7 +2735,7 @@ sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info)
/* The first entry in the .got section is the address of the
dynamic information , unless this is a shared library . */
s = bfd_get_section_by_name ( dynobj , " .got " ) ;
s = bfd_get_linker_ section ( dynobj , " .got " ) ;
BFD_ASSERT ( s ! = NULL ) ;
if ( info - > shared | | sdyn - > size = = 0 )
PUT_WORD ( dynobj , 0 , s - > contents ) ;
@ -2793,30 +2797,30 @@ sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info)
PUT_WORD ( dynobj , s - > output_section - > filepos + s - > output_offset ,
esdl . ld_rules ) ;
s = bfd_get_section_by_name ( dynobj , " .got " ) ;
s = bfd_get_linker_ section ( dynobj , " .got " ) ;
BFD_ASSERT ( s ! = NULL ) ;
PUT_WORD ( dynobj , s - > output_section - > vma + s - > output_offset ,
esdl . ld_got ) ;
s = bfd_get_section_by_name ( dynobj , " .plt " ) ;
s = bfd_get_linker_ section ( dynobj , " .plt " ) ;
BFD_ASSERT ( s ! = NULL ) ;
PUT_WORD ( dynobj , s - > output_section - > vma + s - > output_offset ,
esdl . ld_plt ) ;
PUT_WORD ( dynobj , s - > size , esdl . ld_plt_sz ) ;
s = bfd_get_section_by_name ( dynobj , " .dynrel " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynrel " ) ;
BFD_ASSERT ( s ! = NULL ) ;
BFD_ASSERT ( s - > reloc_count * obj_reloc_entry_size ( dynobj )
= = s - > size ) ;
PUT_WORD ( dynobj , s - > output_section - > filepos + s - > output_offset ,
esdl . ld_rel ) ;
s = bfd_get_section_by_name ( dynobj , " .hash " ) ;
s = bfd_get_linker_ section ( dynobj , " .hash " ) ;
BFD_ASSERT ( s ! = NULL ) ;
PUT_WORD ( dynobj , s - > output_section - > filepos + s - > output_offset ,
esdl . ld_hash ) ;
s = bfd_get_section_by_name ( dynobj , " .dynsym " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynsym " ) ;
BFD_ASSERT ( s ! = NULL ) ;
PUT_WORD ( dynobj , s - > output_section - > filepos + s - > output_offset ,
esdl . ld_stab ) ;
@ -2826,7 +2830,7 @@ sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info)
PUT_WORD ( dynobj , ( bfd_vma ) sunos_hash_table ( info ) - > bucketcount ,
esdl . ld_buckets ) ;
s = bfd_get_section_by_name ( dynobj , " .dynstr " ) ;
s = bfd_get_linker_ section ( dynobj , " .dynstr " ) ;
BFD_ASSERT ( s ! = NULL ) ;
PUT_WORD ( dynobj , s - > output_section - > filepos + s - > output_offset ,
esdl . ld_symbols ) ;