[prev in list] [next in list] [prev in thread] [next in thread]
List: grub-devel
Subject: Re: Failed to build with "-mretpoline"
From: "Vladimir 'phcoder' Serbinenko" <phcoder () gmail ! com>
Date: 2024-02-22 17:32:40
Message-ID: CAEaD8JP0QM40U32SaHLFdf+5_5uXNqw6n1VhV+tDtDNdOzPthw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello. Why does it create duplicate global symbols? How does LD handle the
same situation?
Le ven. 9 févr. 2024, 16:58, Oleksiy Obitotskyi -X (oobitots - GLOBALLOGIC
INC at Cisco) via Grub-devel <grub-devel@gnu.org> a écrit :
> Hi,
>
> We are bulding grub with clang that use -mretpoline option. This leads to
> symbols __llvm_retpoline_[eax/ecx/edx, etc.] generated into binaries. And
> caused duplicates error during moddep.lst creation.
> I'm not sure if this fix will be a bit project specific?
>
> diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk
> index 2474363..f859854 100644
> --- a/grub-core/genmoddep.awk
> +++ b/grub-core/genmoddep.awk
> @@ -18,7 +18,7 @@ BEGIN {
> {
> if ($1 == "defined") {
> - if ($3 !~ /^\.refptr\./ && $3 in symtab) {
> + if ($3 !~ /__llvm_retpoline_.*/ && $3 !~ /^\.refptr\./ && $3 in symtab) {
> printf "%s in %s is duplicated in %s\n", $3, $2, symtab[$3] >"/dev/stderr";
> error++;
> }
>
> Regards,
> Oleksiy
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
[Attachment #5 (text/html)]
<div dir="auto">Hello. Why does it create duplicate global symbols? How does LD \
handle the same situation?</div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">Le ven. 9 févr. 2024, 16:58, Oleksiy Obitotskyi -X (oobitots - \
GLOBALLOGIC INC at Cisco) via Grub-devel <<a \
href="mailto:grub-devel@gnu.org">grub-devel@gnu.org</a>> a écrit \
:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">
<br>
</div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">We \
are bulding grub with clang that use -mretpoline option. This leads to symbols \
__llvm_retpoline_[eax/ecx/edx, etc.] generated into binaries. And caused \
duplicates error during moddep.lst creation.</span></div> <div><span \
style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">I'm \
not sure if this fix will be a bit project specific?</span></div> <div><span \
style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)"><br>
</span></div>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">diff \
--git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">index \
2474363..f859854 100644</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">--- \
a/grub-core/genmoddep.awk</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">+++ \
b/grub-core/genmoddep.awk</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">@@ \
-18,7 +18,7 @@ BEGIN {</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">{</span></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">if \
($1 == "defined") {</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">- \
if ($3 !~ /^\.refptr\./ && $3 in symtab) {</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">+ \
if ($3 !~ /__llvm_retpoline_.*/ && $3 !~ /^\.refptr\./ && $3 in \
symtab) {</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">printf \
"%s in %s is duplicated in %s\n", $3, $2, symtab[$3] \
>"/dev/stderr";</span></td> </tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">error++;</span></td>
</tr>
</tbody>
</table>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">}</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">Regards,</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:11pt;color:rgb(0,0,0)">Oleksiy<br>
</span></div>
</div>
_______________________________________________<br>
Grub-devel mailing list<br>
<a href="mailto:Grub-devel@gnu.org" target="_blank" \
rel="noreferrer">Grub-devel@gnu.org</a><br> <a \
href="https://lists.gnu.org/mailman/listinfo/grub-devel" rel="noreferrer noreferrer" \
target="_blank">https://lists.gnu.org/mailman/listinfo/grub-devel</a><br> \
</blockquote></div>
[Attachment #6 (text/plain)]
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic