are recognized, chose section flags based on the name.
(bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add
name argument.
(bfd_coff_styp_to_sec_flags_hook): Add name argument.
(coff_compute_section_file_positions): Don't adjust the section
position by COFF_PAGE_SIZE unless SEC_ALLOC is set.
* libcoff.h: Rebuilt.
* coffgen.c (make_a_section_from_file): Pass section name to
bfd_coff_styp_to_sec_flags_hook.
* ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name
argument.
* libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to
prototype.
+Mon Aug 15 12:16:56 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
+
+ * coffcode.h (styp_to_sec_flags): Add name argument. If no flags
+ are recognized, chose section flags based on the name.
+ (bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add
+ name argument.
+ (bfd_coff_styp_to_sec_flags_hook): Add name argument.
+ (coff_compute_section_file_positions): Don't adjust the section
+ position by COFF_PAGE_SIZE unless SEC_ALLOC is set.
+ * libcoff.h: Rebuilt.
+ * coffgen.c (make_a_section_from_file): Pass section name to
+ bfd_coff_styp_to_sec_flags_hook.
+ * ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name
+ argument.
+ * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to
+ prototype.
+
Fri Aug 12 11:22:40 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
* elfcode.h (section_from_elf_index): Correct check for invalid
* in sec_to_styp_flags().
*/
static flagword
-styp_to_sec_flags (abfd, hdr)
- bfd * abfd;
+styp_to_sec_flags (abfd, hdr, name)
+ bfd *abfd;
PTR hdr;
+ const char *name;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
sec_flags |= SEC_DEBUGGING;
#endif
}
+ else if (strcmp (name, _TEXT) == 0)
+ {
+ if (sec_flags & SEC_NEVER_LOAD)
+ sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY;
+ else
+ sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
+ }
+ else if (strcmp (name, _DATA) == 0
+#ifdef TWO_DATA_SECS
+ || strcmp (name, ".data2") == 0
+#endif
+ )
+ {
+ if (sec_flags & SEC_NEVER_LOAD)
+ sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY;
+ else
+ sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
+ }
+ else if (strcmp (name, _BSS) == 0)
+ {
+#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY
+ if (sec_flags & SEC_NEVER_LOAD)
+ sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY;
+ else
+#endif
+ sec_flags |= SEC_ALLOC;
+ }
+ else if (strcmp (name, ".debug") == 0
+#ifdef _COMMENT
+ || strcmp (name, _COMMENT) == 0
+#endif
+ || strcmp (name, ".stab") == 0
+ || strcmp (name, ".stabstr") == 0)
+ {
+#ifdef COFF_PAGE_SIZE
+ sec_flags |= SEC_DEBUGGING;
+#endif
+ }
+#ifdef _LIB
+ else if (strcmp (name, _LIB) == 0)
+ ;
+#endif
+#ifdef _LIT
+ else if (strcmp (name, _LIT) == 0)
+ {
+ sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY;
+ }
+#endif
else
{
sec_flags |= SEC_ALLOC | SEC_LOAD;
. PTR internal_aouthdr));
. flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
. bfd *abfd,
-. PTR internal_scnhdr));
+. PTR internal_scnhdr,
+. const char *name));
. asection *(*_bfd_make_section_hook) PARAMS ((
. bfd *abfd,
. char *name));
.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
.
-.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
-. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))
+.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
+. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
.
.#define bfd_coff_make_section_hook(abfd, name)\
. ((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name))
#ifdef COFF_PAGE_SIZE
/* In demand paged files the low order bits of the file offset
must match the low order bits of the virtual address. */
- if ((abfd->flags & D_PAGED) != 0)
+ if ((abfd->flags & D_PAGED) != 0
+ && (current->flags & SEC_ALLOC) != 0)
sofar += (current->vma - sofar) % COFF_PAGE_SIZE;
#endif
internal_a.magic = APOLLO_COFF_VERSION_NUMBER;
#endif
-#if M68 || WE32K
+#if defined(M68) || defined(WE32K) || defined(M68K)
#define __A_MAGIC_SET__
- /* Never was anything here for the 68k */
-#endif /* M68 || WE32K */
+#if defined(LYNXOS)
+ internal_a.magic = LYNXCOFFMAGIC;
+#endif /* LYNXOS */
+#endif /* M68 || WE32K || M68K */
-#if I386
+#if defined(I386)
#define __A_MAGIC_SET__
+#if defined(LYNXOS)
+ internal_a.magic = LYNXCOFFMAGIC;
+#else /* LYNXOS */
internal_a.magic = ZMAGIC;
+#endif /* LYNXOS */
#endif /* I386 */
+#if defined(SPARC)
+#define __A_MAGIC_SET__
+#if defined(LYNXOS)
+ internal_a.magic = LYNXCOFFMAGIC;
+#endif /* LYNXOS */
+#endif /* SPARC */
+
#if RS6000COFF_C
#define __A_MAGIC_SET__
internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC :
return_section->lineno_count = hdr->s_nlnno;
return_section->userdata = NULL;
return_section->next = (asection *) NULL;
- return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr);
+ return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name);
return_section->target_index = target_index;
/* Get the BFD section from a COFF symbol section number. */
-struct sec *
+asection *
coff_section_from_bfd_index (abfd, index)
bfd *abfd;
int index;
if (index == N_ABS)
{
- return &bfd_abs_section;
+ return bfd_abs_section_ptr;
}
if (index == N_UNDEF)
{
- return &bfd_und_section;
+ return bfd_und_section_ptr;
}
if(index == N_DEBUG)
{
/* We should not reach this point, but the SCO 3.2v4 /lib/libc_s.a
has a bad symbol table in biglitpow.o. */
- return &bfd_und_section;
+ return bfd_und_section_ptr;
}
/* Get the upper bound of a COFF symbol table. */
else if (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING) {
syment->n_value = coff_symbol_ptr->symbol.value;
}
- else if (coff_symbol_ptr->symbol.section == & bfd_und_section) {
+ else if (bfd_is_und_section (coff_symbol_ptr->symbol.section)) {
syment->n_scnum = N_UNDEF;
syment->n_value = 0;
}
}
bfd_ptr->outsymbols = newsyms;
for (i = 0; i < symbol_count; i++)
- if (symbol_ptr_ptr[i]->section != &bfd_und_section)
+ if (! bfd_is_und_section (symbol_ptr_ptr[i]->section))
*newsyms++ = symbol_ptr_ptr[i];
for (i = 0; i < symbol_count; i++)
- if (symbol_ptr_ptr[i]->section == &bfd_und_section)
+ if (bfd_is_und_section (symbol_ptr_ptr[i]->section))
*newsyms++ = symbol_ptr_ptr[i];
*newsyms = (asymbol *) NULL;
symbol_ptr_ptr = bfd_ptr->outsymbols;
if (native->u.syment.n_sclass == C_FILE)
symbol->section = &bfd_debug_section;
- if (symbol->section == &bfd_abs_section)
+ if (bfd_is_abs_section (symbol->section))
{
native->u.syment.n_scnum = N_ABS;
}
{
native->u.syment.n_scnum = N_DEBUG;
}
- else if (symbol->section == &bfd_und_section)
+ else if (bfd_is_und_section (symbol->section))
{
native->u.syment.n_scnum = N_UNDEF;
}
native = &dummy;
native->u.syment.n_type = T_NULL;
native->u.syment.n_flags = 0;
- if (symbol->section == &bfd_und_section)
+ if (bfd_is_und_section (symbol->section))
{
native->u.syment.n_scnum = N_UNDEF;
native->u.syment.n_value = symbol->value;
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
/* Functions in coffgen.c. */
-extern bfd_target *coff_object_p PARAMS ((bfd *));
+extern const bfd_target *coff_object_p PARAMS ((bfd *));
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
extern boolean coff_renumber_symbols PARAMS ((bfd *));
extern void coff_mangle_symbols PARAMS ((bfd *));
-extern void coff_write_symbols PARAMS ((bfd *));
+extern boolean coff_write_symbols PARAMS ((bfd *));
extern boolean coff_write_linenumbers PARAMS ((bfd *));
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
PTR internal_aouthdr));
flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
bfd *abfd,
- PTR internal_scnhdr));
+ PTR internal_scnhdr,
+ const char *name));
asection *(*_bfd_make_section_hook) PARAMS ((
bfd *abfd,
char *name));
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
- ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))
+#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
+ ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
#define bfd_coff_make_section_hook(abfd, name)\
((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name))
/* Generic ECOFF BFD backend vectors. */
extern boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd));
-extern bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd));
+extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd));
#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup
#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define _bfd_ecoff_set_alignment_hook \
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
-extern flagword _bfd_ecoff_styp_to_sec_flags PARAMS ((bfd *abfd, PTR hdr));
+extern flagword _bfd_ecoff_styp_to_sec_flags
+ PARAMS ((bfd *abfd, PTR hdr, const char *name));
extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));