public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] LoongArch: bfd: Remove elf_seg_map condition in loongarch_elf_relax_section
@ 2023-07-11  8:49 Jinyang He
  2023-07-11  8:49 ` [PATCH 2/2] LoongArch: bfd: Add counter to get real relax region Jinyang He
  2023-07-12  6:35 ` [PATCH 1/2] LoongArch: bfd: Remove elf_seg_map condition in loongarch_elf_relax_section mengqinggang
  0 siblings, 2 replies; 11+ messages in thread
From: Jinyang He @ 2023-07-11  8:49 UTC (permalink / raw)
  To: Chenghua Xu, Zhensong Liu, mengqinggang, WANG Xuerui
  Cc: binutils, Xing Li, yala, Peng Fan

When I tried "./ld-new sth." the relax does not work because the
elf_seg_map (info->output_bfd) was NULL in loongarch_elf_relax_section.
There is no need for the segment info, we can get the address through
the section info. Thus, remove this condition.

bfd/ChangeLog:

	* elfnn-loongarch.c (loongarch_elf_relax_section): Remove
	elf_seg_map condition.

ld/ChangeLog:

	* testsuite/ld-loongarch-elf/relax.exp: Update trigger method.
	* testsuite/ld-loongarch-elf/relax.dd: New test.
---
 bfd/elfnn-loongarch.c                   |  1 -
 ld/testsuite/ld-loongarch-elf/relax.dd  |  6 +++++
 ld/testsuite/ld-loongarch-elf/relax.exp | 35 +++++++------------------
 3 files changed, 16 insertions(+), 26 deletions(-)
 create mode 100644 ld/testsuite/ld-loongarch-elf/relax.dd

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index d3d8419d8..01f349a24 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -3845,7 +3845,6 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
       || sec->sec_flg0
       || (sec->flags & SEC_RELOC) == 0
       || sec->reloc_count == 0
-      || elf_seg_map (info->output_bfd) == NULL
       || (info->disable_target_specific_optimizations
 	  && info->relax_pass == 0)
       /* The exp_seg_relro_adjust is enum phase_enum (0x4),
diff --git a/ld/testsuite/ld-loongarch-elf/relax.dd b/ld/testsuite/ld-loongarch-elf/relax.dd
new file mode 100644
index 000000000..e266beb8f
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax.dd
@@ -0,0 +1,6 @@
+#...
+.*pcaddi.*
+.*ld.w.*
+.*pcaddi.*
+.*ld.w.*
+#pass
diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp
index 7ff876d79..d2bb967c6 100644
--- a/ld/testsuite/ld-loongarch-elf/relax.exp
+++ b/ld/testsuite/ld-loongarch-elf/relax.exp
@@ -21,31 +21,6 @@
 
 if [istarget loongarch64-*-*] {
 
-  if [isbuild loongarch64-*-*] {
-    set testname "loongarch relax build"
-    set pre_builds [list \
-      [list \
-	"$testname" \
-	"" \
-	"" \
-	{relax.s} \
-	{} \
-	"relax" \
-      ] \
-    ]
-
-    run_cc_link_tests $pre_builds
-
-    if [file exist "tmpdir/relax"] {
-      set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax"]
-      if { [ regexp ".*pcaddi.*pcaddi.*" $objdump_output] } {
-	pass "loongarch relax"
-      } {
-	fail "loongarch relax"
-      }
-    }
-  }
-
   run_ld_link_tests \
       [list \
 	  [list \
@@ -58,6 +33,16 @@ if [istarget loongarch64-*-*] {
 	      ] \
 	      "relax-align" \
 	  ] \
+	  [list \
+	      "relax" \
+	      "-e 0 -Ttext 0x10000 -Tdata 0x20000" "" \
+	      "" \
+	      {relax.s} \
+	      [list \
+		  [list objdump -d relax.dd] \
+	      ] \
+	      "relax" \
+	  ] \
       ]
 
   set objdump_flags "-s -j .data"
-- 
2.33.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-10-10 13:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11  8:49 [PATCH 1/2] LoongArch: bfd: Remove elf_seg_map condition in loongarch_elf_relax_section Jinyang He
2023-07-11  8:49 ` [PATCH 2/2] LoongArch: bfd: Add counter to get real relax region Jinyang He
2023-07-12  6:35 ` [PATCH 1/2] LoongArch: bfd: Remove elf_seg_map condition in loongarch_elf_relax_section mengqinggang
2023-07-12  8:08   ` Jinyang He
2023-07-13  3:13     ` mengqinggang
2023-07-13  7:19       ` Jinyang He
2023-07-13  8:18         ` Jinyang He
2023-10-05 10:09           ` Xi Ruoyao
2023-10-05 11:19             ` Xi Ruoyao
2023-10-07  1:23               ` mengqinggang
2023-10-10 13:13                 ` Xi Ruoyao

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).