* [PATCH] xtensa: gas: put .literal_position at section start
@ 2019-04-10 20:20 Max Filippov
2019-04-11 18:10 ` augustine.sterling
0 siblings, 1 reply; 3+ messages in thread
From: Max Filippov @ 2019-04-10 20:20 UTC (permalink / raw)
To: binutils; +Cc: Sterling Augustine, Eric Tsai, linux-xtensa, Max Filippov
Provide literal position at the beginning of each section for literal
space reserved by relaxations when text-section-literals or
auto-litpools options are used. Remove code that adds fill frag to the
literal section for every .literal_position directive to avoid creation
of empty literal sections.
Fix auto-litpools tests that got literal pool address changes.
gas/
2019-04-10 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (xtensa_is_init_fini): Add declaration.
(xtensa_mark_literal_pool_location): Don't add fill frag to literal
section that records literal pool location.
(md_begin): Call xtensa_mark_literal_pool_location when text
section literals or auto litpools are used.
(xtensa_elf_section_change_hook): Call
xtensa_mark_literal_pool_location when text section literals or
auto litpools are used, there's no literal pool location defined
for the current section and it's not .init or .fini.
* testsuite/gas/xtensa/auto-litpools-first1.d: Fix up addresses.
* testsuite/gas/xtensa/auto-litpools-first2.d: Likewise.
* testsuite/gas/xtensa/auto-litpools.d: Likewise.
---
gas/config/tc-xtensa.c | 22 +++++++++-------------
gas/testsuite/gas/xtensa/auto-litpools-first1.d | 6 +++---
gas/testsuite/gas/xtensa/auto-litpools-first2.d | 10 ++++------
gas/testsuite/gas/xtensa/auto-litpools.d | 6 +++---
4 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 0cc06361cf6f..6a80e76fed8c 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -497,6 +497,7 @@ static fixS *xg_append_jump (fragS *fragP, symbolS *sym, offsetT offset);
static void xtensa_maybe_create_literal_pool_frag (bfd_boolean, bfd_boolean);
static bfd_boolean auto_litpools = FALSE;
static int auto_litpool_limit = 0;
+static bfd_boolean xtensa_is_init_fini (segT seg);
/* Alignment Functions. */
@@ -4797,7 +4798,6 @@ xtensa_mark_literal_pool_location (void)
{
/* Any labels pointing to the current location need
to be adjusted to after the literal pool. */
- emit_state s;
fragS *pool_location;
if (use_literal_section)
@@ -4818,19 +4818,7 @@ xtensa_mark_literal_pool_location (void)
RELAX_LITERAL_POOL_END, NULL, 0, NULL);
xtensa_set_frag_assembly_state (frag_now);
- /* Now put a frag into the literal pool that points to this location. */
set_literal_pool_location (now_seg, pool_location);
- xtensa_switch_to_non_abs_literal_fragment (&s);
- frag_align (2, 0, 0);
- record_alignment (now_seg, 2);
-
- /* Close whatever frag is there. */
- frag_variant (rs_fill, 0, 0, 0, NULL, 0, NULL);
- xtensa_set_frag_assembly_state (frag_now);
- frag_now->tc_frag_data.literal_frag = pool_location;
- frag_variant (rs_fill, 0, 0, 0, NULL, 0, NULL);
- xtensa_restore_emit_state (&s);
- xtensa_set_frag_assembly_state (frag_now);
}
@@ -5334,6 +5322,9 @@ md_begin (void)
/* Set up the assembly state. */
if (!frag_now->tc_frag_data.is_assembly_state_set)
xtensa_set_frag_assembly_state (frag_now);
+
+ if (!use_literal_section)
+ xtensa_mark_literal_pool_location ();
}
@@ -5933,6 +5924,11 @@ xtensa_elf_section_change_hook (void)
/* Set up the assembly state. */
if (!frag_now->tc_frag_data.is_assembly_state_set)
xtensa_set_frag_assembly_state (frag_now);
+
+ if (!use_literal_section
+ && seg_info (now_seg)->tc_segment_info_data.literal_pool_loc == NULL
+ && !xtensa_is_init_fini (now_seg))
+ xtensa_mark_literal_pool_location ();
}
diff --git a/gas/testsuite/gas/xtensa/auto-litpools-first1.d b/gas/testsuite/gas/xtensa/auto-litpools-first1.d
index 322cdc52e30a..9dfb0b03db6d 100644
--- a/gas/testsuite/gas/xtensa/auto-litpools-first1.d
+++ b/gas/testsuite/gas/xtensa/auto-litpools-first1.d
@@ -5,8 +5,8 @@
.*: +file format .*xtensa.*
#...
Contents of section .text:
- 0000 ........ 20170331 .*
+ 0000 20170331 .*
#...
-00000000 <f>:
-.*0:.*j.8 .*
+00000004 <f>:
+.*4:.*l32r.*a2, 0.*
#...
diff --git a/gas/testsuite/gas/xtensa/auto-litpools-first2.d b/gas/testsuite/gas/xtensa/auto-litpools-first2.d
index a6b798e68044..44dbddd75128 100644
--- a/gas/testsuite/gas/xtensa/auto-litpools-first2.d
+++ b/gas/testsuite/gas/xtensa/auto-litpools-first2.d
@@ -5,11 +5,9 @@
.*: +file format .*xtensa.*
#...
Contents of section .text:
- 0000 ........ ........ 20170331 .*
+ 0000 20170331 .*
#...
-00000000 <f>:
- 0:.*addi.*a1.*
- 3:.*j.*c.*
-#...
- c:.*l32r.*a2, 8.*
+00000004 <f>:
+ 4:.*addi.*a1.*
+ 7:.*l32r.*a2, 0.*
#...
diff --git a/gas/testsuite/gas/xtensa/auto-litpools.d b/gas/testsuite/gas/xtensa/auto-litpools.d
index 8eadd1f08cf6..8b6d13e371b1 100644
--- a/gas/testsuite/gas/xtensa/auto-litpools.d
+++ b/gas/testsuite/gas/xtensa/auto-litpools.d
@@ -4,9 +4,9 @@
.*: +file format .*xtensa.*
#...
-.*8:.*l32r.a2, 4 .*
+.*4:.*l32r.a2, 0 .*
#...
-.*3f029:.*j.3f030 .*
+.*3f025:.*j.3f02c .*
#...
-.*40752:.*l32r.a2, 3f02c .*
+.*4074e:.*l32r.a2, 3f028 .*
#...
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xtensa: gas: put .literal_position at section start
2019-04-10 20:20 [PATCH] xtensa: gas: put .literal_position at section start Max Filippov
@ 2019-04-11 18:10 ` augustine.sterling
2019-04-11 18:45 ` Max Filippov
0 siblings, 1 reply; 3+ messages in thread
From: augustine.sterling @ 2019-04-11 18:10 UTC (permalink / raw)
To: Max Filippov; +Cc: binutils, Eric Tsai, linux-xtensa
On Wed, Apr 10, 2019 at 1:20 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
> gas/
> 2019-04-10 Max Filippov <jcmvbkbc@gmail.com>
>
> * config/tc-xtensa.c (xtensa_is_init_fini): Add declaration.
> (xtensa_mark_literal_pool_location): Don't add fill frag to literal
> section that records literal pool location.
> (md_begin): Call xtensa_mark_literal_pool_location when text
> section literals or auto litpools are used.
> (xtensa_elf_section_change_hook): Call
> xtensa_mark_literal_pool_location when text section literals or
> auto litpools are used, there's no literal pool location defined
> for the current section and it's not .init or .fini.
> * testsuite/gas/xtensa/auto-litpools-first1.d: Fix up addresses.
> * testsuite/gas/xtensa/auto-litpools-first2.d: Likewise.
> * testsuite/gas/xtensa/auto-litpools.d: Likewise.
This is OK.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xtensa: gas: put .literal_position at section start
2019-04-11 18:10 ` augustine.sterling
@ 2019-04-11 18:45 ` Max Filippov
0 siblings, 0 replies; 3+ messages in thread
From: Max Filippov @ 2019-04-11 18:45 UTC (permalink / raw)
To: augustine.sterling; +Cc: binutils, Eric Tsai, linux-xtensa
On Thu, Apr 11, 2019 at 11:10 AM augustine.sterling@gmail.com
<augustine.sterling@gmail.com> wrote:
>
> On Wed, Apr 10, 2019 at 1:20 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
> > gas/
> > 2019-04-10 Max Filippov <jcmvbkbc@gmail.com>
> >
> > * config/tc-xtensa.c (xtensa_is_init_fini): Add declaration.
> > (xtensa_mark_literal_pool_location): Don't add fill frag to literal
> > section that records literal pool location.
> > (md_begin): Call xtensa_mark_literal_pool_location when text
> > section literals or auto litpools are used.
> > (xtensa_elf_section_change_hook): Call
> > xtensa_mark_literal_pool_location when text section literals or
> > auto litpools are used, there's no literal pool location defined
> > for the current section and it's not .init or .fini.
> > * testsuite/gas/xtensa/auto-litpools-first1.d: Fix up addresses.
> > * testsuite/gas/xtensa/auto-litpools-first2.d: Likewise.
> > * testsuite/gas/xtensa/auto-litpools.d: Likewise.
>
> This is OK.
Thanks. Applied to master.
-- Max
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-11 18:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10 20:20 [PATCH] xtensa: gas: put .literal_position at section start Max Filippov
2019-04-11 18:10 ` augustine.sterling
2019-04-11 18:45 ` Max Filippov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).