xen/x86: fix linker script to work with lld
PATCH 1/1 xen/x86: fix linker script to work with lld
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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))) ||^
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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
Fix the first issue by using '|' instead of '||', and the second one by defining the efi symbol based on the EFI define (like it was done prior to commit b199c44afa).
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/arch/x86/xen.lds.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/xen.lds.S +3 -3
@@ -302,10 +302,10 @@ SECTIONS .pad : { . = ALIGN(MB(16)); } :text +#else + efi = .; #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)
@@ -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
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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))) ||^And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
Quoted 7 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: efiFix the first issue by using '|' instead of '||', and the second one by defining the efi symbol based on the EFI define (like it was done prior to commit
b199c44afa).
Hmm, the second one is a direct revert of the original commit's hunk. There must have been a reason for Daniel to change it, and hence undoing it might break what he wants needs. You should have Cc-ed him right away.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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))) ||^And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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
Quoted 7 lines
Quoted 3 lines
Fix the first issue by using '|' instead of '||', and the second one by defining the efi symbol based on the EFI define (like it was done prior to commit
b199c44afa).Hmm, the second one is a direct revert of the original commit's hunk. There must have been a reason for Daniel to change it, and hence undoing it might break what he wants needs. You should have Cc-ed him right away.
In fact I though I Cc'ed Daniel, but I clearly didn't. Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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))) ||^
Quoted 6 lines
Quoted 6 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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
This smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly DEFINED() states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 21 lines · Daniel Kiper
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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))) ||^Quoted 6 lines
Quoted 6 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
Quoted 6 lines
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.
Yes, I know it's a bug in llvm ld. The '||' issue has already been fixed upstream, and I hope the DEFINED one won't take long to get fixed also.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 << 39)))+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
Quoted 6 lines
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.
Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 << 39)))+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
Quoted 8 lines
Quoted 4 lines
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
After commit b199c44 both ELF and PE output need an efi symbol. So, we cannot use simple "#ifdef EFI" for differentiation as it was earlier. Going further if build tools are able to generate EFI code then native Xen EFI code which provides efi symbol is build. Otherwise Xen EFI stub code is used and efi symbol is provided by linker script. IIRC you insisted on that. The issue can be solved by adding efi symbol to the Xen EFI stub code (we can just simply copy existing efi struct from native Xen EFI code) and removing relevant line from linker script.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 32 lines · Daniel Kiper
Quoted 31 lines · Jan Beulich
Quoted 30 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 << 39)))+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.
Quoted 6 lines
Quoted 3 lines
Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
After commit b199c44 both ELF and PE output need an efi symbol. So, we cannot use simple "#ifdef EFI" for differentiation as it was earlier.
I'm not sure I follow, why is that not an option?
Can you detail which conditions will make the build to fail with the proposed patch?
I assume that for the ELF output the EFI code is not added to the image, and as such it requires the efi symbol to be defined because it's referenced from common code?
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 37 lines · Roger Pau Monné
Quoted 36 lines · Daniel Kiper
Quoted 34 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 << 39)))+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
Quoted 6 lines
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
Quoted 7 lines
Quoted 2 lines
After commit b199c44 both ELF and PE output need an efi symbol. So, we cannot use simple "#ifdef EFI" for differentiation as it was earlier.
I'm not sure I follow, why is that not an option?
Can you detail which conditions will make the build to fail with the proposed patch?
The problem is that your patch will change efi symbol address in ELF output. The symbol is provided by Xen EFI runtime code. So, this way Xen will not work on EFI platform if it is loaded from GRUB2.
Quoted 3 lines
I assume that for the ELF output the EFI code is not added to the image, and as such it requires the efi symbol to be defined because it's referenced from common code?
EFI code is added to the ELF image because it has to run on EFI platforms too. Of course via GRUB2 or to be more precise any Multiboot2 compatible boot loader.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 50 lines · Daniel Kiper
Quoted 37 lines · Roger Pau Monné
Quoted 36 lines · Daniel Kiper
Quoted 34 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 << 39)))+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
Quoted 6 lines
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
Quoted 7 lines
Quoted 2 lines
After commit b199c44 both ELF and PE output need an efi symbol. So, we cannot use simple "#ifdef EFI" for differentiation as it was earlier.
I'm not sure I follow, why is that not an option?
Can you detail which conditions will make the build to fail with the proposed patch?
The problem is that your patch will change efi symbol address in ELF output. The symbol is provided by Xen EFI runtime code. So, this way Xen will not work on EFI platform if it is loaded from GRUB2.
Quoted 7 lines
Quoted 3 lines
I assume that for the ELF output the EFI code is not added to the image, and as such it requires the efi symbol to be defined because it's referenced from common code?
EFI code is added to the ELF image because it has to run on EFI platforms too. Of course via GRUB2 or to be more precise any Multiboot2 compatible boot loader.
So now both the ELF and the PE binaries will contain the efi symbol? Then which binary doesn't contain it?
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 55 lines · Roger Pau Monné
Quoted 54 lines · Daniel Kiper
Quoted 37 lines · Roger Pau Monné
Quoted 36 lines · Daniel Kiper
Quoted 34 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 << 39)))+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
Quoted 6 lines
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
Quoted 7 lines
Quoted 2 lines
After commit b199c44 both ELF and PE output need an efi symbol. So, we cannot use simple "#ifdef EFI" for differentiation as it was earlier.
I'm not sure I follow, why is that not an option?
Can you detail which conditions will make the build to fail with the proposed patch?
The problem is that your patch will change efi symbol address in ELF output. The symbol is provided by Xen EFI runtime code. So, this way Xen will not work on EFI platform if it is loaded from GRUB2.
Quoted 3 lines
I assume that for the ELF output the EFI code is not added to the image, and as such it requires the efi symbol to be defined because it's referenced from common code?
Quoted 6 lines
Quoted 3 lines
EFI code is added to the ELF image because it has to run on EFI platforms too. Of course via GRUB2 or to be more precise any Multiboot2 compatible boot loader.
So now both the ELF and the PE binaries will contain the efi symbol? Then which binary doesn't contain it?
Both always. The difference is where it come from. If build tools (compiler and linker) are able to generate PE files then efi symbol is derived from source files (xen/common/efi/runtime.c to be precise). Otherwise it is derived from xen.lds.S.
Quoted 2 lines
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
If you wish to do that then put dummy efi symbol into xen/arch/x86/efi/stub.c.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 70 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
Quoted 6 lines · Roger Pau Monné
Quoted 5 lines · Daniel Kiper
Quoted 4 lines · Roger Pau Monné
Quoted 3 lines · Daniel Kiper
Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 03.07.18 at 18:02, <[email protected]> wrote:
On Thu, Jun 28, 2018 at 11:35:24PM -0600, Jan Beulich wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Roger Pau Monne <[email protected]> 06/28/18 5:38 PM >>>
lld (the llvm linker) has some issues with Xen linker script. It doesn't understand '||' in assert expressions:
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 1 line
Quoted 1 line
Quoted 1 line
ASSERT(__image_base__ > (((((((((261 >> 8) *
0xffff000000000000) | (261 <<39)))
Quoted 41 lines
Quoted 41 lines
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 14 lines
+ ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
^Quoted 7 lines
Quoted 7 lines
And doesn't work properly with the 'DEFINED(foo) ? foo : ...' expression:
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: efiThis smells like lld bug. efi symbol is clearly undefined in prelink.o (lld does not support i386pep emulation):
Quoted 6 lines
11147: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND efi
However, surprisingly
DEFINED()states that it is and ternary operator fires address calculation from undefined symbol. So, I think that lld have to be fixed instead of Xen. It should be noted that binutils ld works without any issue.Right, but if we can make Xen build nevertheless, this would be better. So what we need here is a (re-)explanation of why you've needed to do the very change Roger is suggesting to revert.
Quoted 7 lines
Quoted 2 lines
After commit b199c44 both ELF and PE output need an efi symbol. So, we cannot use simple "#ifdef EFI" for differentiation as it was earlier.
I'm not sure I follow, why is that not an option?
Can you detail which conditions will make the build to fail with the proposed patch?
The problem is that your patch will change efi symbol address in ELF output. The symbol is provided by Xen EFI runtime code. So, this way Xen will not work on EFI platform if it is loaded from GRUB2.
Quoted 3 lines
I assume that for the ELF output the EFI code is not added to the image, and as such it requires the efi symbol to be defined because it's referenced from common code?
Quoted 6 lines
Quoted 3 lines
EFI code is added to the ELF image because it has to run on EFI platforms too. Of course via GRUB2 or to be more precise any Multiboot2 compatible boot loader.
So now both the ELF and the PE binaries will contain the efi symbol? Then which binary doesn't contain it?
Both always. The difference is where it come from. If build tools (compiler and linker) are able to generate PE files then efi symbol is derived from source files (
xen/common/efi/runtime.cto be precise). Otherwise it is derived fromxen.lds.S.
Quoted 5 lines
Quoted 2 lines
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.
I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
On Mon, Jul 09, 2018 at 06:45:16PM +0200, Roger Pau Monné wrote:
[...]
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
Yes, I remember that. Though I do not have better idea if we wish to drop DEFINED() from xen.lds.S.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
Quoted 2 lines · Roger Pau Monné
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
But such waste is also added regardless of whether you define the symbol it in the linker script or in a C file?
Thank, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 15:49, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
Quoted 2 lines · Roger Pau Monné
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
But such waste is also added regardless of whether you define the symbol it in the linker script or in a C file?
How that? There's no space associated with the symbol when defined this way. From the perspective of the binary, the space lives past the end of the image, but since the symbol is never accessed (or else code is broken somewhere) in the non-EFI case, this is okay.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 15:49, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
Quoted 2 lines · Roger Pau Monné
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
Quoted 7 lines
Quoted 2 lines
But such waste is also added regardless of whether you define the symbol it in the linker script or in a C file?
How that? There's no space associated with the symbol when defined this way. From the perspective of the binary, the space lives past the end of the image, but since the symbol is never accessed (or else code is broken somewhere) in the non-EFI case, this is okay.
Oh right, that's not inside of any section.
I've tried placing an efi symbol inside of the .discard section but that doesn't work. I'm open to suggestions since I don't have any more ideas about how to fix this.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 17:35, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 15:49, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
Quoted 2 lines · Roger Pau Monné
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
Quoted 7 lines
Quoted 2 lines
But such waste is also added regardless of whether you define the symbol it in the linker script or in a C file?
How that? There's no space associated with the symbol when defined this way. From the perspective of the binary, the space lives past the end of the image, but since the symbol is never accessed (or else code is broken somewhere) in the non-EFI case, this is okay.
Quoted 4 lines
Oh right, that's not inside of any section.
I've tried placing an efi symbol inside of the .discard section but that doesn't work.
In which way?
Quoted 2 lines
I'm open to suggestions since I don't have any more ideas about how to fix this.
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 17:35, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 15:49, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 10.07.18 at 13:00, <[email protected]> wrote:
Quoted 2 lines · Roger Pau Monné
Sorry for asking so many questions, but I would like to try to avoid the DEFINED conditional in the linker script if possible.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If you wish to do that then put dummy efi symbol into
xen/arch/x86/efi/stub.c.I think I've clearly objected to that before - I simply see no need for wasting the space in an EFI-incapable binary.
But such waste is also added regardless of whether you define the symbol it in the linker script or in a C file?
How that? There's no space associated with the symbol when defined this way. From the perspective of the binary, the space lives past the end of the image, but since the symbol is never accessed (or else code is broken somewhere) in the non-EFI case, this is okay.
Quoted 6 lines
Quoted 4 lines
Oh right, that's not inside of any section.
I've tried placing an efi symbol inside of the .discard section but that doesn't work.
In which way?
linker complains about missing symbol:
efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section .discard' of prelink.o efi' referenced in section .init.text' of prelink.o: defined in discarded section `.discard' of prelink.o
This is with:
xen/arch/x86/efi/stub.c +2 -0
@@ -17,6 +17,8 @@* efi_multiboot2() is an exception. Please look below for more details. */ +struct efi __used_section(".discard") efi; +void __init noreturnefi_multiboot2 (EFI_HANDLE ImageHandle,EFI_SYSTEM_TABLE *SystemTable) {
xen/arch/x86/xen.lds.S +0 -2
@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)
Quoted 5 lines
Quoted 2 lines
I'm open to suggestions since I don't have any more ideas about how to fix this.
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0 -2
@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)
xen/include/xen/efi.h +1 -1
@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__
If that's acceptable I will refresh and resend the patch.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 10:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0
-2@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)xen/include/xen/efi.h +1
-1@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__
Quoted 1 line
If that's acceptable I will refresh and resend the patch.
Let's see what Daniel and maybe others say. If you go that route, could I talk you into adding __weak to compiler.h (I dislike to suggest the leading double underscores, but not using them there would just be too inconsistent with the rest of this header)?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 10:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0
-2@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)xen/include/xen/efi.h +1
-1@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__
Quoted 6 lines
Quoted 1 line
If that's acceptable I will refresh and resend the patch.
Let's see what Daniel and maybe others say. If you go that route, could I talk you into adding
__weaktocompiler.h(I dislike to suggest the leading double underscores, but not using them there would just be too inconsistent with the rest of this header)?
If this works in all cases (build with tools with and without PE support, xen.efi and xen.gz via Multiboot2 proto boot correctly on EFI platforms, etc.) then I am OK with that.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 43 lines · Daniel Kiper
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 10:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0
-2@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)xen/include/xen/efi.h +1
-1@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__Quoted 6 lines
Quoted 1 line
If that's acceptable I will refresh and resend the patch.
Let's see what Daniel and maybe others say. If you go that route, could I talk you into adding
__weaktocompiler.h(I dislike to suggest the leading double underscores, but not using them there would just be too inconsistent with the rest of this header)?
Quoted 3 lines
If this works in all cases (build with tools with and without PE support, xen.efi and xen.gz via Multiboot2 proto boot correctly on EFI platforms, etc.) then I am OK with that.
Yes, I've tested it with both linkers (PE capable and incapable) and it works.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 44 lines · Roger Pau Monné
Quoted 43 lines · Daniel Kiper
Quoted 41 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 10:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0
-2@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)xen/include/xen/efi.h +1
-1@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__Quoted 1 line
If that's acceptable I will refresh and resend the patch.
Let's see what Daniel and maybe others say. If you go that route, could I talk you into adding
__weaktocompiler.h(I dislike to suggest the leading double underscores, but not using them there would just be too inconsistent with the rest of this header)?
Quoted 6 lines
Quoted 3 lines
If this works in all cases (build with tools with and without PE support, xen.efi and xen.gz via Multiboot2 proto boot correctly on EFI platforms, etc.) then I am OK with that.
Yes, I've tested it with both linkers (PE capable and incapable) and it works.
Great! What about boot on EFI platforms? Probably it works but I would like to be sure.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Daniel Kiper
Quoted 7 lines · Roger Pau Monné
Quoted 3 lines · Daniel Kiper
If this works in all cases (build with tools with and without PE support, xen.efi and xen.gz via Multiboot2 proto boot correctly on EFI platforms, etc.) then I am OK with that.
Yes, I've tested it with both linkers (PE capable and incapable) and it works.
Great! What about boot on EFI platforms? Probably it works but I would like to be sure.
I'm afraid I don't have any ATM. If I post the complete patch, could you give it a try on a EFI platform?
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Roger Pau Monné
Quoted 6 lines · Daniel Kiper
Quoted 5 lines · Roger Pau Monné
Quoted 3 lines · Daniel Kiper
If this works in all cases (build with tools with and without PE support, xen.efi and xen.gz via Multiboot2 proto boot correctly on EFI platforms, etc.) then I am OK with that.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Yes, I've tested it with both linkers (PE capable and incapable) and it works.
Great! What about boot on EFI platforms? Probably it works but I would like to be sure.
I'm afraid I don't have any ATM. If I post the complete patch, could you give it a try on a EFI platform?
No problem, will do.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 10:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0
-2@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)xen/include/xen/efi.h +1
-1@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__
Quoted 6 lines
Quoted 1 line
If that's acceptable I will refresh and resend the patch.
Let's see what Daniel and maybe others say. If you go that route, could I talk you into adding
__weaktocompiler.h(I dislike to suggest the leading double underscores, but not using them there would just be too inconsistent with the rest of this header)?
Hm, the header is kind of mixed on the usage of underscores. inline, always_inline or noreturn for example don't have them, so if you prefer I think it should be fine to add weak without underscores.
There's an existing case of __attribute__((weak)) in livepatch_payload.h which I will replace in the same patch if that's fine.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 44 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 11:02, <[email protected]> wrote:
Quoted 35 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 11.07.18 at 10:29, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Another possible thing to try might be to make the extern declaration of the symbol weak, and drop the offending line altogether.
Oh, that didn't occur to me, and does seem to work. Below is what I've successfully tested:
xen/arch/x86/xen.lds.S +0
-2@@ -297,8 +297,6 @@ SECTIONS } :text #endif - efi = DEFINED(efi) ? efi : .; - /* Sections to be discarded */ /DISCARD/ : { *(.exit.text)xen/include/xen/efi.h +1
-1@@ -21,7 +21,7 @@ struct efi {unsigned long smbios3;/* SMBIOS v3 table */ }; -extern struct efi efi; +extern struct efi efi __attribute__((weak));#ifndef __ASSEMBLY__Quoted 6 lines
Quoted 1 line
If that's acceptable I will refresh and resend the patch.
Let's see what Daniel and maybe others say. If you go that route, could I talk you into adding
__weaktocompiler.h(I dislike to suggest the leading double underscores, but not using them there would just be too inconsistent with the rest of this header)?
Quoted 3 lines
Hm, the header is kind of mixed on the usage of underscores. inline,
always_inlineor noreturn for example don't have them, so if you prefer I think it should be fine to add weak without underscores.
"weak" alone is too generic an identifier to be #define-d in a header included by basically everything. And I dislike the "attribute_weak" naming scheme as well, for yielding too long identifiers (i.e. not providing any real savings over the spelled out __attribute__(())).
Quoted 3 lines
There's an existing case of __attribute__((weak)) in
livepatch_payload.hwhich I will replace in the same patch if that's fine.
Sure.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel