Skip to contentSkip to conversation

Fixes to build with lld 6.0.0

PATCH In review Roger Pau Monne 6 participants 21 messages Jul 11, 2018 – Aug 15, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover Fixes to build with lld 6.0.0

Hello,

The following 3 patches allow building the hypervisor with lld 6.0.0.

The only difference between v2 is the split into multiple patches.

Thanks, Roger.

Roger Pau Monne (3):
xen/x86: replace '||' usage in the linker script xen/compiler: introduce a define for weak symbols xen/x86: declare the efi symbol as weak

 xen/arch/x86/xen.lds.S              | 4 +---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/efi.h               | 2 +-
 xen/include/xen/livepatch_payload.h | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v3 1/3 xen/x86: replace '||' usage in the linker script

With '|'. The result is the same, and the later works with lld. Fixes the following error when building Xen with lld:

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:260: malformed number: |

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ASSERT(__image_base__ > (((((((((261 >> 8) * 0xffff000000000000) | (261 << 39))) + ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||

                                                                                                                                              ^

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/arch/x86/xen.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/xen.lds.S +1 -1
index 70afedd31d..326e885402 100644
@@ -331,7 +331,7 @@ SECTIONS
   .comment 0 : { *(.comment) }
 }
 
-ASSERT(__image_base__ > XEN_VIRT_START ||
+ASSERT(__image_base__ > XEN_VIRT_START |
        __2M_rwdata_end <= XEN_VIRT_END - NR_CPUS * PAGE_SIZE,
        "Xen image overlaps stubs area")
 
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

Re: [PATCH v3 1/3] xen/x86: replace '||' usage in the linker script

Quoted 23 lines · Roger Pau Monne

With '|'. The result is the same, and the later works with lld. Fixes the following error when building Xen with lld:

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:260: malformed number: |

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ASSERT(__image_base__ > (((((((((261 >> 8) * 0xffff000000000000) | (261 << 39))) + ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||

                                                                                                                                              ^

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/arch/x86/xen.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/xen.lds.S +0 -0
index 70afedd31d..326e885402 100644

xen/arch/x86/xen.lds.S SECTIONS · line 336

Quoted 7 lines
xen/arch/x86/xen.lds.S +1 -1
@@ -331,7 +331,7 @@ SECTIONS
   .comment 0 : { *(.comment) }
 }
 
-ASSERT(__image_base__ > XEN_VIRT_START ||
+ASSERT(__image_base__ > XEN_VIRT_START |
        __2M_rwdata_end <= XEN_VIRT_END - NR_CPUS * PAGE_SIZE,
        "Xen image overlaps stubs area")

I am not happy with this change. Is the same needed for any "&&"? Anyway, if maintainers are OK with that I will just ask you to put the comment before the ASSERT() why you use "|" instead of "||".

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Re: [PATCH v3 1/3] xen/x86: replace '||' usage in the linker script

Quoted 27 lines · Daniel Kiper
Quoted 26 lines · Roger Pau Monne

With '|'. The result is the same, and the later works with lld. Fixes the following error when building Xen with lld:

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:260: malformed number: |

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ASSERT(__image_base__ > (((((((((261 >> 8) * 0xffff000000000000) | (261 << 39))) + ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||

                                                                                                                                              ^

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/arch/x86/xen.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/xen.lds.S +0 -0
index 70afedd31d..326e885402 100644
@@ -331,7 +331,7 @@ SECTIONS
   .comment 0 : { *(.comment) }
 }
 
Quoted 6 lines

xen/arch/x86/xen.lds.S SECTIONS · line 336

Quoted 4 lines
xen/arch/x86/xen.lds.S +1 -1
-ASSERT(__image_base__ > XEN_VIRT_START ||
+ASSERT(__image_base__ > XEN_VIRT_START |
        __2M_rwdata_end <= XEN_VIRT_END - NR_CPUS * PAGE_SIZE,
        "Xen image overlaps stubs area")

I am not happy with this change. Is the same needed for any "&&"?

I haven't tried, but I assume both '||' and '&&' would be equally broken. There's no '&&' ATM anyway.

Quoted 2 lines

Anyway, if maintainers are OK with that I will just ask you to put the comment before the ASSERT() why you use "|" instead of "||".

OK, I can add something like:

"lld (LLVM linker) version 6.0.0 doesn't support '||', so use '|' instead."

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Re: [PATCH v3 1/3] xen/x86: replace '||' usage in the linker script

Quoted 38 lines · Roger Pau Monné
Quoted 27 lines · Daniel Kiper
Quoted 26 lines · Roger Pau Monne

With '|'. The result is the same, and the later works with lld. Fixes the following error when building Xen with lld:

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:260: malformed number: |

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ASSERT(__image_base__ > (((((((((261 >> 8) * 0xffff000000000000) | (261 << 39))) + ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||

                                                                                                                                              ^

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/arch/x86/xen.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/xen.lds.S +0 -0
index 70afedd31d..326e885402 100644
@@ -331,7 +331,7 @@ SECTIONS
   .comment 0 : { *(.comment) }
 }
 
Quoted 6 lines

xen/arch/x86/xen.lds.S SECTIONS · line 336

Quoted 4 lines
xen/arch/x86/xen.lds.S +1 -1
-ASSERT(__image_base__ > XEN_VIRT_START ||
+ASSERT(__image_base__ > XEN_VIRT_START |
        __2M_rwdata_end <= XEN_VIRT_END - NR_CPUS * PAGE_SIZE,
        "Xen image overlaps stubs area")

I am not happy with this change. Is the same needed for any "&&"?

I haven't tried, but I assume both '||' and '&&' would be equally broken. There's no '&&' ATM anyway.

Quoted 7 lines
Quoted 2 lines

Anyway, if maintainers are OK with that I will just ask you to put the comment before the ASSERT() why you use "|" instead of "||".

OK, I can add something like:

"lld (LLVM linker) version 6.0.0 doesn't support '||', so use '|' instead."

I am OK with that.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

PATCH v3 2/3 xen/compiler: introduce a define for weak symbols

In reply to Roger Pau Monne

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/livepatch_payload.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/compiler.h +2 -0
index a7e05681c9..001f589655 100644
@@ -18,6 +18,8 @@
 
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((weak))
+
 #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
 #define unreachable() do {} while (1)
 #else
xen/include/xen/livepatch_payload.h +2 -2
index 8f38cc2c60..4a1a96d054 100644
@@ -24,7 +24,7 @@ typedef void livepatch_unloadcall_t(void);
  * executed in series by the livepatch infrastructure at patch load time.
  */
 #define LIVEPATCH_LOAD_HOOK(_fn) \
-    livepatch_loadcall_t *__attribute__((weak)) \
+    livepatch_loadcall_t *__weak \
         const livepatch_load_data_##_fn __section(".livepatch.hooks.load") = _fn;
 
 /*
@@ -33,7 +33,7 @@ typedef void livepatch_unloadcall_t(void);
  * Same as LOAD hook with s/load/unload/
  */
 #define LIVEPATCH_UNLOAD_HOOK(_fn) \
-     livepatch_unloadcall_t *__attribute__((weak)) \
+     livepatch_unloadcall_t *__weak \
         const livepatch_unload_data_##_fn __section(".livepatch.hooks.unload") = _fn;
 
 #endif /* __XEN_LIVEPATCH_PAYLOAD_H__ */
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

Forgot to Cc maintainers.

Quoted 51 lines · Roger Pau Monne

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/livepatch_payload.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/compiler.h +2 -0
index a7e05681c9..001f589655 100644
@@ -18,6 +18,8 @@
 
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((weak))
+
 #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
 #define unreachable() do {} while (1)
 #else
xen/include/xen/livepatch_payload.h +2 -2
index 8f38cc2c60..4a1a96d054 100644
@@ -24,7 +24,7 @@ typedef void livepatch_unloadcall_t(void);
  * executed in series by the livepatch infrastructure at patch load time.
  */
 #define LIVEPATCH_LOAD_HOOK(_fn) \
-    livepatch_loadcall_t *__attribute__((weak)) \
+    livepatch_loadcall_t *__weak \
         const livepatch_load_data_##_fn __section(".livepatch.hooks.load") = _fn;
 
 /*
@@ -33,7 +33,7 @@ typedef void livepatch_unloadcall_t(void);
  * Same as LOAD hook with s/load/unload/
  */
 #define LIVEPATCH_UNLOAD_HOOK(_fn) \
-     livepatch_unloadcall_t *__attribute__((weak)) \
+     livepatch_unloadcall_t *__weak \
         const livepatch_unload_data_##_fn __section(".livepatch.hooks.unload") = _fn;
 
 #endif /* __XEN_LIVEPATCH_PAYLOAD_H__ */
Signature · 1 line
2.17.1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 09:29, <[email protected]> wrote:

Forgot to Cc maintainers.

Konrad, Ross: Ping?

Jan

Quoted 41 lines · Roger Pau Monne

Review

Quoted 27 lines

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/livepatch_payload.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/compiler.h +2 -0
index a7e05681c9..001f589655 100644
@@ -18,6 +18,8 @@
 
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((weak))
+
 #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
 #define unreachable() do {} while (1)
 #else
(quoted diff) +0 -0

b/xen/include/xen/livepatch_payload.h

xen/include/xen/livepatch_payload.h typedef void livepatch_unloadcall_t(void); · line 28

Quoted 10 lines

index 8f38cc2c60..4a1a96d054 100644

xen/include/xen/livepatch_payload.h +1 -1
@@ -24,7 +24,7 @@ typedef void livepatch_unloadcall_t(void);
  * executed in series by the livepatch infrastructure at patch load time.
  */
 #define LIVEPATCH_LOAD_HOOK(_fn) \
-    livepatch_loadcall_t *__attribute__((weak)) \
+    livepatch_loadcall_t *__weak \
         const livepatch_load_data_##_fn __section(".livepatch.hooks.load") 

= _fn;

Quoted 1 line
Quoted 14 lines

xen/include/xen/livepatch_payload.h typedef void livepatch_unloadcall_t(void); · line 37

Quoted 8 lines

/*

xen/include/xen/livepatch_payload.h +1 -1
@@ -33,7 +33,7 @@ typedef void livepatch_unloadcall_t(void);
  * Same as LOAD hook with s/load/unload/
  */
 #define LIVEPATCH_UNLOAD_HOOK(_fn) \
-     livepatch_unloadcall_t *__attribute__((weak)) \
+     livepatch_unloadcall_t *__weak \
         const livepatch_unload_data_##_fn 

__section(".livepatch.hooks.unload") = _fn;

Quoted 5 lines
xen/include/xen/livepatch_payload.h +0 -0
 #endif /* __XEN_LIVEPATCH_PAYLOAD_H__ */
Signature · 1 line
2.17.1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

Quoted 4 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 09:29, <[email protected]> wrote:

Forgot to Cc maintainers.

Konrad, Ross: Ping?

Daniel? Anyway, I will take a look at this no later than tomorrow. Sorry for delay but I was swamped with other important stuff.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 24.07.18 at 15:51, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 09:29, <[email protected]> wrote:

Forgot to Cc maintainers.

Konrad, Ross: Ping?

Daniel? Anyway, I will take a look at this no later than tomorrow. Sorry for delay but I was swamped with other important stuff.

Well, I was sort of implying that it might take you a little longer to get there, but the patch here is not depending on your double checking - that's just patch 3.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 24.07.18 at 15:51, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 09:29, <[email protected]> wrote:

Forgot to Cc maintainers.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Konrad, Ross: Ping?

Daniel? Anyway, I will take a look at this no later than tomorrow. Sorry for delay but I was swamped with other important stuff.

Well, I was sort of implying that it might take you a little longer to get there, but the patch here is not depending on your double checking - that's just patch 3.

Note that patch 3 has been superseded by:

https://lists.xenproject.org/archives/html/xen-devel/2018-07/msg01644.html

git://xenbits.xen.org/people/royger/xen.git efi.v4

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by
#11 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

In reply to Jan Beulich
Quoted 16 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 09:29, <[email protected]> wrote:

Forgot to Cc maintainers.

Konrad, Ross: Ping?

Jan

Quoted 9 lines · Roger Pau Monne
Quoted 8 lines

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

In reply to Jan Beulich
Quoted 4 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 09:29, <[email protected]> wrote:

Forgot to Cc maintainers.

Konrad, Ross: Ping?

Thank you!

Quoted 61 lines

Jan

Quoted 55 lines · Roger Pau Monne

Review

Quoted 27 lines

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/livepatch_payload.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/compiler.h +2 -0
index a7e05681c9..001f589655 100644
@@ -18,6 +18,8 @@
 
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((weak))
+
 #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
 #define unreachable() do {} while (1)
 #else
(quoted diff) +0 -0

b/xen/include/xen/livepatch_payload.h

xen/include/xen/livepatch_payload.h typedef void livepatch_unloadcall_t(void); · line 28

Quoted 10 lines

index 8f38cc2c60..4a1a96d054 100644

xen/include/xen/livepatch_payload.h +1 -1
@@ -24,7 +24,7 @@ typedef void livepatch_unloadcall_t(void);
  * executed in series by the livepatch infrastructure at patch load time.
  */
 #define LIVEPATCH_LOAD_HOOK(_fn) \
-    livepatch_loadcall_t *__attribute__((weak)) \
+    livepatch_loadcall_t *__weak \
         const livepatch_load_data_##_fn __section(".livepatch.hooks.load") 

= _fn;

xen/include/xen/livepatch_payload.h typedef void livepatch_unloadcall_t(void); · line 37

Quoted 9 lines
xen/include/xen/livepatch_payload.h +1 -1
 /*
@@ -33,7 +33,7 @@ typedef void livepatch_unloadcall_t(void);
  * Same as LOAD hook with s/load/unload/
  */
 #define LIVEPATCH_UNLOAD_HOOK(_fn) \
-     livepatch_unloadcall_t *__attribute__((weak)) \
+     livepatch_unloadcall_t *__weak \
         const livepatch_unload_data_##_fn 

__section(".livepatch.hooks.unload") = _fn;

Quoted 5 lines
xen/include/xen/livepatch_payload.h +0 -0
 #endif /* __XEN_LIVEPATCH_PAYLOAD_H__ */
Signature · 1 line
2.17.1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

In reply to Roger Pau Monne
Quoted 18 lines · Roger Pau Monne

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/livepatch_payload.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/compiler.h +0 -0
index a7e05681c9..001f589655 100644

xen/include/xen/compiler.h line 21

Quoted 4 lines
xen/include/xen/compiler.h +1 -0
@@ -18,6 +18,8 @@
 
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((weak))

__week__  (can be fixed on commit)

Otherwise, Reivewed-by: Andrew Cooper <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

Re: [PATCH v3 2/3] xen/compiler: introduce a define for weak symbols

Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 13:37, <[email protected]> wrote:
Quoted 19 lines · Roger Pau Monne

And replace the open-coded versions already in tree. No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/include/xen/compiler.h          | 2 ++
 xen/include/xen/livepatch_payload.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
xen/include/xen/compiler.h +0 -0
index a7e05681c9..001f589655 100644
@@ -18,6 +18,8 @@
 
Quoted 5 lines

xen/include/xen/compiler.h line 21

Quoted 3 lines
xen/include/xen/compiler.h +1 -0
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((weak))

__week__ (can be fixed on commit)

Oh, indeed, as long as you mean __weak__.

Quoted 1 line

Otherwise, Reivewed-by: Andrew Cooper <[email protected]>

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw

PATCH v3 3/3 xen/x86: declare the efi symbol as weak

In reply to Roger Pau Monne

This allows removing the DEFINED conditional in the linker script, and fixes compilation with lld:

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:233: symbol not found: efi

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Daniel Kiper <[email protected]>

---
 xen/arch/x86/xen.lds.S | 2 --
 xen/include/xen/efi.h  | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
xen/arch/x86/xen.lds.S +0 -2
index 326e885402..9fa40a6d48 100644
@@ -304,8 +304,6 @@ SECTIONS
   } :text
 #endif
 
-  efi = DEFINED(efi) ? efi : .;
-
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exit.text)
xen/include/xen/efi.h +1 -1
index 44b7d3ec3a..5678df72f9 100644
@@ -21,7 +21,7 @@ struct efi {
     unsigned long smbios3;      /* SMBIOS v3 table */
 };
 
-extern struct efi efi;
+extern struct efi __weak efi;
 
 #ifndef __ASSEMBLY__
 
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#16 lore raw

Re: [PATCH v3 3/3] xen/x86: declare the efi symbol as weak

Quoted 2 lines · Roger Pau Monne

This allows removing the DEFINED conditional in the linker script, and fixes compilation with lld:

s/lld/LLVM linker/?

Could you mention the version of LLVM linker in the commit message? And I am still not sure why do you insist on this patch series. IIRC you have told us that both issues will be fixed in LLVM.

Quoted 5 lines

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:233: symbol not found: efi

With this patch applied ld from binutils 2.22 complains in this way:

ld -melf_x86_64 -T xen.lds -N prelink.o --build-id=sha1 \
xen/common/symbols-dummy.o -o xen/.xen-syms.0
prelink.o: In function `acpi_os_get_root_pointer':
xen/drivers/acpi/osl.c:73:(.init.text+0x192e9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/drivers/acpi/osl.c:75:(.init.text+0x192f6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' prelink.o: In function `efi_check_config':
xen/arch/x86/mpparse.c:702:(.init.text+0x238ce): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/mpparse.c:706:(.init.text+0x238f2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' prelink.o: In function `dmi_efi_iterate':
xen/arch/x86/dmi_scan.c:377:(.init.text+0x3666f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:391:(.init.text+0x366d7): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:400:(.init.text+0x36735): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:414:(.init.text+0x367b1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi'

Everything works with binutils 2.28.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#17 lore raw

Re: [PATCH v3 3/3] xen/x86: declare the efi symbol as weak

Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 13:35, <[email protected]> wrote:
Quoted 2 lines · Roger Pau Monne

This allows removing the DEFINED conditional in the linker script, and fixes compilation with lld:

s/lld/LLVM linker/?

Could you mention the version of LLVM linker in the commit message? And I am still not sure why do you insist on this patch series. IIRC you have told us that both issues will be fixed in LLVM.

Quoted 5 lines

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:233: symbol not found: efi

With this patch applied ld from binutils 2.22 complains in this way:

Quoted 13 lines

ld -melf_x86_64 -T xen.lds -N prelink.o --build-id=sha1 \
xen/common/symbols-dummy.o -o xen/.xen-syms.0
prelink.o: In function `acpi_os_get_root_pointer':
xen/drivers/acpi/osl.c:73:(.init.text+0x192e9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/drivers/acpi/osl.c:75:(.init.text+0x192f6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' prelink.o: In function `efi_check_config':
xen/arch/x86/mpparse.c:702:(.init.text+0x238ce): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/mpparse.c:706:(.init.text+0x238f2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' prelink.o: In function `dmi_efi_iterate':
xen/arch/x86/dmi_scan.c:377:(.init.text+0x3666f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:391:(.init.text+0x366d7): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:400:(.init.text+0x36735): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:414:(.init.text+0x367b1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi'

Oh, I could indeed have thought of this risk.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#18 lore raw

Re: [PATCH v3 3/3] xen/x86: declare the efi symbol as weak

In reply to Daniel Kiper
Quoted 9 lines · Daniel Kiper
Quoted 2 lines · Roger Pau Monne

This allows removing the DEFINED conditional in the linker script, and fixes compilation with lld:

s/lld/LLVM linker/?

Could you mention the version of LLVM linker in the commit message? And I am still not sure why do you insist on this patch series. IIRC you have told us that both issues will be fixed in LLVM.

Right, but I have no idea when lld 7.0.0 will be released, much less when it will be merged into FreeBSD base system.

Quoted 8 lines
Quoted 5 lines

ld -melf_x86_64_fbsd -T xen.lds -N prelink.o --build-id=sha1 \
/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
ld: error: xen.lds:233: symbol not found: efi

With this patch applied ld from binutils 2.22 complains in this way:

Quoted 13 lines

ld -melf_x86_64 -T xen.lds -N prelink.o --build-id=sha1 \
xen/common/symbols-dummy.o -o xen/.xen-syms.0
prelink.o: In function `acpi_os_get_root_pointer':
xen/drivers/acpi/osl.c:73:(.init.text+0x192e9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/drivers/acpi/osl.c:75:(.init.text+0x192f6): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' prelink.o: In function `efi_check_config':
xen/arch/x86/mpparse.c:702:(.init.text+0x238ce): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/mpparse.c:706:(.init.text+0x238f2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' prelink.o: In function `dmi_efi_iterate':
xen/arch/x86/dmi_scan.c:377:(.init.text+0x3666f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:391:(.init.text+0x366d7): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:400:(.init.text+0x36735): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi' xen/arch/x86/dmi_scan.c:414:(.init.text+0x367b1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol efi'

Hm, weird. I've tested with ld 2.17.50 and it worked fine. Seems like gitlab is able to reproduce this, so let me see if I can solve it.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#19 lore raw

Re: [PATCH v3 3/3] xen/x86: declare the efi symbol as weak

Quoted 5 lines · Roger Pau Monné
Quoted 4 lines · Daniel Kiper
Quoted 2 lines · Roger Pau Monne

This allows removing the DEFINED conditional in the linker script, and fixes compilation with lld:

Quoted 8 lines
Quoted 5 lines

s/lld/LLVM linker/?

Could you mention the version of LLVM linker in the commit message? And I am still not sure why do you insist on this patch series. IIRC you have told us that both issues will be fixed in LLVM.

Right, but I have no idea when lld 7.0.0 will be released, much less when it will be merged into FreeBSD base system.

Please add something like that to the commit messages of both patches.

Daniel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on the v3 series
#20 lore raw
In reply to Roger Pau Monne
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 17:34, <[email protected]> wrote:

Hello,

The following 3 patches allow building the hypervisor with lld 6.0.0.

Quoted 8 lines

The only difference between v2 is the split into multiple patches.

Thanks, Roger.

Roger Pau Monne (3):
xen/x86: replace '||' usage in the linker script xen/compiler: introduce a define for weak symbols xen/x86: declare the efi symbol as weak

Patch 2 should have been Cc-ed to Konrad and Ross though.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel