public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/108106] [13 Regression] /usr/bin/ld: .libs/hwasan_setjmp_x86_64.o: relocation R_X86_64_PC32 against symbol `__interceptor_sigsetjmp' can not be used when making a shared object; recompile with -fPIC
Date: Fri, 16 Dec 2022 16:44:59 +0000	[thread overview]
Message-ID: <bug-108106-4-V97gyKQuIb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108106-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
It is about -mshared:

[hjl@gnu-cfl-3 tmp]$ cat foo.s
        jmp   __interceptor_sigsetjmp

        .globl __interceptor_sigsetjmp
__interceptor_sigsetjmp:
        nop
[hjl@gnu-cfl-3 tmp]$ as -o foo.o foo.s
[hjl@gnu-cfl-3 tmp]$ readelf -rW foo.o

There are no relocations in this file.
[hjl@gnu-cfl-3 tmp]$ as -o foo.o foo.s -mshared
[hjl@gnu-cfl-3 tmp]$ readelf -rW foo.o

Relocation section '.rela.text' at offset 0xc8 contains 1 entry:
    Offset             Info             Type               Symbol's Value 
Symbol's Name + Addend
0000000000000001  0000000100000004 R_X86_64_PLT32         0000000000000005
__interceptor_sigsetjmp - 4
[hjl@gnu-cfl-3 tmp]$ 

The assembler option:

'-mno-shared'
     On ELF target, the assembler normally optimizes out non-PLT
     relocations against defined non-weak global branch targets with
     default visibility.  The '-mshared' option tells the assembler to
     generate code which may go into a shared library where all non-weak
     global branch targets with default visibility can be preempted.
     The resulting code is slightly bigger.  This option only affects
     the handling of branch instructions.

The older assembler generates R_X86_64_PC32 relocation.

  parent reply	other threads:[~2022-12-16 16:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 16:59 [Bug sanitizer/108106] New: " tschwinge at gcc dot gnu.org
2022-12-15  8:22 ` [Bug sanitizer/108106] " rguenth at gcc dot gnu.org
2022-12-15 16:44 ` hjl.tools at gmail dot com
2022-12-15 18:02 ` hjl.tools at gmail dot com
2022-12-15 22:20 ` tschwinge at gcc dot gnu.org
2022-12-15 23:14 ` hjl.tools at gmail dot com
2022-12-16  9:18 ` jakub at gcc dot gnu.org
2022-12-16 13:42 ` tschwinge at gcc dot gnu.org
2022-12-16 16:44 ` hjl.tools at gmail dot com [this message]
2022-12-16 16:47 ` hjl.tools at gmail dot com
2022-12-16 18:24 ` tschwinge at gcc dot gnu.org
2022-12-21 12:42 ` rguenth at gcc dot gnu.org
2022-12-21 18:01 ` hjl.tools at gmail dot com
2023-01-31 22:57 ` cvs-commit at gcc dot gnu.org
2023-02-01  8:29 ` tschwinge at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108106-4-V97gyKQuIb@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).