From: "Balasubrmanian, Vignesh" <Vignesh.Balasubrmanian@amd.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "George, Jini Susan" <JiniSusan.George@amd.com>,
"Kumar N, Bhuvanendra" <Bhuvanendra.KumarN@amd.com>
Subject: [PATCH 1/2] Add lld(linker) specific option.
Date: Mon, 21 Mar 2022 12:15:37 +0000 [thread overview]
Message-ID: <CY4PR12MB1814481686B68A7D12FD0F7087169@CY4PR12MB1814.namprd12.prod.outlook.com> (raw)
[-- 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
next reply other threads:[~2022-03-21 12:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 12:15 Balasubrmanian, Vignesh [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CY4PR12MB1814481686B68A7D12FD0F7087169@CY4PR12MB1814.namprd12.prod.outlook.com \
--to=vignesh.balasubrmanian@amd.com \
--cc=Bhuvanendra.KumarN@amd.com \
--cc=JiniSusan.George@amd.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).