[PATCH] D43383: [llvm-mc] - Produce R_X86_64_PLT32 for "call/jmp foo".

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 00:13:32 PST 2018


grimar added a comment.

In https://reviews.llvm.org/D43383#1011348, @hjl.tools wrote:

> Does this change add reference to _GLOBAL_OFFSET_TABLE_?
>
>    [hjl at gnu-tools-1 tmp]$ cat x.s
>   	call foo
>
> [hjl at gnu-tools-1 tmp]$ cat y.s
>
>   	call foo at PLT
>
> [hjl at gnu-tools-1 tmp]$ gcc -c x.s y.s
>  [hjl at gnu-tools-1 tmp]$ readelf -rs x.o y.o


No, I think gas do that, but not llvm-mc (and hence not this patch):

  umb at umb-virtual-machine:~/tests_2018/27$ ~/binutils-2.30-branch/binutils-gdb/build/gas/as-new -v
  GNU assembler version 2.30.51 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.30.51.20180214

  umb at umb-virtual-machine:~/tests_2018/27$ cat > test.s
  call foo at PLT
  ^C
  umb at umb-virtual-machine:~/tests_2018/27$ /home/umb/LLVM/build_goldplugin/bin/llvm-mc -filetype=obj -triple=x86_64-pc-linux test.s -o test.mc.o
  umb at umb-virtual-machine:~/tests_2018/27$ ~/binutils-2.30-branch/binutils-gdb/build/gas/as-new test.s -o test.gas.o
  umb at umb-virtual-machine:~/tests_2018/27$ readelf -s test.mc.o test.gas.o

  File: test.mc.o
  Symbol table '.symtab' contains 2 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
       1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND foo
  
  File: test.gas.o
  Symbol table '.symtab' contains 6 entries:
     Num:    Value          Size Type    Bind   Vis      Ndx Name
       0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
       1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 
       2: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
       3: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 
       4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _GLOBAL_OFFSET_TABLE_
       5: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND foo




https://reviews.llvm.org/D43383





More information about the llvm-commits mailing list