[lld] r246902 - [elf2] Add 32S and 64 relocations (needed for musl).

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 17:46:09 PDT 2015


On Fri, Sep 4, 2015 at 5:36 PM, Michael J. Spencer via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: mspencer
> Date: Fri Sep  4 19:36:03 2015
> New Revision: 246902
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246902&view=rev
> Log:
> [elf2] Add 32S and 64 relocations (needed for musl).
>
> It wasn't obvious what the assembly was to generate these relocations, so I did the test with yaml.
>

It is actually obvious.
Example 32S:

.text
blah:
  movl $blah, %rdx

Let's try to not have two different methods of testing -- it's gonna
lead to headaches. I'm biased because I prefer assembler for testing,
but given we started with that -- let's just stick to it.

> Added:
>     lld/trunk/test/elf2/relocations.test
> Modified:
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=246902&r1=246901&r2=246902&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Fri Sep  4 19:36:03 2015
> @@ -271,8 +271,12 @@ template <class ELFT> void OutputSection
>                                       SymVA + (RI.r_addend - (P + Offset)));
>            break;
>          case llvm::ELF::R_X86_64_32:
> +        case llvm::ELF::R_X86_64_32S:
>            support::endian::write32le(Location, SymVA + RI.r_addend);
>            break;

Shouldn't we take care of sign extension somehow?

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list