https://llvm.org/bugs/show_bug.cgi?id=22996

            Bug ID: 22996
           Summary: Difference in relocations with -no-integrated-as
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

For the following example: using direct object emission the address at 0xb does
not have a relocation, using -no-integrated-as it does have a relocation. There
is a relocation for 0x6 in both cases. Using r232386.

$ cat test.cpp
struct A {
  A();
};
void fn1() {
  A();
  fn1();
}
$ clang -c -O2 test.cpp -o direct.o
$ objdump -d direct.o

direct.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <_Z3fn1v>:
   0:   50                      push   %rax
   1:   48 8d 3c 24             lea    (%rsp),%rdi
   5:   e8 00 00 00 00          callq  a <_Z3fn1v+0xa>
   a:   e8 f1 ff ff ff          callq  0 <_Z3fn1v>
   f:   58                      pop    %rax
  10:   c3                      retq
$ objdump -r direct.o

direct.o:     file format elf64-x86-64

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
0000000000000006 R_X86_64_PC32     _ZN1AC1Ev-0x0000000000000004


RELOCATION RECORDS FOR [.eh_frame]:
OFFSET           TYPE              VALUE
0000000000000020 R_X86_64_PC32     .text


$ clang -c -O2 test.cpp -no-integrated-as -o no_int_as.o
$ objdump -d no_int_as.o

no_int_as.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <_Z3fn1v>:
   0:   50                      push   %rax
   1:   48 8d 3c 24             lea    (%rsp),%rdi
   5:   e8 00 00 00 00          callq  a <_Z3fn1v+0xa>
   a:   e8 00 00 00 00          callq  f <_Z3fn1v+0xf>
   f:   58                      pop    %rax
  10:   c3                      retq
$ objdump -r no_int_as.o

no_int_as.o:     file format elf64-x86-64

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
0000000000000006 R_X86_64_PC32     _ZN1AC1Ev-0x0000000000000004
000000000000000b R_X86_64_PC32     _Z3fn1v-0x0000000000000004


RELOCATION RECORDS FOR [.eh_frame]:
OFFSET           TYPE              VALUE
0000000000000020 R_X86_64_PC32     .text

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to