diff options
author | Alan Modra <amodra@bigpond.net.au> | 2000-07-08 12:08:43 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2000-07-08 12:08:43 +0000 |
commit | 5ca9a3d26a0b8c399c527fc61edc5871ad271054 (patch) | |
tree | 5318a10a97e3c9770c53c13183a8cba3e953e482 | |
parent | c1d0790ee43fb2dd4900ab3a3ae3ef3f1df7a5b3 (diff) | |
download | gdb-5ca9a3d26a0b8c399c527fc61edc5871ad271054.tar.gz |
Add sequence id field to asection.
Tidy comments and replace deprecated CONST with const.
-rw-r--r-- | bfd/ChangeLog | 14 | ||||
-rw-r--r-- | bfd/archures.c | 4 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 757 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 4 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 16 | ||||
-rw-r--r-- | bfd/libbfd.h | 16 | ||||
-rw-r--r-- | bfd/libcoff.h | 36 | ||||
-rw-r--r-- | bfd/section.c | 468 |
8 files changed, 671 insertions, 644 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8b826aceae6..ce058dc8be3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2000-07-08 Alan Modra <alan@linuxcare.com.au> + + * section.c (struct sec): Add id field. Tidy comment formatting. + (bfd_make_section_anyway): Set id. + (STD_SECTION): Init id too. + Change CONST to const throughout. + * archures.c (bfd_arch_info): Tidy comment. + (bfd_arch_list): Change a CONST to const. + * libbfd-in.h: Tidy comments and replace CONST with const. + * elf-bfd.h: Likewise. + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + * libcoff.h: Regenerate. + 2000-07-07 DJ Delorie <dj@redhat.com> * archive.c (_bfd_write_archive_contents): Add an informative diff --git a/bfd/archures.c b/bfd/archures.c index bafb9c8b2cb..69ca6b12bea 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -256,7 +256,7 @@ DESCRIPTION . const char *arch_name; . const char *printable_name; . unsigned int section_align_power; -. {* true if this is the default machine for the architecture *} +. {* True if this is the default machine for the architecture. *} . boolean the_default; . const struct bfd_arch_info * (*compatible) . PARAMS ((const struct bfd_arch_info *a, @@ -444,7 +444,7 @@ bfd_arch_list () } } - name_list = (CONST char **) + name_list = (const char **) bfd_malloc ((vec_length + 1) * sizeof (char **)); if (name_list == NULL) return NULL; diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 95544bf2f33..b151e259a93 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -793,7 +793,7 @@ boolean bfd_make_readable PARAMS ((bfd *abfd)); - /* Byte swapping macros for user section data. */ +/* Byte swapping macros for user section data. */ #define bfd_put_8(abfd, val, ptr) \ ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val))) @@ -846,7 +846,7 @@ bfd_make_readable PARAMS ((bfd *abfd)); : (abort (), (void) 0)) - /* Byte swapping macros for file header data. */ +/* Byte swapping macros for file header data. */ #define bfd_h_put_8(abfd, val, ptr) \ bfd_put_8 (abfd, val, ptr) @@ -884,365 +884,366 @@ bfd_make_readable PARAMS ((bfd *abfd)); #define bfd_h_get_signed_64(abfd, ptr) \ BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr)) - /* This structure is used for a comdat section, as in PE. A comdat - section is associated with a particular symbol. When the linker - sees a comdat section, it keeps only one of the sections with a - given name and associated with a given symbol. */ +/* This structure is used for a comdat section, as in PE. A comdat + section is associated with a particular symbol. When the linker + sees a comdat section, it keeps only one of the sections with a + given name and associated with a given symbol. */ struct bfd_comdat_info { - /* The name of the symbol associated with a comdat section. */ + /* The name of the symbol associated with a comdat section. */ const char *name; - /* The local symbol table index of the symbol associated with a + /* The local symbol table index of the symbol associated with a comdat section. This is only meaningful to the object file format specific code; it is not an index into the list returned by bfd_canonicalize_symtab. */ long symbol; - /* If this section is being discarded, the linker uses this field + /* If this section is being discarded, the linker uses this field to point to the input section which is being kept. */ struct sec *sec; }; typedef struct sec { - /* The name of the section; the name isn't a copy, the pointer is - the same as that passed to bfd_make_section. */ + /* The name of the section; the name isn't a copy, the pointer is + the same as that passed to bfd_make_section. */ - CONST char *name; + const char *name; + + /* A unique sequence number. */ - /* Which section is it; 0..nth. */ + int id; - int index; + /* Which section is it; 0..nth. */ - /* The next section in the list belonging to the BFD, or NULL. */ + int index; - struct sec *next; + /* The next section in the list belonging to the BFD, or NULL. */ - /* The field flags contains attributes of the section. Some - flags are read in from the object file, and some are - synthesized from other information. */ + struct sec *next; - flagword flags; + /* The field flags contains attributes of the section. Some + flags are read in from the object file, and some are + synthesized from other information. */ + + flagword flags; #define SEC_NO_FLAGS 0x000 - /* Tells the OS to allocate space for this section when loading. - This is clear for a section containing debug information - only. */ + /* Tells the OS to allocate space for this section when loading. + This is clear for a section containing debug information only. */ #define SEC_ALLOC 0x001 - /* Tells the OS to load the section from the file when loading. - This is clear for a .bss section. */ + /* Tells the OS to load the section from the file when loading. + This is clear for a .bss section. */ #define SEC_LOAD 0x002 - /* The section contains data still to be relocated, so there is - some relocation information too. */ + /* The section contains data still to be relocated, so there is + some relocation information too. */ #define SEC_RELOC 0x004 -#if 0 /* Obsolete ? */ +#if 0 /* Obsolete ? */ #define SEC_BALIGN 0x008 #endif - /* A signal to the OS that the section contains read only - data. */ + /* A signal to the OS that the section contains read only data. */ #define SEC_READONLY 0x010 - /* The section contains code only. */ + /* The section contains code only. */ #define SEC_CODE 0x020 - /* The section contains data only. */ + /* The section contains data only. */ #define SEC_DATA 0x040 - /* The section will reside in ROM. */ + /* The section will reside in ROM. */ #define SEC_ROM 0x080 - /* The section contains constructor information. This section - type is used by the linker to create lists of constructors and - destructors used by <<g++>>. When a back end sees a symbol - which should be used in a constructor list, it creates a new - section for the type of name (e.g., <<__CTOR_LIST__>>), attaches - the symbol to it, and builds a relocation. To build the lists - of constructors, all the linker has to do is catenate all the - sections called <<__CTOR_LIST__>> and relocate the data - contained within - exactly the operations it would peform on - standard data. */ + /* The section contains constructor information. This section + type is used by the linker to create lists of constructors and + destructors used by <<g++>>. When a back end sees a symbol + which should be used in a constructor list, it creates a new + section for the type of name (e.g., <<__CTOR_LIST__>>), attaches + the symbol to it, and builds a relocation. To build the lists + of constructors, all the linker has to do is catenate all the + sections called <<__CTOR_LIST__>> and relocate the data + contained within - exactly the operations it would peform on + standard data. */ #define SEC_CONSTRUCTOR 0x100 - /* The section is a constructor, and should be placed at the - end of the text, data, or bss section(?). */ + /* The section is a constructor, and should be placed at the + end of the text, data, or bss section(?). */ #define SEC_CONSTRUCTOR_TEXT 0x1100 #define SEC_CONSTRUCTOR_DATA 0x2100 #define SEC_CONSTRUCTOR_BSS 0x3100 - /* The section has contents - a data section could be - <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be - <<SEC_HAS_CONTENTS>> */ + /* The section has contents - a data section could be + <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be + <<SEC_HAS_CONTENTS>> */ #define SEC_HAS_CONTENTS 0x200 - /* An instruction to the linker to not output the section - even if it has information which would normally be written. */ + /* An instruction to the linker to not output the section + even if it has information which would normally be written. */ #define SEC_NEVER_LOAD 0x400 - /* The section is a COFF shared library section. This flag is - only for the linker. If this type of section appears in - the input file, the linker must copy it to the output file - without changing the vma or size. FIXME: Although this - was originally intended to be general, it really is COFF - specific (and the flag was renamed to indicate this). It - might be cleaner to have some more general mechanism to - allow the back end to control what the linker does with - sections. */ + /* The section is a COFF shared library section. This flag is + only for the linker. If this type of section appears in + the input file, the linker must copy it to the output file + without changing the vma or size. FIXME: Although this + was originally intended to be general, it really is COFF + specific (and the flag was renamed to indicate this). It + might be cleaner to have some more general mechanism to + allow the back end to control what the linker does with + sections. */ #define SEC_COFF_SHARED_LIBRARY 0x800 - /* The section contains common symbols (symbols may be defined - multiple times, the value of a symbol is the amount of - space it requires, and the largest symbol value is the one - used). Most targets have exactly one of these (which we - translate to bfd_com_section_ptr), but ECOFF has two. */ + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ #define SEC_IS_COMMON 0x8000 - /* The section contains only debugging information. For - example, this is set for ELF .debug and .stab sections. - strip tests this flag to see if a section can be - discarded. */ + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ #define SEC_DEBUGGING 0x10000 - /* The contents of this section are held in memory pointed to - by the contents field. This is checked by - bfd_get_section_contents, and the data is retrieved from - memory if appropriate. */ + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by bfd_get_section_contents, + and the data is retrieved from memory if appropriate. */ #define SEC_IN_MEMORY 0x20000 - /* The contents of this section are to be excluded by the - linker for executable and shared objects unless those - objects are to be further relocated. */ + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ #define SEC_EXCLUDE 0x40000 - /* The contents of this section are to be sorted by the - based on the address specified in the associated symbol - table. */ + /* The contents of this section are to be sorted by the + based on the address specified in the associated symbol + table. */ #define SEC_SORT_ENTRIES 0x80000 - /* When linking, duplicate sections of the same name should be - discarded, rather than being combined into a single section as - is usually done. This is similar to how common symbols are - handled. See SEC_LINK_DUPLICATES below. */ + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ #define SEC_LINK_ONCE 0x100000 - /* If SEC_LINK_ONCE is set, this bitfield describes how the linker - should handle duplicate sections. */ + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ #define SEC_LINK_DUPLICATES 0x600000 - /* This value for SEC_LINK_DUPLICATES means that duplicate - sections with the same name should simply be discarded. */ + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ #define SEC_LINK_DUPLICATES_DISCARD 0x0 - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if there are any duplicate sections, although - it should still only link one copy. */ + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ #define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections are a different size. */ + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ #define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections contain different - contents. */ + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ #define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 - /* This section was created by the linker as part of dynamic - relocation or other arcane processing. It is skipped when - going through the first-pass output, trusting that someone - else up the line will take care of it later. */ + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ #define SEC_LINKER_CREATED 0x800000 - /* This section should not be subject to garbage collection. */ + /* This section should not be subject to garbage collection. */ #define SEC_KEEP 0x1000000 - /* This section contains "short" data, and should be placed - "near" the GP. */ + /* This section contains "short" data, and should be placed + "near" the GP. */ #define SEC_SMALL_DATA 0x2000000 - /* This section contains data which may be shared with other - executables or shared objects. */ + /* This section contains data which may be shared with other + executables or shared objects. */ #define SEC_SHARED 0x4000000 - /* When a section with this flag is being linked, then if the size of - the input section is less than a page, it should not cross a page - boundary. If the size of the input section is one page or more, it - should be aligned on a page boundary. */ + /* When a section with this flag is being linked, then if the size of + the input section is less than a page, it should not cross a page + boundary. If the size of the input section is one page or more, it + should be aligned on a page boundary. */ #define SEC_BLOCK 0x8000000 - /* Conditionally link this section; do not link if there are no - references found to any symbol in the section. */ + /* Conditionally link this section; do not link if there are no + references found to any symbol in the section. */ #define SEC_CLINK 0x10000000 - /* End of section flags. */ + /* End of section flags. */ - /* Some internal packed boolean fields. */ + /* Some internal packed boolean fields. */ - /* See the vma field. */ - unsigned int user_set_vma : 1; + /* See the vma field. */ + unsigned int user_set_vma : 1; - /* Whether relocations have been processed. */ - unsigned int reloc_done : 1; + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; - /* A mark flag used by some of the linker backends. */ - unsigned int linker_mark : 1; + /* A mark flag used by some of the linker backends. */ + unsigned int linker_mark : 1; - /* A mark flag used by some linker backends for garbage collection. */ - unsigned int gc_mark : 1; + /* A mark flag used by some linker backends for garbage collection. */ + unsigned int gc_mark : 1; - /* End of internal packed boolean fields. */ + /* End of internal packed boolean fields. */ - /* The virtual memory address of the section - where it will be - at run time. The symbols are relocated against this. The - user_set_vma flag is maintained by bfd; if it's not set, the - backend can assign addresses (for example, in <<a.out>>, where - the default address for <<.data>> is dependent on the specific - target and various flags). */ + /* The virtual memory address of the section - where it will be + at run time. The symbols are relocated against this. The + user_set_vma flag is maintained by bfd; if it's not set, the + backend can assign addresses (for example, in <<a.out>>, where + the default address for <<.data>> is dependent on the specific + target and various flags). */ - bfd_vma vma; + bfd_vma vma; - /* The load address of the section - where it would be in a - rom image; really only used for writing section header - information. */ + /* The load address of the section - where it would be in a + rom image; really only used for writing section header + information. */ - bfd_vma lma; + bfd_vma lma; - /* The size of the section in octets, as it will be output. - Contains a value even if the section has no contents (e.g., the - size of <<.bss>>). This will be filled in after relocation. */ + /* The size of the section in octets, as it will be output. + Contains a value even if the section has no contents (e.g., the + size of <<.bss>>). This will be filled in after relocation. */ - bfd_size_type _cooked_size; + bfd_size_type _cooked_size; - /* The original size on disk of the section, in octets. Normally this - value is the same as the size, but if some relaxing has - been done, then this value will be bigger. */ + /* The original size on disk of the section, in octets. Normally this + value is the same as the size, but if some relaxing has + been done, then this value will be bigger. */ - bfd_size_type _raw_size; + bfd_size_type _raw_size; - /* If this section is going to be output, then this value is the - offset in *bytes* into the output section of the first byte in the - input section (byte ==> smallest addressable unit on the - target). In most cases, if this was going to start at the - 100th octet (8-bit quantity) in the output section, this value - would be 100. However, if the target byte size is 16 bits - (bfd_octets_per_byte is "2"), this value would be 50. */ + /* If this section is going to be output, then this value is the + offset in *bytes* into the output section of the first byte in the + input section (byte ==> smallest addressable unit on the + target). In most cases, if this was going to start at the + 100th octet (8-bit quantity) in the output section, this value + would be 100. However, if the target byte size is 16 bits + (bfd_octets_per_byte is "2"), this value would be 50. */ - bfd_vma output_offset; + bfd_vma output_offset; - /* The output section through which to map on output. */ + /* The output section through which to map on output. */ - struct sec *output_section; + struct sec *output_section; - /* The alignment requirement of the section, as an exponent of 2 - - e.g., 3 aligns to 2^3 (or 8). */ + /* The alignment requirement of the section, as an exponent of 2 - + e.g., 3 aligns to 2^3 (or 8). */ - unsigned int alignment_power; + unsigned int alignment_power; - /* If an input section, a pointer to a vector of relocation - records for the data in this section. */ + /* If an input section, a pointer to a vector of relocation + records for the data in this section. */ - struct reloc_cache_entry *relocation; + struct reloc_cache_entry *relocation; - /* If an output section, a pointer to a vector of pointers to - relocation records for the data in this section. */ + /* If an output section, a pointer to a vector of pointers to + relocation records for the data in this section. */ - struct reloc_cache_entry **orelocation; + struct reloc_cache_entry **orelocation; - /* The number of relocation records in one of the above */ + /* The number of relocation records in one of the above */ - unsigned reloc_count; + unsigned reloc_count; - /* Information below is back end specific - and not always used - or updated. */ + /* Information below is back end specific - and not always used + or updated. */ - /* File position of section data */ + /* File position of section data. */ - file_ptr filepos; + file_ptr filepos; - /* File position of relocation info */ + /* File position of relocation info. */ - file_ptr rel_filepos; + file_ptr rel_filepos; - /* File position of line data */ + /* File position of line data. */ - file_ptr line_filepos; + file_ptr line_filepos; - /* Pointer to data for applications */ + /* Pointer to data for applications. */ - PTR userdata; + PTR userdata; - /* If the SEC_IN_MEMORY flag is set, this points to the actual - contents. */ - unsigned char *contents; + /* If the SEC_IN_MEMORY flag is set, this points to the actual + contents. */ + unsigned char *contents; - /* Attached line number information */ + /* Attached line number information. */ - alent *lineno; + alent *lineno; - /* Number of line number records */ + /* Number of line number records. */ - unsigned int lineno_count; + unsigned int lineno_count; - /* Optional information about a COMDAT entry; NULL if not COMDAT */ + /* Optional information about a COMDAT entry; NULL if not COMDAT. */ - struct bfd_comdat_info *comdat; + struct bfd_comdat_info *comdat; - /* When a section is being output, this value changes as more - linenumbers are written out */ + /* When a section is being output, this value changes as more + linenumbers are written out. */ - file_ptr moving_line_filepos; + file_ptr moving_line_filepos; - /* What the section number is in the target world */ + /* What the section number is in the target world. */ - int target_index; + int target_index; - PTR used_by_bfd; + PTR used_by_bfd; - /* If this is a constructor section then here is a list of the - relocations created to relocate items within it. */ + /* If this is a constructor section then here is a list of the + relocations created to relocate items within it. */ - struct relent_chain *constructor_chain; + struct relent_chain *constructor_chain; - /* The BFD which owns the section. */ + /* The BFD which owns the section. */ - bfd *owner; + bfd *owner; - /* A symbol which points at this section only */ - struct symbol_cache_entry *symbol; - struct symbol_cache_entry **symbol_ptr_ptr; + /* A symbol which points at this section only */ + struct symbol_cache_entry *symbol; + struct symbol_cache_entry **symbol_ptr_ptr; - struct bfd_link_order *link_order_head; - struct bfd_link_order *link_order_tail; + struct bfd_link_order *link_order_head; + struct bfd_link_order *link_order_tail; } asection ; - /* These sections are global, and are managed by BFD. The application - and target back end are not permitted to change the values in - these sections. New code should use the section_ptr macros rather - than referring directly to the const sections. The const sections - may eventually vanish. */ +/* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. New code should use the section_ptr macros rather + than referring directly to the const sections. The const sections + may eventually vanish. */ #define BFD_ABS_SECTION_NAME "*ABS*" #define BFD_UND_SECTION_NAME "*UND*" #define BFD_COM_SECTION_NAME "*COM*" #define BFD_IND_SECTION_NAME "*IND*" - /* the absolute section */ +/* the absolute section */ extern const asection bfd_abs_section; #define bfd_abs_section_ptr ((asection *) &bfd_abs_section) #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) - /* Pointer to the undefined section */ +/* Pointer to the undefined section */ extern const asection bfd_und_section; #define bfd_und_section_ptr ((asection *) &bfd_und_section) #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) - /* Pointer to the common section */ +/* Pointer to the common section */ extern const asection bfd_com_section; #define bfd_com_section_ptr ((asection *) &bfd_com_section) - /* Pointer to the indirect section */ +/* Pointer to the indirect section */ extern const asection bfd_ind_section; #define bfd_ind_section_ptr ((asection *) &bfd_ind_section) #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) @@ -1258,16 +1259,16 @@ extern const struct symbol_cache_entry * const bfd_ind_symbol; ((section)->reloc_done ? (section)->_cooked_size \ : (abort (), (bfd_size_type) 1)) asection * -bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name)); +bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name)); asection * -bfd_make_section_old_way PARAMS ((bfd *abfd, CONST char *name)); +bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name)); asection * -bfd_make_section_anyway PARAMS ((bfd *abfd, CONST char *name)); +bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name)); asection * -bfd_make_section PARAMS ((bfd *, CONST char *name)); +bfd_make_section PARAMS ((bfd *, const char *name)); boolean bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags)); @@ -1307,9 +1308,9 @@ _bfd_strip_section_from_output enum bfd_architecture { - bfd_arch_unknown, /* File arch not known */ - bfd_arch_obscure, /* Arch known, not one of these */ - bfd_arch_m68k, /* Motorola 68xxx */ + bfd_arch_unknown, /* File arch not known */ + bfd_arch_obscure, /* Arch known, not one of these */ + bfd_arch_m68k, /* Motorola 68xxx */ #define bfd_mach_m68000 1 #define bfd_mach_m68008 2 #define bfd_mach_m68010 3 @@ -1318,9 +1319,9 @@ enum bfd_architecture #define bfd_mach_m68040 6 #define bfd_mach_m68060 7 #define bfd_mach_cpu32 8 - bfd_arch_vax, /* DEC Vax */ - bfd_arch_i960, /* Intel 960 */ - /* The order of the following is important. + bfd_arch_vax, /* DEC Vax */ + bfd_arch_i960, /* Intel 960 */ + /* The order of the following is important. lower number indicates a machine type that only accepts a subset of the instructions available to machines with higher numbers. @@ -1337,21 +1338,21 @@ enum bfd_architecture #define bfd_mach_i960_jx 7 #define bfd_mach_i960_hx 8 - bfd_arch_a29k, /* AMD 29000 */ - bfd_arch_sparc, /* SPARC */ + bfd_arch_a29k, /* AMD 29000 */ + bfd_arch_sparc, /* SPARC */ #define bfd_mach_sparc 1 - /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ +/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ #define bfd_mach_sparc_sparclet 2 #define bfd_mach_sparc_sparclite 3 #define bfd_mach_sparc_v8plus 4 -#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */ +#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */ #define bfd_mach_sparc_sparclite_le 6 #define bfd_mach_sparc_v9 7 -#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */ - /* Nonzero if MACH has the v9 instruction set. */ +#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */ +/* Nonzero if MACH has the v9 instruction set. */ #define bfd_mach_sparc_v9_p(mach) \ ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a) - bfd_arch_mips, /* MIPS Rxxxx */ + bfd_arch_mips, /* MIPS Rxxxx */ #define bfd_mach_mips3000 3000 #define bfd_mach_mips3900 3900 #define bfd_mach_mips4000 4000 @@ -1367,24 +1368,24 @@ enum bfd_architecture #define bfd_mach_mips8000 8000 #define bfd_mach_mips10000 10000 #define bfd_mach_mips16 16 - bfd_arch_i386, /* Intel 386 */ + bfd_arch_i386, /* Intel 386 */ #define bfd_mach_i386_i386 0 #define bfd_mach_i386_i8086 1 #define bfd_mach_i386_i386_intel_syntax 2 - bfd_arch_we32k, /* AT&T WE32xxx */ - bfd_arch_tahoe, /* CCI/Harris Tahoe */ - bfd_arch_i860, /* Intel 860 */ - bfd_arch_i370, /* IBM 360/370 Mainframes */ - bfd_arch_romp, /* IBM ROMP PC/RT */ - bfd_arch_alliant, /* Alliant */ - bfd_arch_convex, /* Convex */ - bfd_arch_m88k, /* Motorola 88xxx */ - bfd_arch_pyramid, /* Pyramid Technology */ - bfd_arch_h8300, /* Hitachi H8/300 */ + bfd_arch_we32k, /* AT&T WE32xxx */ + bfd_arch_tahoe, /* CCI/Harris Tahoe */ + bfd_arch_i860, /* Intel 860 */ + bfd_arch_i370, /* IBM 360/370 Mainframes */ + bfd_arch_romp, /* IBM ROMP PC/RT */ + bfd_arch_alliant, /* Alliant */ + bfd_arch_convex, /* Convex */ + bfd_arch_m88k, /* Motorola 88xxx */ + bfd_arch_pyramid, /* Pyramid Technology */ + bfd_arch_h8300, /* Hitachi H8/300 */ #define bfd_mach_h8300 1 #define bfd_mach_h8300h 2 #define bfd_mach_h8300s 3 - bfd_arch_powerpc, /* PowerPC */ + bfd_arch_powerpc, /* PowerPC */ #define bfd_mach_ppc 0 #define bfd_mach_ppc_403 403 #define bfd_mach_ppc_403gc 4030 @@ -1402,24 +1403,24 @@ enum bfd_architecture #define bfd_mach_ppc_rs64ii 642 #define bfd_mach_ppc_rs64iii 643 #define bfd_mach_ppc_7400 7400 - bfd_arch_rs6000, /* IBM RS/6000 */ + bfd_arch_rs6000, /* IBM RS/6000 */ #define bfd_mach_rs6k 0 #define bfd_mach_rs6k_rs1 6001 #define bfd_mach_rs6k_rsc 6003 #define bfd_mach_rs6k_rs2 6002 - bfd_arch_hppa, /* HP PA RISC */ - bfd_arch_d10v, /* Mitsubishi D10V */ + bfd_arch_hppa, /* HP PA RISC */ + bfd_arch_d10v, /* Mitsubishi D10V */ #define bfd_mach_d10v 0 #define bfd_mach_d10v_ts2 2 #define bfd_mach_d10v_ts3 3 - bfd_arch_d30v, /* Mitsubishi D30V */ - bfd_arch_m68hc11, /* Motorola 68HC11 */ - bfd_arch_m68hc12, /* Motorola 68HC12 */ - bfd_arch_z8k, /* Zilog Z8000 */ + bfd_arch_d30v, /* Mitsubishi D30V */ + bfd_arch_m68hc11, /* Motorola 68HC11 */ + bfd_arch_m68hc12, /* Motorola 68HC12 */ + bfd_arch_z8k, /* Zilog Z8000 */ #define bfd_mach_z8001 1 #define bfd_mach_z8002 2 - bfd_arch_h8500, /* Hitachi H8/500 */ - bfd_arch_sh, /* Hitachi SH */ + bfd_arch_h8500, /* Hitachi H8/500 */ + bfd_arch_sh, /* Hitachi SH */ #define bfd_mach_sh 0 #define bfd_mach_sh2 0x20 #define bfd_mach_sh_dsp 0x2d @@ -1427,11 +1428,11 @@ enum bfd_architecture #define bfd_mach_sh3_dsp 0x3d #define bfd_mach_sh3e 0x3e #define bfd_mach_sh4 0x40 - bfd_arch_alpha, /* Dec Alpha */ + bfd_arch_alpha, /* Dec Alpha */ #define bfd_mach_alpha_ev4 0x10 #define bfd_mach_alpha_ev5 0x20 #define bfd_mach_alpha_ev6 0x30 - bfd_arch_arm, /* Advanced Risc Machines ARM */ + bfd_arch_arm, /* Advanced Risc Machines ARM */ #define bfd_mach_arm_2 1 #define bfd_mach_arm_2a 2 #define bfd_mach_arm_3 3 @@ -1440,30 +1441,30 @@ enum bfd_architecture #define bfd_mach_arm_4T 6 #define bfd_mach_arm_5 7 #define bfd_mach_arm_5T 8 - bfd_arch_ns32k, /* National Semiconductors ns32000 */ - bfd_arch_w65, /* WDC 65816 */ - bfd_arch_tic30, /* Texas Instruments TMS320C30 */ - bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ - bfd_arch_tic80, /* TI TMS320c80 (MVP) */ - bfd_arch_v850, /* NEC V850 */ + bfd_arch_ns32k, /* National Semiconductors ns32000 */ + bfd_arch_w65, /* WDC 65816 */ + bfd_arch_tic30, /* Texas Instruments TMS320C30 */ + bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ + bfd_arch_tic80, /* TI TMS320c80 (MVP) */ + bfd_arch_v850, /* NEC V850 */ #define bfd_mach_v850 0 #define bfd_mach_v850e 'E' #define bfd_mach_v850ea 'A' - bfd_arch_arc, /* Argonaut RISC Core */ + bfd_arch_arc, /* Argonaut RISC Core */ #define bfd_mach_arc_base 0 - bfd_arch_m32r, /* Mitsubishi M32R/D */ -#define bfd_mach_m32r 0 /* backwards compatibility */ + bfd_arch_m32r, /* Mitsubishi M32R/D */ +#define bfd_mach_m32r 0 /* backwards compatibility */ #define bfd_mach_m32rx 'x' - bfd_arch_mn10200, /* Matsushita MN10200 */ - bfd_arch_mn10300, /* Matsushita MN10300 */ + bfd_arch_mn10200, /* Matsushita MN10200 */ + bfd_arch_mn10300, /* Matsushita MN10300 */ #define bfd_mach_mn10300 300 #define bfd_mach_am33 330 bfd_arch_fr30, #define bfd_mach_fr30 0x46523330 bfd_arch_mcore, - bfd_arch_ia64, /* HP/Intel ia64 */ + bfd_arch_ia64, /* HP/Intel ia64 */ bfd_arch_pj, - bfd_arch_avr, /* Atmel AVR microcontrollers */ + bfd_arch_avr, /* Atmel AVR microcontrollers */ #define bfd_mach_avr1 1 #define bfd_mach_avr2 2 #define bfd_mach_avr3 3 @@ -1482,7 +1483,7 @@ typedef struct bfd_arch_info const char *arch_name; const char *printable_name; unsigned int section_align_power; - /* true if this is the default machine for the architecture */ + /* True if this is the default machine for the architecture. */ boolean the_default; const struct bfd_arch_info * (*compatible) PARAMS ((const struct bfd_arch_info *a, @@ -1543,28 +1544,28 @@ bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch, typedef enum bfd_reloc_status { - /* No errors detected */ + /* No errors detected */ bfd_reloc_ok, - /* The relocation was performed, but there was an overflow. */ + /* The relocation was performed, but there was an overflow. */ bfd_reloc_overflow, - /* The address to relocate was not within the section supplied. */ + /* The address to relocate was not within the section supplied. */ bfd_reloc_outofrange, - /* Used by special functions */ + /* Used by special functions */ bfd_reloc_continue, - /* Unsupported relocation size requested. */ + /* Unsupported relocation size requested. */ bfd_reloc_notsupported, - /* Unused */ + /* Unused */ bfd_reloc_other, - /* The symbol to relocate against was undefined. */ + /* The symbol to relocate against was undefined. */ bfd_reloc_undefined, - /* The relocation was performed, but may not be ok - presently + /* The relocation was performed, but may not be ok - presently generated only when linking i960 coff files with i960 b.out symbols. If this type is returned, the error_message argument to bfd_perform_relocation will be set. */ @@ -1575,40 +1576,40 @@ typedef enum bfd_reloc_status typedef struct reloc_cache_entry { - /* A pointer into the canonical table of pointers */ + /* A pointer into the canonical table of pointers */ struct symbol_cache_entry **sym_ptr_ptr; - /* offset in section */ + /* offset in section */ bfd_size_type address; - /* addend for relocation value */ + /* addend for relocation value */ bfd_vma addend; - /* Pointer to how to perform the required relocation */ + /* Pointer to how to perform the required relocation */ reloc_howto_type *howto; } arelent; enum complain_overflow { - /* Do not complain on overflow. */ + /* Do not complain on overflow. */ complain_overflow_dont, - /* Complain if the bitfield overflows, whether it is considered + /* Complain if the bitfield overflows, whether it is considered as signed or unsigned. */ complain_overflow_bitfield, - /* Complain if the value overflows when considered as signed + /* Complain if the value overflows when considered as signed number. */ complain_overflow_signed, - /* Complain if the value overflows when considered as an + /* Complain if the value overflows when considered as an unsigned number. */ complain_overflow_unsigned }; struct reloc_howto_struct { - /* The type field has mainly a documentary use - the back end can + /* The type field has mainly a documentary use - the back end can do what it wants with it, though normally the back end's external idea of what a reloc number is stored in this field. For example, a PC relative word relocation @@ -1616,34 +1617,34 @@ struct reloc_howto_struct what the outside world calls a R_PCRWORD reloc. */ unsigned int type; - /* The value the final relocation is shifted right by. This drops + /* The value the final relocation is shifted right by. This drops unwanted data from the relocation. */ unsigned int rightshift; - /* The size of the item to be relocated. This is *not* a + /* The size of the item to be relocated. This is *not* a power-of-two measure. To get the number of bytes operated on by a type of relocation, use bfd_get_reloc_size. */ int size; - /* The number of bits in the item to be relocated. This is used + /* The number of bits in the item to be relocated. This is used when doing overflow checking. */ unsigned int bitsize; - /* Notes that the relocation is relative to the location in the + /* Notes that the relocation is relative to the location in the data section of the addend. The relocation function will subtract from the relocation value the address of the location being relocated. */ boolean pc_relative; - /* The bit position of the reloc value in the destination. + /* The bit position of the reloc value in the destination. The relocated value is left shifted by this amount. */ unsigned int bitpos; - /* What type of overflow error should be checked for when + /* What type of overflow error should be checked for when relocating. */ enum complain_overflow complain_on_overflow; - /* If this field is non null, then the supplied function is + /* If this field is non null, then the supplied function is called rather than the normal function. This allows really strange relocation methods to be accomodated (e.g., i960 callj instructions). */ @@ -1656,10 +1657,10 @@ struct reloc_howto_struct bfd *output_bfd, char **error_message)); - /* The textual name of the relocation type. */ + /* The textual name of the relocation type. */ char *name; - /* Some formats record a relocation addend in the section contents + /* Some formats record a relocation addend in the section contents rather than with the relocation. For ELF formats this is the distinction between USE_REL and USE_RELA (though the code checks for USE_REL == 1/0). The value of this field is TRUE if the @@ -1676,7 +1677,7 @@ struct reloc_howto_struct links (e.g. GOT stuff) it doesn't matter what this is set to. */ boolean partial_inplace; - /* The src_mask selects which parts of the read in data + /* The src_mask selects which parts of the read in data are to be used in the relocation sum. E.g., if this was an 8 bit byte of data which we read and relocated, this would be 0x000000ff. When we have relocs which have an addend, such as @@ -1685,13 +1686,13 @@ struct reloc_howto_struct the mask would be 0x00000000. */ bfd_vma src_mask; - /* The dst_mask selects which parts of the instruction are replaced + /* The dst_mask selects which parts of the instruction are replaced into the instruction. In most cases src_mask == dst_mask, except in the above special case, where dst_mask would be 0x000000ff, and src_mask would be 0x00000000. */ bfd_vma dst_mask; - /* When some formats create PC relative instructions, they leave + /* When some formats create PC relative instructions, they leave the value of the pc of the place being relocated in the offset slot of the instruction, so that a PC relative relocation can be made just by adding in an ordinary offset (e.g., sun3 a.out). @@ -2572,7 +2573,7 @@ bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code)); typedef struct symbol_cache_entry { - /* A pointer to the BFD which owns the symbol. This information + /* A pointer to the BFD which owns the symbol. This information is necessary so that a back end can work out what additional information (invisible to the application writer) is carried with the symbol. @@ -2582,65 +2583,65 @@ typedef struct symbol_cache_entry bfd_{abs,com,und}_section. This could be fixed by making these globals be per-bfd (or per-target-flavor). FIXME. */ - struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ + struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ - /* The text of the symbol. The name is left alone, and not copied; the + /* The text of the symbol. The name is left alone, and not copied; the application may not alter it. */ CONST char *name; - /* The value of the symbol. This really should be a union of a + /* The value of the symbol. This really should be a union of a numeric value with a pointer, since some flags indicate that a pointer to another symbol is stored here. */ symvalue value; - /* Attributes of a symbol: */ + /* Attributes of a symbol: */ #define BSF_NO_FLAGS 0x00 - /* The symbol has local scope; <<static>> in <<C>>. The value + /* The symbol has local scope; <<static>> in <<C>>. The value is the offset into the section of the data. */ #define BSF_LOCAL 0x01 - /* The symbol has global scope; initialized data in <<C>>. The + /* The symbol has global scope; initialized data in <<C>>. The value is the offset into the section of the data. */ #define BSF_GLOBAL 0x02 - /* The symbol has global scope and is exported. The value is + /* The symbol has global scope and is exported. The value is the offset into the section of the data. */ -#define BSF_EXPORT BSF_GLOBAL /* no real difference */ +#define BSF_EXPORT BSF_GLOBAL /* no real difference */ - /* A normal C symbol would be one of: + /* A normal C symbol would be one of: <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or <<BSF_GLOBAL>> */ - /* The symbol is a debugging record. The value has an arbitary + /* The symbol is a debugging record. The value has an arbitary meaning, unless BSF_DEBUGGING_RELOC is also set. */ #define BSF_DEBUGGING 0x08 - /* The symbol denotes a function entry point. Used in ELF, + /* The symbol denotes a function entry point. Used in ELF, perhaps others someday. */ #define BSF_FUNCTION 0x10 - /* Used by the linker. */ + /* Used by the linker. */ #define BSF_KEEP 0x20 #define BSF_KEEP_G 0x40 - /* A weak global symbol, overridable without warnings by + /* A weak global symbol, overridable without warnings by a regular global symbol of the same name. */ #define BSF_WEAK 0x80 - /* This symbol was created to point to a section, e.g. ELF's + /* This symbol was created to point to a section, e.g. ELF's STT_SECTION symbols. */ #define BSF_SECTION_SYM 0x100 - /* The symbol used to be a common symbol, but now it is + /* The symbol used to be a common symbol, but now it is allocated. */ #define BSF_OLD_COMMON 0x200 - /* The default value for common data. */ + /* The default value for common data. */ #define BFD_FORT_COMM_DEFAULT_VALUE 0 - /* In some files the type of a symbol sometimes alters its + /* In some files the type of a symbol sometimes alters its location in an output file - ie in coff a <<ISFCN>> symbol which is also <<C_EXT>> symbol appears where it was declared and not at the end of a section. This bit is set @@ -2648,43 +2649,43 @@ typedef struct symbol_cache_entry #define BSF_NOT_AT_END 0x400 - /* Signal that the symbol is the label of constructor section. */ + /* Signal that the symbol is the label of constructor section. */ #define BSF_CONSTRUCTOR 0x800 - /* Signal that the symbol is a warning symbol. The name is a + /* Signal that the symbol is a warning symbol. The name is a warning. The name of the next symbol is the one to warn about; if a reference is made to a symbol with the same name as the next symbol, a warning is issued by the linker. */ #define BSF_WARNING 0x1000 - /* Signal that the symbol is indirect. This symbol is an indirect + /* Signal that the symbol is indirect. This symbol is an indirect pointer to the symbol with the same name as the next symbol. */ #define BSF_INDIRECT 0x2000 - /* BSF_FILE marks symbols that contain a file name. This is used + /* BSF_FILE marks symbols that contain a file name. This is used for ELF STT_FILE symbols. */ #define BSF_FILE 0x4000 - /* Symbol is from dynamic linking information. */ + /* Symbol is from dynamic linking information. */ #define BSF_DYNAMIC 0x8000 - /* The symbol denotes a data object. Used in ELF, and perhaps + /* The symbol denotes a data object. Used in ELF, and perhaps others someday. */ #define BSF_OBJECT 0x10000 - /* This symbol is a debugging symbol. The value is the offset + /* This symbol is a debugging symbol. The value is the offset into the section of the data. BSF_DEBUGGING should be set as well. */ #define BSF_DEBUGGING_RELOC 0x20000 flagword flags; - /* A pointer to the section to which this symbol is + /* A pointer to the section to which this symbol is relative. This will always be non NULL, there are special sections for undefined and absolute symbols. */ struct sec *section; - /* Back end special data. */ + /* Back end special data. */ union { PTR p; @@ -2732,13 +2733,13 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb (ibfd, isymbol, obfd, osymbol)) struct _bfd { - /* The filename the application opened the BFD with. */ + /* The filename the application opened the BFD with. */ CONST char *filename; - /* A pointer to the target jump table. */ + /* A pointer to the target jump table. */ const struct bfd_target *xvec; - /* To avoid dragging too many header files into every file that + /* To avoid dragging too many header files into every file that includes `<<bfd.h>>', IOSTREAM has been declared as a "char *", and MTIME as a "long". Their correct types, to which they are cast when used, are "FILE *" and "time_t". The iostream @@ -2747,103 +2748,103 @@ struct _bfd to a bfd_in_memory struct. */ PTR iostream; - /* Is the file descriptor being cached? That is, can it be closed as + /* Is the file descriptor being cached? That is, can it be closed as needed, and re-opened when accessed later? */ boolean cacheable; - /* Marks whether there was a default target specified when the + /* Marks whether there was a default target specified when the BFD was opened. This is used to select which matching algorithm to use to choose the back end. */ boolean target_defaulted; - /* The caching routines use these to maintain a + /* The caching routines use these to maintain a least-recently-used list of BFDs */ struct _bfd *lru_prev, *lru_next; - /* When a file is closed by the caching routines, BFD retains + /* When a file is closed by the caching routines, BFD retains state information on the file here: */ file_ptr where; - /* and here: (``once'' means at least once) */ + /* and here: (``once'' means at least once) */ boolean opened_once; - /* Set if we have a locally maintained mtime value, rather than + /* Set if we have a locally maintained mtime value, rather than getting it from the file each time: */ boolean mtime_set; - /* File modified time, if mtime_set is true: */ + /* File modified time, if mtime_set is true: */ long mtime; - /* Reserved for an unimplemented file locking extension.*/ + /* Reserved for an unimplemented file locking extension.*/ int ifd; - /* The format which belongs to the BFD. (object, core, etc.) */ + /* The format which belongs to the BFD. (object, core, etc.) */ bfd_format format; - /* The direction the BFD was opened with*/ + /* The direction the BFD was opened with*/ enum bfd_direction {no_direction = 0, read_direction = 1, write_direction = 2, both_direction = 3} direction; - /* Format_specific flags*/ + /* Format_specific flags*/ flagword flags; - /* Currently my_archive is tested before adding origin to + /* Currently my_archive is tested before adding origin to anything. I believe that this can become always an add of origin, with origin set to 0 for non archive files. */ file_ptr origin; - /* Remember when output has begun, to stop strange things + /* Remember when output has begun, to stop strange things from happening. */ boolean output_has_begun; - /* Pointer to linked list of sections*/ + /* Pointer to linked list of sections*/ struct sec *sections; - /* The number of sections */ + /* The number of sections */ unsigned int section_count; - /* Stuff only useful for object files: + /* Stuff only useful for object files: The start address. */ bfd_vma start_address; - /* Used for input and output*/ + /* Used for input and output*/ unsigned int symcount; - /* Symbol table for output BFD (with symcount entries) */ + /* Symbol table for output BFD (with symcount entries) */ struct symbol_cache_entry **outsymbols; - /* Pointer to structure which contains architecture information*/ + /* Pointer to structure which contains architecture information*/ const struct bfd_arch_info *arch_info; - /* Stuff only useful for archives:*/ + /* Stuff only useful for archives:*/ PTR arelt_data; - struct _bfd *my_archive; /* The containing archive BFD. */ - struct _bfd *next; /* The next BFD in the archive. */ - struct _bfd *archive_head; /* The first BFD in the archive. */ + struct _bfd *my_archive; /* The containing archive BFD. */ + struct _bfd *next; /* The next BFD in the archive. */ + struct _bfd *archive_head; /* The first BFD in the archive. */ boolean has_armap; - /* A chain of BFD structures involved in a link. */ + /* A chain of BFD structures involved in a link. */ struct _bfd *link_next; - /* A field used by _bfd_generic_link_add_archive_symbols. This will + /* A field used by _bfd_generic_link_add_archive_symbols. This will be used only for archive elements. */ int archive_pass; - /* Used by the back end to hold private data. */ + /* Used by the back end to hold private data. */ union { @@ -2878,10 +2879,10 @@ struct _bfd PTR any; } tdata; - /* Used by the application to hold private data*/ + /* Used by the application to hold private data*/ PTR usrdata; - /* Where all the allocated stuff under this BFD goes. This is a + /* Where all the allocated stuff under this BFD goes. This is a struct objalloc *, but we use PTR to avoid requiring the inclusion of objalloc.h. */ PTR memory; @@ -2994,7 +2995,7 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) - /* Do these three do anything useful at all, for any back end? */ + /* Do these three do anything useful at all, for any back end? */ #define bfd_debug_info_start(abfd) \ BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) @@ -3114,7 +3115,7 @@ enum bfd_flavour { enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; - /* Forward declaration. */ +/* Forward declaration. */ typedef struct bfd_link_info _bfd_link_info; typedef struct bfd_target @@ -3150,7 +3151,7 @@ typedef struct bfd_target boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); - /* Generic entry points. */ + /* Generic entry points. */ #define BFD_JUMP_TABLE_GENERIC(NAME)\ CAT(NAME,_close_and_cleanup),\ CAT(NAME,_bfd_free_cached_info),\ @@ -3158,20 +3159,20 @@ CAT(NAME,_new_section_hook),\ CAT(NAME,_get_section_contents),\ CAT(NAME,_get_section_contents_in_window) - /* Called when the BFD is being closed to do any necessary cleanup. */ + /* Called when the BFD is being closed to do any necessary cleanup. */ boolean (*_close_and_cleanup) PARAMS ((bfd *)); - /* Ask the BFD to free all cached information. */ + /* Ask the BFD to free all cached information. */ boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); - /* Called when a new section is created. */ + /* Called when a new section is created. */ boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); - /* Read the contents of a section. */ + /* Read the contents of a section. */ boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); boolean (*_bfd_get_section_contents_in_window) PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type)); - /* Entry points to copy private data. */ + /* Entry points to copy private data. */ #define BFD_JUMP_TABLE_COPY(NAME)\ CAT(NAME,_bfd_copy_private_bfd_data),\ CAT(NAME,_bfd_merge_private_bfd_data),\ @@ -3179,27 +3180,27 @@ CAT(NAME,_bfd_copy_private_section_data),\ CAT(NAME,_bfd_copy_private_symbol_data),\ CAT(NAME,_bfd_set_private_flags),\ CAT(NAME,_bfd_print_private_bfd_data)\ - /* Called to copy BFD general private data from one object file + /* Called to copy BFD general private data from one object file to another. */ boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); - /* Called to merge BFD general private data from one object file + /* Called to merge BFD general private data from one object file to a common output file when linking. */ boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); - /* Called to copy BFD private section data from one object file + /* Called to copy BFD private section data from one object file to another. */ boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, bfd *, sec_ptr)); - /* Called to copy BFD private symbol data from one symbol + /* Called to copy BFD private symbol data from one symbol to another. */ boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); - /* Called to set private backend flags */ + /* Called to set private backend flags */ boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); - /* Called to print private BFD data */ + /* Called to print private BFD data */ boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); - /* Core file entry points. */ + /* Core file entry points. */ #define BFD_JUMP_TABLE_CORE(NAME)\ CAT(NAME,_core_file_failing_command),\ CAT(NAME,_core_file_failing_signal),\ @@ -3208,7 +3209,7 @@ CAT(NAME,_core_file_matches_executable_p) int (*_core_file_failing_signal) PARAMS ((bfd *)); boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); - /* Archive entry points. */ + /* Archive entry points. */ #define BFD_JUMP_TABLE_ARCHIVE(NAME)\ CAT(NAME,_slurp_armap),\ CAT(NAME,_slurp_extended_name_table),\ @@ -3237,7 +3238,7 @@ CAT(NAME,_update_armap_timestamp) int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); - /* Entry points used for symbols. */ + /* Entry points used for symbols. */ #define BFD_JUMP_TABLE_SYMBOLS(NAME)\ CAT(NAME,_get_symtab_upper_bound),\ CAT(NAME,_get_symtab),\ @@ -3270,7 +3271,7 @@ CAT(NAME,_minisymbol_to_symbol) struct sec *section, struct symbol_cache_entry **symbols, bfd_vma offset, CONST char **file, CONST char **func, unsigned int *line)); - /* Back-door to allow format-aware applications to create debug symbols + /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ asymbol * (*_bfd_make_debug_symbol) PARAMS (( @@ -3286,7 +3287,7 @@ CAT(NAME,_minisymbol_to_symbol) asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR, asymbol *)); - /* Routines for relocs. */ + /* Routines for relocs. */ #define BFD_JUMP_TABLE_RELOCS(NAME)\ CAT(NAME,_get_reloc_upper_bound),\ CAT(NAME,_canonicalize_reloc),\ @@ -3294,12 +3295,12 @@ CAT(NAME,_bfd_reloc_type_lookup) long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry **)); - /* See documentation on reloc types. */ + /* See documentation on reloc types. */ reloc_howto_type * (*reloc_type_lookup) PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); - /* Routines used when writing an object file. */ + /* Routines used when writing an object file. */ #define BFD_JUMP_TABLE_WRITE(NAME)\ CAT(NAME,_set_arch_mach),\ CAT(NAME,_set_section_contents) @@ -3308,7 +3309,7 @@ CAT(NAME,_set_section_contents) boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); - /* Routines used by the linker. */ + /* Routines used by the linker. */ #define BFD_JUMP_TABLE_LINK(NAME)\ CAT(NAME,_sizeof_headers),\ CAT(NAME,_bfd_get_relocated_section_contents),\ @@ -3327,41 +3328,41 @@ CAT(NAME,_bfd_gc_sections) boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *again)); - /* Create a hash table for the linker. Different backends store + /* Create a hash table for the linker. Different backends store different information in this table. */ struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *)); - /* Add symbols from this object file into the hash table. */ + /* Add symbols from this object file into the hash table. */ boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); - /* Do a link based on the link_order structures attached to each + /* Do a link based on the link_order structures attached to each section of the BFD. */ boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); - /* Should this section be split up into smaller pieces during linking. */ + /* Should this section be split up into smaller pieces during linking. */ boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); - /* Remove sections that are not referenced from the output. */ + /* Remove sections that are not referenced from the output. */ boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); - /* Routines to handle dynamic symbols and relocs. */ + /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME)\ CAT(NAME,_get_dynamic_symtab_upper_bound),\ CAT(NAME,_canonicalize_dynamic_symtab),\ CAT(NAME,_get_dynamic_reloc_upper_bound),\ CAT(NAME,_canonicalize_dynamic_reloc) - /* Get the amount of memory required to hold the dynamic symbols. */ + /* Get the amount of memory required to hold the dynamic symbols. */ long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); - /* Read in the dynamic symbols. */ + /* Read in the dynamic symbols. */ long (*_bfd_canonicalize_dynamic_symtab) PARAMS ((bfd *, struct symbol_cache_entry **)); - /* Get the amount of memory required to hold the dynamic relocs. */ + /* Get the amount of memory required to hold the dynamic relocs. */ long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); - /* Read in the dynamic relocs. */ + /* Read in the dynamic relocs. */ long (*_bfd_canonicalize_dynamic_reloc) PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); - /* Opposite endian version of this target. */ + /* Opposite endian version of this target. */ const struct bfd_target * alternative_target; PTR backend_data; diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index fe5c8226a14..2980f0f3989 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1013,8 +1013,8 @@ extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long)); extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, - bfd_vma, CONST char **, - CONST char **, + bfd_vma, const char **, + const char **, unsigned int *)); #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index aece1e15a51..87a5c330b82 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -59,9 +59,9 @@ struct artdata { file_ptr first_file_filepos; /* Speed up searching the armap */ struct ar_cache *cache; - bfd *archive_head; /* Only interesting in output routines */ + bfd *archive_head; /* Only interesting in output routines */ carsym *symdefs; /* the symdef entries */ - symindex symdef_count; /* how many there are */ + symindex symdef_count; /* how many there are */ char *extended_names; /* clever intel extension */ /* when more compilers are standard C, this can be a time_t */ long armap_timestamp; /* Timestamp value written into armap. @@ -79,9 +79,9 @@ struct artdata { /* Goes in bfd's arelt_data slot */ struct areltdata { - char * arch_header; /* it's actually a string */ - unsigned int parsed_size; /* octets of filesize not including ar_hdr */ - char *filename; /* null-terminated */ + char * arch_header; /* it's actually a string */ + unsigned int parsed_size; /* octets of filesize not including ar_hdr */ + char *filename; /* null-terminated */ }; #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) @@ -128,11 +128,11 @@ void bfd_void PARAMS ((bfd *ignore)); bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *)); const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd)); -void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, +void bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename, char *hdr)); -void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, +void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename, char *hdr)); -void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, +void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename, char *hdr)); boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, diff --git a/bfd/libbfd.h b/bfd/libbfd.h index d7e77308e1e..1ad41379711 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -59,9 +59,9 @@ struct artdata { file_ptr first_file_filepos; /* Speed up searching the armap */ struct ar_cache *cache; - bfd *archive_head; /* Only interesting in output routines */ + bfd *archive_head; /* Only interesting in output routines */ carsym *symdefs; /* the symdef entries */ - symindex symdef_count; /* how many there are */ + symindex symdef_count; /* how many there are */ char *extended_names; /* clever intel extension */ /* when more compilers are standard C, this can be a time_t */ long armap_timestamp; /* Timestamp value written into armap. @@ -79,9 +79,9 @@ struct artdata { /* Goes in bfd's arelt_data slot */ struct areltdata { - char * arch_header; /* it's actually a string */ - unsigned int parsed_size; /* octets of filesize not including ar_hdr */ - char *filename; /* null-terminated */ + char * arch_header; /* it's actually a string */ + unsigned int parsed_size; /* octets of filesize not including ar_hdr */ + char *filename; /* null-terminated */ }; #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) @@ -128,11 +128,11 @@ void bfd_void PARAMS ((bfd *ignore)); bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *)); const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd)); -void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, +void bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename, char *hdr)); -void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, +void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename, char *hdr)); -void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, +void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename, char *hdr)); boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 78a03e15b59..9cf52e85471 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -578,32 +578,32 @@ extern boolean ppc_process_before_allocation typedef struct coff_ptr_struct { - /* Remembers the offset from the first symbol in the file for + /* Remembers the offset from the first symbol in the file for this symbol. Generated by coff_renumber_symbols. */ unsigned int offset; - /* Should the value of this symbol be renumbered. Used for + /* Should the value of this symbol be renumbered. Used for XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ unsigned int fix_value : 1; - /* Should the tag field of this symbol be renumbered. + /* Should the tag field of this symbol be renumbered. Created by coff_pointerize_aux. */ unsigned int fix_tag : 1; - /* Should the endidx field of this symbol be renumbered. + /* Should the endidx field of this symbol be renumbered. Created by coff_pointerize_aux. */ unsigned int fix_end : 1; - /* Should the x_csect.x_scnlen field be renumbered. + /* Should the x_csect.x_scnlen field be renumbered. Created by coff_pointerize_aux. */ unsigned int fix_scnlen : 1; - /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the index into the line number entries. Set by coff_slurp_symbol_table. */ unsigned int fix_line : 1; - /* The container for the symbol structure as read and translated + /* The container for the symbol structure as read and translated from the file. */ union { @@ -613,35 +613,35 @@ union { } combined_entry_type; - /* Each canonical asymbol really looks like this: */ +/* Each canonical asymbol really looks like this: */ typedef struct coff_symbol_struct { - /* The actual symbol which the rest of BFD works with */ + /* The actual symbol which the rest of BFD works with */ asymbol symbol; - /* A pointer to the hidden information for this symbol */ + /* A pointer to the hidden information for this symbol */ combined_entry_type *native; - /* A pointer to the linenumber information for this symbol */ + /* A pointer to the linenumber information for this symbol */ struct lineno_cache_entry *lineno; - /* Have the line numbers been relocated yet ? */ + /* Have the line numbers been relocated yet ? */ boolean done_lineno; } coff_symbol_type; - /* COFF symbol classifications. */ +/* COFF symbol classifications. */ enum coff_symbol_classification { - /* Global symbol. */ + /* Global symbol. */ COFF_SYMBOL_GLOBAL, - /* Common symbol. */ + /* Common symbol. */ COFF_SYMBOL_COMMON, - /* Undefined symbol. */ + /* Undefined symbol. */ COFF_SYMBOL_UNDEFINED, - /* Local symbol. */ + /* Local symbol. */ COFF_SYMBOL_LOCAL, - /* PE section symbol. */ + /* PE section symbol. */ COFF_SYMBOL_PE_SECTION }; diff --git a/bfd/section.c b/bfd/section.c index be881d84264..3b5162983e2 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1,5 +1,5 @@ /* Object file "section" support for the BFD library. - Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999 + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. Written by Cygnus Support. @@ -150,10 +150,10 @@ SUBSECTION CODE_FRAGMENT . -. {* This structure is used for a comdat section, as in PE. A comdat -. section is associated with a particular symbol. When the linker -. sees a comdat section, it keeps only one of the sections with a -. given name and associated with a given symbol. *} +.{* This structure is used for a comdat section, as in PE. A comdat +. section is associated with a particular symbol. When the linker +. sees a comdat section, it keeps only one of the sections with a +. given name and associated with a given symbol. *} . .struct bfd_comdat_info .{ @@ -173,342 +173,343 @@ CODE_FRAGMENT . .typedef struct sec .{ -. {* The name of the section; the name isn't a copy, the pointer is -. the same as that passed to bfd_make_section. *} +. {* The name of the section; the name isn't a copy, the pointer is +. the same as that passed to bfd_make_section. *} . -. CONST char *name; +. const char *name; +. +. {* A unique sequence number. *} +. +. int id; . -. {* Which section is it; 0..nth. *} +. {* Which section is it; 0..nth. *} . -. int index; +. int index; . -. {* The next section in the list belonging to the BFD, or NULL. *} +. {* The next section in the list belonging to the BFD, or NULL. *} . -. struct sec *next; +. struct sec *next; . -. {* The field flags contains attributes of the section. Some -. flags are read in from the object file, and some are -. synthesized from other information. *} +. {* The field flags contains attributes of the section. Some +. flags are read in from the object file, and some are +. synthesized from other information. *} . -. flagword flags; +. flagword flags; . .#define SEC_NO_FLAGS 0x000 . -. {* Tells the OS to allocate space for this section when loading. -. This is clear for a section containing debug information -. only. *} +. {* Tells the OS to allocate space for this section when loading. +. This is clear for a section containing debug information only. *} .#define SEC_ALLOC 0x001 . -. {* Tells the OS to load the section from the file when loading. -. This is clear for a .bss section. *} +. {* Tells the OS to load the section from the file when loading. +. This is clear for a .bss section. *} .#define SEC_LOAD 0x002 . -. {* The section contains data still to be relocated, so there is -. some relocation information too. *} +. {* The section contains data still to be relocated, so there is +. some relocation information too. *} .#define SEC_RELOC 0x004 . .#if 0 {* Obsolete ? *} .#define SEC_BALIGN 0x008 .#endif . -. {* A signal to the OS that the section contains read only -. data. *} +. {* A signal to the OS that the section contains read only data. *} .#define SEC_READONLY 0x010 . -. {* The section contains code only. *} +. {* The section contains code only. *} .#define SEC_CODE 0x020 . -. {* The section contains data only. *} +. {* The section contains data only. *} .#define SEC_DATA 0x040 . -. {* The section will reside in ROM. *} +. {* The section will reside in ROM. *} .#define SEC_ROM 0x080 . -. {* The section contains constructor information. This section -. type is used by the linker to create lists of constructors and -. destructors used by <<g++>>. When a back end sees a symbol -. which should be used in a constructor list, it creates a new -. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches -. the symbol to it, and builds a relocation. To build the lists -. of constructors, all the linker has to do is catenate all the -. sections called <<__CTOR_LIST__>> and relocate the data -. contained within - exactly the operations it would peform on -. standard data. *} +. {* The section contains constructor information. This section +. type is used by the linker to create lists of constructors and +. destructors used by <<g++>>. When a back end sees a symbol +. which should be used in a constructor list, it creates a new +. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches +. the symbol to it, and builds a relocation. To build the lists +. of constructors, all the linker has to do is catenate all the +. sections called <<__CTOR_LIST__>> and relocate the data +. contained within - exactly the operations it would peform on +. standard data. *} .#define SEC_CONSTRUCTOR 0x100 . -. {* The section is a constructor, and should be placed at the -. end of the text, data, or bss section(?). *} +. {* The section is a constructor, and should be placed at the +. end of the text, data, or bss section(?). *} .#define SEC_CONSTRUCTOR_TEXT 0x1100 .#define SEC_CONSTRUCTOR_DATA 0x2100 .#define SEC_CONSTRUCTOR_BSS 0x3100 . -. {* The section has contents - a data section could be -. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be -. <<SEC_HAS_CONTENTS>> *} +. {* The section has contents - a data section could be +. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be +. <<SEC_HAS_CONTENTS>> *} .#define SEC_HAS_CONTENTS 0x200 . -. {* An instruction to the linker to not output the section -. even if it has information which would normally be written. *} +. {* An instruction to the linker to not output the section +. even if it has information which would normally be written. *} .#define SEC_NEVER_LOAD 0x400 . -. {* The section is a COFF shared library section. This flag is -. only for the linker. If this type of section appears in -. the input file, the linker must copy it to the output file -. without changing the vma or size. FIXME: Although this -. was originally intended to be general, it really is COFF -. specific (and the flag was renamed to indicate this). It -. might be cleaner to have some more general mechanism to -. allow the back end to control what the linker does with -. sections. *} +. {* The section is a COFF shared library section. This flag is +. only for the linker. If this type of section appears in +. the input file, the linker must copy it to the output file +. without changing the vma or size. FIXME: Although this +. was originally intended to be general, it really is COFF +. specific (and the flag was renamed to indicate this). It +. might be cleaner to have some more general mechanism to +. allow the back end to control what the linker does with +. sections. *} .#define SEC_COFF_SHARED_LIBRARY 0x800 . -. {* The section contains common symbols (symbols may be defined -. multiple times, the value of a symbol is the amount of -. space it requires, and the largest symbol value is the one -. used). Most targets have exactly one of these (which we -. translate to bfd_com_section_ptr), but ECOFF has two. *} +. {* The section contains common symbols (symbols may be defined +. multiple times, the value of a symbol is the amount of +. space it requires, and the largest symbol value is the one +. used). Most targets have exactly one of these (which we +. translate to bfd_com_section_ptr), but ECOFF has two. *} .#define SEC_IS_COMMON 0x8000 . -. {* The section contains only debugging information. For -. example, this is set for ELF .debug and .stab sections. -. strip tests this flag to see if a section can be -. discarded. *} +. {* The section contains only debugging information. For +. example, this is set for ELF .debug and .stab sections. +. strip tests this flag to see if a section can be +. discarded. *} .#define SEC_DEBUGGING 0x10000 . -. {* The contents of this section are held in memory pointed to -. by the contents field. This is checked by -. bfd_get_section_contents, and the data is retrieved from -. memory if appropriate. *} +. {* The contents of this section are held in memory pointed to +. by the contents field. This is checked by bfd_get_section_contents, +. and the data is retrieved from memory if appropriate. *} .#define SEC_IN_MEMORY 0x20000 . -. {* The contents of this section are to be excluded by the -. linker for executable and shared objects unless those -. objects are to be further relocated. *} +. {* The contents of this section are to be excluded by the +. linker for executable and shared objects unless those +. objects are to be further relocated. *} .#define SEC_EXCLUDE 0x40000 . -. {* The contents of this section are to be sorted by the -. based on the address specified in the associated symbol -. table. *} +. {* The contents of this section are to be sorted by the +. based on the address specified in the associated symbol +. table. *} .#define SEC_SORT_ENTRIES 0x80000 . -. {* When linking, duplicate sections of the same name should be -. discarded, rather than being combined into a single section as -. is usually done. This is similar to how common symbols are -. handled. See SEC_LINK_DUPLICATES below. *} +. {* When linking, duplicate sections of the same name should be +. discarded, rather than being combined into a single section as +. is usually done. This is similar to how common symbols are +. handled. See SEC_LINK_DUPLICATES below. *} .#define SEC_LINK_ONCE 0x100000 . -. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker -. should handle duplicate sections. *} +. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker +. should handle duplicate sections. *} .#define SEC_LINK_DUPLICATES 0x600000 . -. {* This value for SEC_LINK_DUPLICATES means that duplicate -. sections with the same name should simply be discarded. *} +. {* This value for SEC_LINK_DUPLICATES means that duplicate +. sections with the same name should simply be discarded. *} .#define SEC_LINK_DUPLICATES_DISCARD 0x0 . -. {* This value for SEC_LINK_DUPLICATES means that the linker -. should warn if there are any duplicate sections, although -. it should still only link one copy. *} +. {* This value for SEC_LINK_DUPLICATES means that the linker +. should warn if there are any duplicate sections, although +. it should still only link one copy. *} .#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 . -. {* This value for SEC_LINK_DUPLICATES means that the linker -. should warn if any duplicate sections are a different size. *} +. {* This value for SEC_LINK_DUPLICATES means that the linker +. should warn if any duplicate sections are a different size. *} .#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 . -. {* This value for SEC_LINK_DUPLICATES means that the linker -. should warn if any duplicate sections contain different -. contents. *} +. {* This value for SEC_LINK_DUPLICATES means that the linker +. should warn if any duplicate sections contain different +. contents. *} .#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 . -. {* This section was created by the linker as part of dynamic -. relocation or other arcane processing. It is skipped when -. going through the first-pass output, trusting that someone -. else up the line will take care of it later. *} +. {* This section was created by the linker as part of dynamic +. relocation or other arcane processing. It is skipped when +. going through the first-pass output, trusting that someone +. else up the line will take care of it later. *} .#define SEC_LINKER_CREATED 0x800000 . -. {* This section should not be subject to garbage collection. *} +. {* This section should not be subject to garbage collection. *} .#define SEC_KEEP 0x1000000 . -. {* This section contains "short" data, and should be placed -. "near" the GP. *} +. {* This section contains "short" data, and should be placed +. "near" the GP. *} .#define SEC_SMALL_DATA 0x2000000 . -. {* This section contains data which may be shared with other -. executables or shared objects. *} +. {* This section contains data which may be shared with other +. executables or shared objects. *} .#define SEC_SHARED 0x4000000 . -. {* When a section with this flag is being linked, then if the size of -. the input section is less than a page, it should not cross a page -. boundary. If the size of the input section is one page or more, it -. should be aligned on a page boundary. *} +. {* When a section with this flag is being linked, then if the size of +. the input section is less than a page, it should not cross a page +. boundary. If the size of the input section is one page or more, it +. should be aligned on a page boundary. *} .#define SEC_BLOCK 0x8000000 . -. {* Conditionally link this section; do not link if there are no -. references found to any symbol in the section. *} +. {* Conditionally link this section; do not link if there are no +. references found to any symbol in the section. *} .#define SEC_CLINK 0x10000000 . -. {* End of section flags. *} +. {* End of section flags. *} . -. {* Some internal packed boolean fields. *} +. {* Some internal packed boolean fields. *} . -. {* See the vma field. *} -. unsigned int user_set_vma : 1; +. {* See the vma field. *} +. unsigned int user_set_vma : 1; . -. {* Whether relocations have been processed. *} -. unsigned int reloc_done : 1; +. {* Whether relocations have been processed. *} +. unsigned int reloc_done : 1; . -. {* A mark flag used by some of the linker backends. *} -. unsigned int linker_mark : 1; +. {* A mark flag used by some of the linker backends. *} +. unsigned int linker_mark : 1; . -. {* A mark flag used by some linker backends for garbage collection. *} -. unsigned int gc_mark : 1; +. {* A mark flag used by some linker backends for garbage collection. *} +. unsigned int gc_mark : 1; . -. {* End of internal packed boolean fields. *} +. {* End of internal packed boolean fields. *} . -. {* The virtual memory address of the section - where it will be -. at run time. The symbols are relocated against this. The -. user_set_vma flag is maintained by bfd; if it's not set, the -. backend can assign addresses (for example, in <<a.out>>, where -. the default address for <<.data>> is dependent on the specific -. target and various flags). *} +. {* The virtual memory address of the section - where it will be +. at run time. The symbols are relocated against this. The +. user_set_vma flag is maintained by bfd; if it's not set, the +. backend can assign addresses (for example, in <<a.out>>, where +. the default address for <<.data>> is dependent on the specific +. target and various flags). *} . -. bfd_vma vma; +. bfd_vma vma; . -. {* The load address of the section - where it would be in a -. rom image; really only used for writing section header -. information. *} +. {* The load address of the section - where it would be in a +. rom image; really only used for writing section header +. information. *} . -. bfd_vma lma; +. bfd_vma lma; . -. {* The size of the section in octets, as it will be output. -. Contains a value even if the section has no contents (e.g., the -. size of <<.bss>>). This will be filled in after relocation. *} +. {* The size of the section in octets, as it will be output. +. Contains a value even if the section has no contents (e.g., the +. size of <<.bss>>). This will be filled in after relocation. *} . -. bfd_size_type _cooked_size; +. bfd_size_type _cooked_size; . -. {* The original size on disk of the section, in octets. Normally this -. value is the same as the size, but if some relaxing has -. been done, then this value will be bigger. *} +. {* The original size on disk of the section, in octets. Normally this +. value is the same as the size, but if some relaxing has +. been done, then this value will be bigger. *} . -. bfd_size_type _raw_size; +. bfd_size_type _raw_size; . -. {* If this section is going to be output, then this value is the -. offset in *bytes* into the output section of the first byte in the -. input section (byte ==> smallest addressable unit on the -. target). In most cases, if this was going to start at the -. 100th octet (8-bit quantity) in the output section, this value -. would be 100. However, if the target byte size is 16 bits -. (bfd_octets_per_byte is "2"), this value would be 50. *} +. {* If this section is going to be output, then this value is the +. offset in *bytes* into the output section of the first byte in the +. input section (byte ==> smallest addressable unit on the +. target). In most cases, if this was going to start at the +. 100th octet (8-bit quantity) in the output section, this value +. would be 100. However, if the target byte size is 16 bits +. (bfd_octets_per_byte is "2"), this value would be 50. *} . -. bfd_vma output_offset; +. bfd_vma output_offset; . -. {* The output section through which to map on output. *} +. {* The output section through which to map on output. *} . -. struct sec *output_section; +. struct sec *output_section; . -. {* The alignment requirement of the section, as an exponent of 2 - -. e.g., 3 aligns to 2^3 (or 8). *} +. {* The alignment requirement of the section, as an exponent of 2 - +. e.g., 3 aligns to 2^3 (or 8). *} . -. unsigned int alignment_power; +. unsigned int alignment_power; . -. {* If an input section, a pointer to a vector of relocation -. records for the data in this section. *} +. {* If an input section, a pointer to a vector of relocation +. records for the data in this section. *} . -. struct reloc_cache_entry *relocation; +. struct reloc_cache_entry *relocation; . -. {* If an output section, a pointer to a vector of pointers to -. relocation records for the data in this section. *} +. {* If an output section, a pointer to a vector of pointers to +. relocation records for the data in this section. *} . -. struct reloc_cache_entry **orelocation; +. struct reloc_cache_entry **orelocation; . -. {* The number of relocation records in one of the above *} +. {* The number of relocation records in one of the above *} . -. unsigned reloc_count; +. unsigned reloc_count; . -. {* Information below is back end specific - and not always used -. or updated. *} +. {* Information below is back end specific - and not always used +. or updated. *} . -. {* File position of section data *} +. {* File position of section data. *} . -. file_ptr filepos; +. file_ptr filepos; . -. {* File position of relocation info *} +. {* File position of relocation info. *} . -. file_ptr rel_filepos; +. file_ptr rel_filepos; . -. {* File position of line data *} +. {* File position of line data. *} . -. file_ptr line_filepos; +. file_ptr line_filepos; . -. {* Pointer to data for applications *} +. {* Pointer to data for applications. *} . -. PTR userdata; +. PTR userdata; . -. {* If the SEC_IN_MEMORY flag is set, this points to the actual -. contents. *} -. unsigned char *contents; +. {* If the SEC_IN_MEMORY flag is set, this points to the actual +. contents. *} +. unsigned char *contents; . -. {* Attached line number information *} +. {* Attached line number information. *} . -. alent *lineno; +. alent *lineno; . -. {* Number of line number records *} +. {* Number of line number records. *} . -. unsigned int lineno_count; +. unsigned int lineno_count; . -. {* Optional information about a COMDAT entry; NULL if not COMDAT *} +. {* Optional information about a COMDAT entry; NULL if not COMDAT. *} . -. struct bfd_comdat_info *comdat; +. struct bfd_comdat_info *comdat; . -. {* When a section is being output, this value changes as more -. linenumbers are written out *} +. {* When a section is being output, this value changes as more +. linenumbers are written out. *} . -. file_ptr moving_line_filepos; +. file_ptr moving_line_filepos; . -. {* What the section number is in the target world *} +. {* What the section number is in the target world. *} . -. int target_index; +. int target_index; . -. PTR used_by_bfd; +. PTR used_by_bfd; . -. {* If this is a constructor section then here is a list of the -. relocations created to relocate items within it. *} +. {* If this is a constructor section then here is a list of the +. relocations created to relocate items within it. *} . -. struct relent_chain *constructor_chain; +. struct relent_chain *constructor_chain; . -. {* The BFD which owns the section. *} +. {* The BFD which owns the section. *} . -. bfd *owner; +. bfd *owner; . -. {* A symbol which points at this section only *} -. struct symbol_cache_entry *symbol; -. struct symbol_cache_entry **symbol_ptr_ptr; +. {* A symbol which points at this section only *} +. struct symbol_cache_entry *symbol; +. struct symbol_cache_entry **symbol_ptr_ptr; . -. struct bfd_link_order *link_order_head; -. struct bfd_link_order *link_order_tail; +. struct bfd_link_order *link_order_head; +. struct bfd_link_order *link_order_tail; .} asection ; . -. {* These sections are global, and are managed by BFD. The application -. and target back end are not permitted to change the values in -. these sections. New code should use the section_ptr macros rather -. than referring directly to the const sections. The const sections -. may eventually vanish. *} +.{* These sections are global, and are managed by BFD. The application +. and target back end are not permitted to change the values in +. these sections. New code should use the section_ptr macros rather +. than referring directly to the const sections. The const sections +. may eventually vanish. *} .#define BFD_ABS_SECTION_NAME "*ABS*" .#define BFD_UND_SECTION_NAME "*UND*" .#define BFD_COM_SECTION_NAME "*COM*" .#define BFD_IND_SECTION_NAME "*IND*" . -. {* the absolute section *} +.{* the absolute section *} .extern const asection bfd_abs_section; .#define bfd_abs_section_ptr ((asection *) &bfd_abs_section) .#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) -. {* Pointer to the undefined section *} +.{* Pointer to the undefined section *} .extern const asection bfd_und_section; .#define bfd_und_section_ptr ((asection *) &bfd_und_section) .#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) -. {* Pointer to the common section *} +.{* Pointer to the common section *} .extern const asection bfd_com_section; .#define bfd_com_section_ptr ((asection *) &bfd_com_section) -. {* Pointer to the indirect section *} +.{* Pointer to the indirect section *} .extern const asection bfd_ind_section; .#define bfd_ind_section_ptr ((asection *) &bfd_ind_section) .#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) @@ -551,26 +552,35 @@ static const asymbol global_syms[] = #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \ const asection SEC = \ - /* name, index, next, flags, set_vma, reloc_done, linker_mark, gc_mark */ \ - { NAME, 0, NULL, FLAGS, 0, 0, 0, 0, \ - \ - /* vma, lma, _cooked_size, _raw_size, output_offset, output_section, */ \ - 0, 0, 0, 0, 0, (struct sec *) &SEC, \ - \ - /* alig..., reloc..., orel..., reloc_count, filepos, rel_..., line_... */ \ - 0, NULL, NULL, 0, 0, 0, 0, \ - \ - /* userdata, contents, lineno, lineno_count */ \ - NULL, NULL, NULL, 0, \ - \ - /* comdat_info, moving_line_filepos, target_index, used_by_bfd, */ \ - NULL, 0, 0, NULL, \ - \ - /* cons..., owner, symbol */ \ - NULL, NULL, (struct symbol_cache_entry *) &global_syms[IDX], \ - \ - /* symbol_ptr_ptr, link_order_head, ..._tail */ \ - (struct symbol_cache_entry **) &SYM, NULL, NULL \ + /* name, id, index, next, flags, user_set_vma, reloc_done, */ \ + { NAME, -1-(IDX), 0, NULL, FLAGS, 0, 0, \ + \ + /* linker_mark, gc_mark, vma, lma, _cooked_size, _raw_size, */ \ + 0, 0, 0, 0, 0, 0, \ + \ + /* output_offset, output_section, alignment_power, */ \ + 0, (struct sec *) &SEC, 0, \ + \ + /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ + NULL, NULL, 0, 0, 0, \ + \ + /* line_filepos, userdata, contents, lineno, lineno_count, */ \ + 0, NULL, NULL, NULL, 0, \ + \ + /* comdat, moving_line_filepos, target_index, used_by_bfd, */ \ + NULL, 0, 0, NULL, \ + \ + /* constructor_chain, owner, */ \ + NULL, NULL, \ + \ + /* symbol, */ \ + (struct symbol_cache_entry *) &global_syms[IDX], \ + \ + /* symbol_ptr_ptr, */ \ + (struct symbol_cache_entry **) &SYM, \ + \ + /* link_order_head, link_order_tail */ \ + NULL, NULL \ } STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, @@ -595,7 +605,7 @@ FUNCTION bfd_get_section_by_name SYNOPSIS - asection *bfd_get_section_by_name(bfd *abfd, CONST char *name); + asection *bfd_get_section_by_name(bfd *abfd, const char *name); DESCRIPTION Run through @var{abfd} and return the one of the @@ -611,7 +621,7 @@ DESCRIPTION asection * bfd_get_section_by_name (abfd, name) bfd *abfd; - CONST char *name; + const char *name; { asection *sect; @@ -627,7 +637,7 @@ FUNCTION bfd_make_section_old_way SYNOPSIS - asection *bfd_make_section_old_way(bfd *abfd, CONST char *name); + asection *bfd_make_section_old_way(bfd *abfd, const char *name); DESCRIPTION Create a new empty section called @var{name} @@ -651,7 +661,7 @@ DESCRIPTION asection * bfd_make_section_old_way (abfd, name) bfd *abfd; - CONST char *name; + const char *name; { asection *sec = bfd_get_section_by_name (abfd, name); if (sec == (asection *) NULL) @@ -666,7 +676,7 @@ FUNCTION bfd_make_section_anyway SYNOPSIS - asection *bfd_make_section_anyway(bfd *abfd, CONST char *name); + asection *bfd_make_section_anyway(bfd *abfd, const char *name); DESCRIPTION Create a new empty section called @var{name} and attach it to the end of @@ -681,8 +691,9 @@ DESCRIPTION sec_ptr bfd_make_section_anyway (abfd, name) bfd *abfd; - CONST char *name; + const char *name; { + static int section_id = 0; asection *newsect; asection **prev = &abfd->sections; asection *sect = abfd->sections; @@ -704,6 +715,7 @@ bfd_make_section_anyway (abfd, name) return NULL; newsect->name = name; + newsect->id = section_id++; newsect->index = abfd->section_count++; newsect->flags = SEC_NO_FLAGS; @@ -744,7 +756,7 @@ FUNCTION bfd_make_section SYNOPSIS - asection *bfd_make_section(bfd *, CONST char *name); + asection *bfd_make_section(bfd *, const char *name); DESCRIPTION Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling @@ -756,7 +768,7 @@ DESCRIPTION asection * bfd_make_section (abfd, name) bfd *abfd; - CONST char *name; + const char *name; { asection *sect = abfd->sections; @@ -1169,7 +1181,7 @@ _bfd_strip_section_from_output (info, s) } /* If the output section is empty, remove it too. Careful about sections - that have been discarded in the link script -- they are mapped to + that have been discarded in the link script -- they are mapped to bfd_abs_section, which has no owner. */ if (!keep_os && os->owner != NULL) { |