public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add lld(linker) specific option.
@ 2022-03-21 12:15 Balasubrmanian, Vignesh
  2022-03-21 13:44 ` Simon Marchi
  0 siblings, 1 reply; 8+ messages in thread
From: Balasubrmanian, Vignesh @ 2022-03-21 12:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: George, Jini Susan, Kumar N, Bhuvanendra

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]


Please review the attached patch.

LLD doesn't have the option "-Ttext-segment" but "--image-base".
So first try using "-Ttext-segment". If it fails, try the lld option "--image-base" before failing.

Thanks,
vigneshbalu



[-- Attachment #2: 0001-Add-lld-linker-specific-option.patch --]
[-- Type: application/octet-stream, Size: 1997 bytes --]

From 2517f8889d7371602e38b64e4a5264eda1f6fae4 Mon Sep 17 00:00:00 2001
From: Vignesh Balasubramanian <Vignesh.Balasubrmanian@amd.com>
Date: Thu, 17 Mar 2022 14:56:52 +0530
Subject: [PATCH 1/2] Add lld(linker) specific option.

LLD doesn't have option "-Ttext-segment" but "--image-base".
So first try using "-Ttext-segment". If it fails, try the lld
option "--image-base" before failing.
---
 gdb/testsuite/lib/jit-elf-helpers.exp | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/lib/jit-elf-helpers.exp b/gdb/testsuite/lib/jit-elf-helpers.exp
index af70b11644c..1ec295c54bd 100644
--- a/gdb/testsuite/lib/jit-elf-helpers.exp
+++ b/gdb/testsuite/lib/jit-elf-helpers.exp
@@ -92,15 +92,26 @@ proc compile_and_download_n_jit_so {jit_solib_basename jit_solib_srcfile count}
 	# in the compiled shared library against a fixed base address.  Combined
 	# with mapping the resulting binary to the same fixed base it allows
 	# to dynamically execute functions from it without any further adjustments.
-	set options [list \
+	set options_ld [list \
 	    additional_flags=-DFUNCTION_NAME=[format "jit_function_%04d" $i] \
 	    additional_flags=-Xlinker \
 	    additional_flags=-Ttext-segment=$addr]
+
+	# Use "--image-base" instead of "-Ttext-segment" for LLD linker.
+	set options_lld [list \
+            additional_flags=-DFUNCTION_NAME=[format "jit_function_%04d" $i] \
+            additional_flags=-Xlinker \
+            additional_flags=--image-base=$addr]
+
+
 	if { [gdb_compile_shlib ${jit_solib_srcfile} ${binfile} \
-		  $options] != "" } {
-	    set f [file tail $binfile]
-	    untested "failed to compile shared library $f"
-	    return -1
+		  $options_ld] != "" } {
+	    if { [gdb_compile_shlib ${jit_solib_srcfile} ${binfile} \
+		  $options_lld] != "" } {
+		set f [file tail $binfile]
+		untested "failed to compile shared library $f"
+		return -1
+	    }
 	}
 
 	set path [gdb_remote_download target ${binfile}]
-- 
2.17.1


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

end of thread, other threads:[~2022-04-18 14:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 12:15 [PATCH 1/2] Add lld(linker) specific option Balasubrmanian, Vignesh
2022-03-21 13:44 ` Simon Marchi
2022-03-22 16:21   ` Balasubrmanian, Vignesh
2022-03-29  8:35     ` Luis Machado
2022-03-29 12:21     ` Simon Marchi
2022-03-29 12:23       ` Simon Marchi
2022-03-30 11:21       ` Balasubrmanian, Vignesh
2022-04-18 14:27         ` Simon Marchi

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