aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2021-07-30 13:56:54 +0200
committerClément Chigot <clement.chigot@atos.net>2021-08-04 08:54:59 +0200
commit934cb8492f1745c2883ba6be885e8729f92a258f (patch)
treed2f4ddc14f74b40ffb87949553981fae4d4da0d7 /gas
parent47fcfcbadce36c7ccc00c69b4c80717a0d6b9288 (diff)
downloadgdb-934cb8492f1745c2883ba6be885e8729f92a258f.zip
gdb-934cb8492f1745c2883ba6be885e8729f92a258f.tar.gz
gdb-934cb8492f1745c2883ba6be885e8729f92a258f.tar.bz2
gas: always add dummy symbols when creating XCOFF sections.
Most of the algorithms for XCOFF in tc-ppc.c assume that the csects field of a ppc_xcoff_section isn't NULL. This was already made for most of the sections with the creation of a dummy symbol. This patch simply mades it default when creating a xcoff_section. gas/ * config/tc-ppc.c (ppc_init_xcoff_section): Always create the dummy symbol. (md_begin): Adjust ppc_init_xcoff_section call. (ppc_comm): Likewise. (ppc_change_csect): Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-ppc.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 1327eab..b756708 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1014,18 +1014,15 @@ ppc_xcoff_section_is_initialized (struct ppc_xcoff_section *section)
/* Initialize a ppc_xcoff_section.
Dummy symbols are used to ensure the position of .text over .data
- and .tdata. These symbols won't be output. */
+ and .tdata. Moreover, they allow all algorithms here to be sure that
+ csects isn't NULL. These symbols won't be output. */
static void
-ppc_init_xcoff_section (struct ppc_xcoff_section *s, segT seg,
- bool need_dummy)
+ppc_init_xcoff_section (struct ppc_xcoff_section *s, segT seg)
{
s->segment = seg;
s->next_subsegment = 2;
- if (need_dummy)
- {
- s->csects = symbol_make ("dummy\001");
- symbol_get_tc (s->csects)->within = s->csects;
- }
+ s->csects = symbol_make ("dummy\001");
+ symbol_get_tc (s->csects)->within = s->csects;
}
/* The current csect. */
@@ -1881,9 +1878,9 @@ md_begin (void)
/* Create XCOFF sections with .text in first, as it's creating dummy symbols
to serve as initial csects. This forces the text csects to precede the
data csects. These symbols will not be output. */
- ppc_init_xcoff_section (&ppc_xcoff_text_section, text_section, true);
- ppc_init_xcoff_section (&ppc_xcoff_data_section, data_section, true);
- ppc_init_xcoff_section (&ppc_xcoff_bss_section, bss_section, true);
+ ppc_init_xcoff_section (&ppc_xcoff_text_section, text_section);
+ ppc_init_xcoff_section (&ppc_xcoff_data_section, data_section);
+ ppc_init_xcoff_section (&ppc_xcoff_bss_section, bss_section);
#endif
}
@@ -4400,8 +4397,7 @@ ppc_comm (int lcomm)
section = &ppc_xcoff_tbss_section;
if (!ppc_xcoff_section_is_initialized (section))
{
- ppc_init_xcoff_section (section,
- subseg_new (".tbss", 0), false);
+ ppc_init_xcoff_section (section, subseg_new (".tbss", 0));
bfd_set_section_flags (section->segment,
SEC_ALLOC | SEC_THREAD_LOCAL);
seg_info (section->segment)->bss = 1;
@@ -4558,8 +4554,7 @@ ppc_change_csect (symbolS *sym, offsetT align)
/* Create .tdata section if not yet done. */
if (!ppc_xcoff_section_is_initialized (section))
{
- ppc_init_xcoff_section (section, subseg_new (".tdata", 0),
- true);
+ ppc_init_xcoff_section (section, subseg_new (".tdata", 0));
bfd_set_section_flags (section->segment, SEC_ALLOC
| SEC_LOAD | SEC_RELOC | SEC_DATA
| SEC_THREAD_LOCAL);
@@ -4570,8 +4565,7 @@ ppc_change_csect (symbolS *sym, offsetT align)
/* Create .tbss section if not yet done. */
if (!ppc_xcoff_section_is_initialized (section))
{
- ppc_init_xcoff_section (section, subseg_new (".tbss", 0),
- false);
+ ppc_init_xcoff_section (section, subseg_new (".tbss", 0));
bfd_set_section_flags (section->segment, SEC_ALLOC |
SEC_THREAD_LOCAL);
seg_info (section->segment)->bss = 1;