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

Diego Novillo dnovillo at google.com
Tue Jun 23 13:06:46 PDT 2015


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