bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/23527] New: regression (ld-2.30 worked): relocation R_X86_64_PC3


From: slyfox at inbox dot ru
Subject: [Bug ld/23527] New: regression (ld-2.30 worked): relocation R_X86_64_PC32 against protected symbol `a' can not be used when making a shared object
Date: Tue, 14 Aug 2018 22:21:13 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23527

            Bug ID: 23527
           Summary: regression (ld-2.30 worked): relocation R_X86_64_PC32
                    against protected symbol `a' can not be used when
                    making a shared object
           Product: binutils
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: slyfox at inbox dot ru
  Target Milestone: ---

Created attachment 11183
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11183&action=edit
binutils-protected-663442.tar.gz

The report is extracted from chromium link failure:
    https://bugs.gentoo.org/663442

Minimal example:

$ cat a.s
.text
    .globl a
    .type  a, @function
    .protected a
a:
    ud2
$ cat b.s
.text
    .globl a
    .type  a, @function
    .protected a
    .globl b
    .type  b, @function
    .protected b
b:
    jmp a
$ cat a.sh
#!/bin/bash

for cc in gcc clang; do
  echo "cc=$cc"
  $cc -O2 -fPIC -c a.s -o a.$cc.o
  $cc -O2 -fPIC -c b.s -o b.$cc.o
  #objdump -d -r a.o b.o
  ld -shared \
      -fPIC \
      -o lib.$cc.so \
      a.$cc.o b.$cc.o "$@"
done
$ LANG=C ./a.sh 
cc=gcc
cc=clang
ld: b.clang.o: relocation R_X86_64_PC32 against protected symbol `a' can not be
used when making a shared object
ld: final link failed: bad value

Note: clang builds slightly different final binary using non-PLT reference:
$ diffoscope b.gcc.o b.clang.o
 -0000000000000001  0000000400000004 R_X86_64_PLT32         0000000000000000 a
- 4
 +0000000000000001  0000000100000002 R_X86_64_PC32          0000000000000000 a
- 4

Both tests pass on binutils-2.30 and fail on binutils-2.31.1 (for object files
built by clang).

binutils-master also fails:
$ LANG=C ~/dev/git/binutils-gdb-native/ld/ld-new -shared -fPIC -o lib.clang.so
a.clang.o b.clang.o
/home/slyfox/dev/git/binutils-gdb-native/ld/ld-new: b.clang.o: relocation
R_X86_64_PC32 against protected symbol `a' can not be used when making a shared
object
/home/slyfox/dev/git/binutils-gdb-native/ld/ld-new: final link failed: bad
value

Attaching final binaries.

Thanks!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]