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

[PATCH] build/xen: fix symbol generation with LLVM LD


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 5 May 2022 16:21:37 +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=Z7MknCtDaFKJ46I5qllMrt5+TW3heupIj0BoyuJe41E=; b=jZOswFuX5NwWLWTngYUiEfb1utJZxRyLPAnsyJDUeZMYpP6CyY9XNmx3LCbIowxx4Tbzm+2bgUILLOkDN/l4HtA7IcuNH+5HN3vMsiQsOZNGAqvY5B+SZcBQvnZJkamm49kR6rwpMUhQnRBE6/L2/kAfA33gV6+n3hFGlBdOaKI7vDRbAik4SEmM2igfpgdTgWtoy9rgkuIA37bVGBtn/fqH7IUXANScQ3MpoP2f63Dl99XecxRfmsfemFa08Y8zJD6PTEEp97cnsV5A0AAlU35OfiabtpnRITExTLQdSL+bT/Ud4BiLU68rksoW68CkYPaHMwwzLho0rEFlQwjyuQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IRTL7eEPp/pH1JOGaXI82hTPJz1Fvf1J/QI32WbabZM+BxEuydzceYYqpv/SUl3nbzNSwYFHzbC93h75qIHhW5CUIE9ebwvwyyNOoR1s/wga/n0jvpssaaMtnrFHZQ7pDvhYS4aCce+7YQoTEhts8KeYTRmG+K8Q/VOQNcMQHzbox38g+rNBeVUbGvnea91DIk4RNVxgZPUpC1oyRC/TNUc1K0VgQ366OkAQDUJAt0jVcaOe6S0zP/b0vMWRZzh5uvhnu7X8ltxNWbr1QlJivaUEzKVB/huMpYc9QBN1iPbsk+zqceINp4pLb7pMiF5ajSouxz5RR+VjTbsHqZqX4g==
  • 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>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 05 May 2022 14:22:07 +0000
  • Ironport-data: A9a23:idicdqiYzyTitl3z1BypOvv2X161fBEKZh0ujC45NGQN5FlHY01je htvD26EbqzfNzP0ft0iPNji/EhXuJ/Vz9RnSwRsqXs3Ey8b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M68wIFqtQw24LhXlvQ4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YS0XIZ2dl9kTbytdKz0uL6p42ubsfHfq5KR/z2WeG5ft69NHKRhseKc+qqNwC2wI8 uEEIjcQaBzFn/ix3L+wVuhrgIIkMdXvO4Qc/HpnyFk1D95/GcyFH/qMuIIehWhp7ixNNa+2i 84xcz1gYQ6GexRSElwWFIg/jKGjgXyXnzhw9wrL+PZpszK7IApZ64bCHtmOZYC2f/pfvxqlr 0SW8TrkDURPXDCY4X/fmp62vcffkCW+VI8MGbmQ8v9xnEbV1mEVEAcRV1awvb++kEHWc9BVJ lEQ+yEuhbMv70HtRd74NzW6vXqFsxg0S9dWVeog52ml0bHI6gyUAmwFSD9pa9E8ssIyAzsw2 TehgNfBFTFp9rqPRhqgGqy8qDqzPW0fKz8EbCpdFw8duYC8+cc0kw7FSctlHOitlNrpFDrsw jeM6i8jm7EUis1N3KK+lbzavw+RSlHyZlZdzm3qsqiNtWuVuKbNi1SU1GXm
  • Ironport-hdrordr: A9a23:FG51960rgq1FmATMbQgXQwqjBVRyeYIsimQD101hICG9Lfb0qy n+pp4mPEHP4wr5OEtOpTlPAtjjfZq6z+8M3WBxB8baYOCCggeVxe5ZnO/fKlHbexEWldQtqJ uIDZIOb+EYZGIS5aia3ODRKadb/DDtytHMuQ6x9QYPcek8AJsQlDuRRzzrZXFedU1jP94UBZ Cc7s1Iq36JfmkWVN2yAj0gU/LYr9PGuZr6aVpebiRXoTWmvHeN0vrXAhKY1hARX3dmxqojy3 HMl0jc6r+4u/+25xfA3yv47ohQmvHm1txfbfb8/PQ9G3HJsEKFdY5hU7qNsHQcp/yu0k8jlJ 32rxIpL61ImgHsV1DwhSGo9xjr0T4o5XOn40Sfm2HfrcvwQy9/I9ZdhKpCGyGppnYIjZVZ6u ZmzmiZv51YAVfrhyLm/eXFUBlsiw6dvWciq+gOlHZSOLFuIoO5lbZvs3+9La1wUh4TsOscYa hT5YDnlb1rmGqhHjzkVjIF+q3tYpwxdi32MXTq9PblkAS+p0oJsHfw9PZv4kvoy6hNNaWsn9 60VJiAtIs+O/P+PpgNcNvof6OMex3waCOJFl6uCnLaM4xCE07xivfMkcUIDaeRCdQ18Kc=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Current LLVM LD implementation will turn global hidden symbols in
object files into local ones when generating the .symtab of the Xen
binary image.

This is different from GNU ld implementation, that will only do the
conversion (or remove the symbols) when generation .dynsym but not
.symtab.  Such conversion breaks the processing of symbols done by
tools/symbols.

Use protected symbol visibility instead of hidden, as that preserves
the symbol binding while not generating GOT or PLT indirections that
are not compatible with some of the inline assembly constructs
currently used.

While there also make the visibility setting compiler support
non-optional: compilers not supporting it won't be able to build Xen
anyway, and will just throw a compiler error sooner rather than later
during the build.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/Kconfig                | 4 ----
 xen/include/xen/compiler.h | 9 +++++----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/Kconfig b/xen/Kconfig
index 134e6e68ad..a9182fb13d 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -29,10 +29,6 @@ config LD_IS_GNU
 config LD_IS_LLVM
        def_bool $(success,$(LD) --version | head -n 1 | grep -q "^LLD")
 
-# -fvisibility=hidden reduces -fpic cost, if it's available
-config CC_HAS_VISIBILITY_ATTRIBUTE
-       def_bool $(cc-option,-fvisibility=hidden)
-
 # Use -f{function,data}-sections compiler parameters
 config CC_SPLIT_SECTIONS
        bool
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 933aec09a9..c144b17217 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -125,10 +125,11 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
+/*
+ * Results in more efficient PIC code (no indirections through GOT or PLT)
+ * and is also required by some of the assembly constructs.
+ */
+#pragma GCC visibility push(protected)
 
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
-- 
2.36.0




 


Rackspace

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