[llvm] r240394 - Revert r240302 ("Bring r240130 back.").

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jun 23 13:49:05 PDT 2015


Thanks!

With asserts this reduces to

define void @fj()  {
  call void asm "bsr $0,%eax", "o"(i32 1)
  ret void
}

crashing llc.



On 23 June 2015 at 16:06, Diego Novillo <dnovillo at google.com> wrote:
> On Tue, Jun 23, 2015 at 2:13 PM, Diego Novillo <dnovillo at google.com> wrote:
>> On Tue, Jun 23, 2015 at 7:31 AM, Daniel Jasper <djasper at google.com> wrote:
>>> Author: djasper
>>> Date: Tue Jun 23 06:31:32 2015
>>> New Revision: 240394
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=240394&view=rev
>>> Log:
>>> Revert r240302 ("Bring r240130 back.").
>>>
>>> This causes errors like:
>>>
>>>   ld: error: blah.o: requires dynamic R_X86_64_PC32 reloc against '' which
>>>   may overflow at runtime; recompile with -fPIC
>>>   blah.cc:function f(): error: undefined reference to ''
>>>   blah.o:g(): error: undefined reference to ''
>>>
>>> I have not yet come up with an appropriate reproduction.
>>
>> I'm working on a reproducer today.
>
> Rafael, this code snippet shows the problem. If I revert Daniel's
> patch (r240394):
>
> $ cat foo.cc
> class A {
>   int m_fn1(unsigned);
>   char kLengthBytesRequired;
> };
> int a;
> int A::m_fn1(unsigned) {
>   int n = 0;
>   asm("bsr %1,%0\n\tcmovz %2,%0" : "=&r"(a) : "ro"(n), "r"(1));
>   return kLengthBytesRequired;
> }
>
> $ ./clang -O2 -fPIC -c foo.cc -o foo.pic.o
> $ ld -shared -o foo.so foo.pic.o
> ld: foo.pic.o: relocation R_X86_64_PC32 against undefined symbol `'
> can not be used when making a shared object; recompile with -fPIC
> ld: final link failed: Bad value
>
> The problem goes away if I compile with -O0 or -O1.
>
>
> Diego.



More information about the llvm-commits mailing list