mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
Add a generic .bss directive for ELF based targets.
PR 3136 * config/obj-elf.c (elf_pseudo_table): Add entry for .bss. (obj_elf_bss): New function. Change to the .bss section. Support an optional subsection number. (obj_elf_change_section): Call obj_elf_section_change_hook. (obj_elf_section): Likewise. (obj_elf_data): Likewise. (obj_elf_text): Likewise. (obj_elf_struct): Likewise. (obj_elf_subsection): Likewise. (obj_elf_previous): Likewise. * config/obj-elf.h (obj_elf_bss): Prototype. * doc/as.texi (Bss): New node.
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
2021-05-07 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR 3136
|
||||
* config/obj-elf.c (elf_pseudo_table): Add entry for .bss.
|
||||
(obj_elf_bss): New function. Change to the .bss section.
|
||||
Support an optional subsection number.
|
||||
(obj_elf_change_section): Call obj_elf_section_change_hook.
|
||||
(obj_elf_section): Likewise.
|
||||
(obj_elf_data): Likewise.
|
||||
(obj_elf_text): Likewise.
|
||||
(obj_elf_struct): Likewise.
|
||||
(obj_elf_subsection): Likewise.
|
||||
(obj_elf_previous): Likewise.
|
||||
* config/obj-elf.h (obj_elf_bss): Prototype.
|
||||
* doc/as.texi (Bss): New node.
|
||||
|
||||
2021-05-07 Clément Chigot <clement.chigot@atos.net>
|
||||
|
||||
* config/obj-coff.c (coff_frob_symbol): Don't skip C_DWARF.
|
||||
|
||||
@@ -131,6 +131,7 @@ static const pseudo_typeS elf_pseudo_table[] =
|
||||
{"offset", obj_elf_struct, 0},
|
||||
{"struct", obj_elf_struct, 0},
|
||||
{"text", obj_elf_text, 0},
|
||||
{"bss", obj_elf_bss, 0},
|
||||
|
||||
{"tls_common", obj_elf_tls_common, 0},
|
||||
|
||||
@@ -603,8 +604,8 @@ obj_elf_change_section (const char *name,
|
||||
elt->prev_subseg = previous_subsection;
|
||||
section_stack = elt;
|
||||
}
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
old_sec = bfd_get_section_by_name_if (stdoutput, name, get_section_by_match,
|
||||
(void *) match_p);
|
||||
@@ -1125,8 +1126,7 @@ obj_elf_section (int push)
|
||||
md_flush_pending_output ();
|
||||
#endif
|
||||
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
s_mri_sect (&mri_type);
|
||||
|
||||
@@ -1467,6 +1467,28 @@ obj_elf_section (int push)
|
||||
subseg_set (now_seg, new_subsection);
|
||||
}
|
||||
|
||||
/* Change to the .bss section. */
|
||||
|
||||
void
|
||||
obj_elf_bss (int i ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int temp;
|
||||
|
||||
#ifdef md_flush_pending_output
|
||||
md_flush_pending_output ();
|
||||
#endif
|
||||
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
temp = get_absolute_expression ();
|
||||
subseg_set (bss_section, (subsegT) temp);
|
||||
demand_empty_rest_of_line ();
|
||||
|
||||
#ifdef md_elf_section_change_hook
|
||||
md_elf_section_change_hook ();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Change to the .data section. */
|
||||
|
||||
void
|
||||
@@ -1476,8 +1498,8 @@ obj_elf_data (int i)
|
||||
md_flush_pending_output ();
|
||||
#endif
|
||||
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
s_data (i);
|
||||
|
||||
#ifdef md_elf_section_change_hook
|
||||
@@ -1494,8 +1516,8 @@ obj_elf_text (int i)
|
||||
md_flush_pending_output ();
|
||||
#endif
|
||||
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
s_text (i);
|
||||
|
||||
#ifdef md_elf_section_change_hook
|
||||
@@ -1512,8 +1534,8 @@ obj_elf_struct (int i)
|
||||
md_flush_pending_output ();
|
||||
#endif
|
||||
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
s_struct (i);
|
||||
|
||||
#ifdef md_elf_section_change_hook
|
||||
@@ -1530,8 +1552,7 @@ obj_elf_subsection (int ignore ATTRIBUTE_UNUSED)
|
||||
md_flush_pending_output ();
|
||||
#endif
|
||||
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
temp = get_absolute_expression ();
|
||||
subseg_set (now_seg, (subsegT) temp);
|
||||
@@ -1570,8 +1591,8 @@ obj_elf_previous (int ignore ATTRIBUTE_UNUSED)
|
||||
|
||||
new_section = previous_section;
|
||||
new_subsection = previous_subsection;
|
||||
previous_section = now_seg;
|
||||
previous_subsection = now_subseg;
|
||||
obj_elf_section_change_hook ();
|
||||
|
||||
subseg_set (new_section, new_subsection);
|
||||
|
||||
#ifdef md_elf_section_change_hook
|
||||
|
||||
@@ -189,6 +189,7 @@ extern const char * obj_elf_section_name (void);
|
||||
extern void obj_elf_previous (int);
|
||||
extern void obj_elf_version (int);
|
||||
extern void obj_elf_common (int);
|
||||
extern void obj_elf_bss (int);
|
||||
extern void obj_elf_data (int);
|
||||
extern void obj_elf_text (int);
|
||||
extern void obj_elf_change_section
|
||||
|
||||
@@ -4365,6 +4365,7 @@ Some machine configurations provide additional directives.
|
||||
* Asciz:: @code{.asciz "@var{string}"}@dots{}
|
||||
* Attach_to_group:: @code{.attach_to_group @var{name}}
|
||||
* Balign:: @code{.balign [@var{abs-expr}[, @var{abs-expr}]]}
|
||||
* Bss:: @code{.bss @var{subsection}}
|
||||
* Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc
|
||||
* Byte:: @code{.byte @var{expressions}}
|
||||
* CFI directives:: @code{.cfi_startproc [simple]}, @code{.cfi_endproc}, etc.
|
||||
@@ -4709,6 +4710,18 @@ filled in with the value 0x368d (the exact placement of the bytes depends upon
|
||||
the endianness of the processor). If it skips 1 or 3 bytes, the fill value is
|
||||
undefined.
|
||||
|
||||
@node Bss
|
||||
@section @code{.bss @var{subsection}}
|
||||
@cindex @code{bss} directive
|
||||
|
||||
@code{.bss} tells @command{@value{AS}} to assemble the following statements
|
||||
onto the end of the bss section.
|
||||
@ifset ELF
|
||||
For ELF based targets an optional @var{subsection} expression (which must
|
||||
evaluate to a positive integer) can be provided. In this case the statements
|
||||
are appended to the end of the indicated bss subsection.
|
||||
@end ifset
|
||||
|
||||
@node Bundle directives
|
||||
@section Bundle directives
|
||||
@subsection @code{.bundle_align_mode @var{abs-expr}}
|
||||
|
||||
Reference in New Issue
Block a user