[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] linker/lld: do not generate quoted section names


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 29 Apr 2022 11:36:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ym6N3M5LNo8FbySG9wQ5XDzt5zU2d2LaWp3GmRtJ71I=; b=DtaiZDXcmZJRN72T90Cwlx6QPaLXuYIwKkOHpuVjQUIN/R+GE97PvOt8VYcvBlBeR7VS7e8sgo7ZLrB0vvn+4zisGW3vxQ/VddpZmZxRbj0uy5rdgJjBJzvsLcpsshLw6FJoNJd4t2aALG7D4J+RaTH0IIRHkDpgwBfTJw8xeBa57W4qfasmu90Host2swV+/deNSSJTbXtQeB54NnWn4/ZGQ2+mOb3fLLkcAtez22iVobKkTusCgbZE8lRndyWuiztXwEQSkO1+uSxoGOYtP8wM3cqvh+G+lPGzlwBhh2oa+XPUZwO29hqb5Z02/CEZIl12efm17Cx4dIDVrX64yA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N6AZhgU6YyzcKRZs+OGU9iRXWeJPhkxyTdMjGfAzcV3x+O1ZXxV1kvRw0pZsc3gmOu3hGfSq7s5WBfmS7K8wX/aKw+LJUEli6l+7ZJ1okzUAAOXH9zd7rzdtEg7/J50JUtP5oJdL6I1E3Qzr+TDPdQj0KAve49BrX982PKarySkp1k6coNMEmnBmDAthRECaAzfA6bbSccTqEj0JneFrNBbVufr3BEd6YTAMdWXbqDqgxThpHxZskdn4VIWWaRpqFAmNp58iIAhsNtq/e8S3RJ4zCeyH60CNEEeiIvob6o/8LL8BbQKiCIKsnQzXx4oqvaaYkfq+jvZ8vf0uj1axpw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Fri, 29 Apr 2022 09:37:15 +0000
  • Ironport-data: A9a23:KHuZ46Kje+VUgiYoFE+RzZQlxSXFcZb7ZxGr2PjKsXjdYENS1D1Rn WBODDjUbPaKMzD8c9x2b9/g9kMEsJPRn4JjHAZlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vrav67xZVF/fngqoDUUYYoAQgsA149IMsdoUg7wbRh3tQ52YHR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 NlA5JLhDkQIBIySxrQiDyRaQg9SIJQTrdcrIVDn2SCS52vvViO2hs5IVQQxN4Be/ftrC2ZT8 /BeMCoKch2Im+OxxvS8V/VogcMgasLsOevzuFk5lW2fUalgHM+FH/miCdxwhV/cguhUGvnTf YwBYCdHZxXceRxffFwQDfrSmc/33iOkI2EE+Tp5o4I7xDP24RQs9IP/OYrzQN2ARcZ+lFqh8 zeuE2PRR0ty2Mak4SqI9Degi/HCmQv/WZkOD/uo+/hymlqRy2cPThoMWjOTo/O0l0q/UNJ3M FEP92wlqq1a3FOvZsnwWVu/unHslhwBX9tdFcUq5QfLzbDbiy6CHXQNRDNFbN0gtec1SCYs2 1vPmMnmbQGDq5WQQHOZs6yS9Dq0MC1Nd2saP3dYEU0C/sXpp5w1glTXVNF/HaWpj9rzXzbt3 zSNqyt4jLIW5SIW65iGEZn8q2rEjvD0osQdv207gkrNAttFWbOY
  • Ironport-hdrordr: A9a23:VzXUkK0S3R65vHD6tNsk7AqjBTtyeYIsimQD101hICG9Lfb0qy n+pp4mPEHP4wr5OEtOpTlPAtjjfZq6z+8O3WBxB8bYYOCCggeVxe5ZnO/fKlHbexEWs9QtrJ uIEJIOd+EYc2IK6voSiTPQe7hA/DDEytHRuQ639QYQcegAUdAE0+4WMHf5LqUgLzM2eKbRWa DsrvZvln6FQzA6f867Dn4KU6zqoMDKrovvZVojCwQ84AeDoDu04PqieiLolCs2Yndq+/MP4G LFmwv26uGKtOy68AbV0yv2445NkNXs59NfDIini9QTKB/rlgG0Db4REIGqjXQQmqWC+VwqmN 7Dr1MJONly0WrYeiWPrR7ky2DboUETA9OL8y7qvVLT5ejCAB4qActIgoxUNjHD7VA7gd162K VXm0qEqpt+F3r77WrAzumNcysvulu/oHIkn+JWpWdYS5EiZLhYqpFa1F9JEa0HADnx5OkcYa ZT5fnnlbZrmG6hHjPkVjEF+q3vYp1zJGbLfqE6gL3V79AM90oJinfxx6Qk7wM9HdwGOt15Dt //Q9VVfYF1P7ErhJ1GdZc8qLOMewrwqDL3QRSvyAfcZeg600ykke+E3JwFoMeXRbcv8Lwe3L z8bXIwjx9GR6upM7zC4KF2
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

LLVM LD doesn't strip the quotes from the section names, and so the
resulting binary ends up with section names like:

  [ 1] ".text"           PROGBITS         ffff82d040200000  00008000
       000000000018cbc1  0000000000000000  AX       0     0     4096

This confuses some tools (like gdb) and prevents proper parsing of the
binary.

The issue has already been reported and is being fixed in LLD.  In
order to workaround this issue and keep the GNU ld support define
different DECL_SECTION macros depending on the used ld
implementation.

Drop the quotes from the definitions of the debug sections in
DECL_DEBUG{2}, as those quotes are not required for GNU ld either.

Fixes: 6254920587c3 ('x86: quote section names when defining them in linker 
script')
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Reference to the patch for LLD:
https://reviews.llvm.org/D124266
---
 xen/arch/x86/xen.lds.S    | 6 +++++-
 xen/include/xen/xen.lds.h | 8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 6e4abbc1ce..d94915ea7d 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -20,7 +20,11 @@ ENTRY(efi_start)
 #else /* !EFI */
 
 #define FORMAT "elf64-x86-64"
-#define DECL_SECTION(x) #x : AT(ADDR(#x) - __XEN_VIRT_START)
+#ifdef CONFIG_LD_IS_GNU
+# define DECL_SECTION(x) x : AT(ADDR(#x) - __XEN_VIRT_START)
+#else
+# define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
+#endif
 
 ENTRY(start_pa)
 
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index fc47bb1ccc..06b7110837 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -18,11 +18,11 @@
  * for PE output, in order to record that we'd prefer these sections to not
  * be loaded into memory.
  */
-#define DECL_DEBUG(x, a) #x ALIGN(a) (NOLOAD) : { *(x) }
-#define DECL_DEBUG2(x, y, a) #x ALIGN(a) (NOLOAD) : { *(x) *(y) }
+#define DECL_DEBUG(x, a) x ALIGN(a) (NOLOAD) : { *(x) }
+#define DECL_DEBUG2(x, y, a) x ALIGN(a) (NOLOAD) : { *(x) *(y) }
 #else
-#define DECL_DEBUG(x, a) #x 0 : { *(x) }
-#define DECL_DEBUG2(x, y, a) #x 0 : { *(x) *(y) }
+#define DECL_DEBUG(x, a) x 0 : { *(x) }
+#define DECL_DEBUG2(x, y, a) x 0 : { *(x) *(y) }
 #endif
 
 /*
-- 
2.35.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.