bug-grub
[Top][All Lists]
Advanced

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

Correctly handle "address@hidden" references in grub module object files


From: Brooks Moses
Subject: Correctly handle "address@hidden" references in grub module object files
Date: Fri, 9 Feb 2018 17:09:31 -0800

A recent change to LLVM [1] by Rafael Avila de Espindola causes it to
emit references to intrinsics such as memset as "address@hidden" rather
than simply "memset".  Per discussion on this change [2], this is
expected to be a non-change once the code is linked; the linker should
just degrade this to a normal "memset" reference when "memset" is a
locally-available symbol.  (And, in practice, that indeed appears to
be what standard Linux linkers do with it.)

However, this LLVM change causes Grub to complain about unsupported
relocation types, because it doesn't implement this ruie.

Also, this change of "memset" to "address@hidden" causes gas (but not the
LLVM assembler) to emit an undefined _GLOBAL_OFFSET_TABLE_ reference
in the object files, which Grub will need to ignore.  As Rafael notes,
this is common situation; Linux already has similar code [3].

Rafael sent along a (very simple) Grub patch to implement this linking
rule [4, copy attached], which we've tested on several x86
architectures and confirmed appears to produce correct behavior.

However, I was talking about this with my coworker (and Grub
developer) Vladimir Serbinenko, and he's concerned that the
"address@hidden" reference will instead require a full GOT implementation
in Grub.  I don't think that a full GOT implementation is the right
thing to do here (and it's not the intent of the LLVM change to
require such), but that's a question that needs to be resolved.

Anyway, regardless of when this (or another) patch lands, I'd like to
confirm that the Grub developers are happy with this general approach,
so that we can go ahead and accept this change into LLVM.

Thanks much!


[1] https://reviews.llvm.org/D42224

[2] 
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180205/522560.html
and subsequent messages

[3] 
https://elixir.free-electrons.com/linux/v3.6/source/scripts/mod/modpost.c#L568

[4] 
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180205/522570.html

Attachment: 94_clang_link_support.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]