* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
@ 2022-12-15 8:22 ` rguenth at gcc dot gnu.org
2022-12-15 16:44 ` hjl.tools at gmail dot com
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-15 8:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 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
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2022-12-15 16:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-12-15
Status|UNCONFIRMED |NEW
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
We need to add a check to disable hwasan for older linkers.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 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
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2022-12-15 18:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 54104
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54104&action=edit
A patch
Please try this.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (2 preceding siblings ...)
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
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2022-12-15 22:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #3 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Comment on attachment 54104
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54104
A patch
I'm confirming the checking to work for the case reported;
'build-gcc/x86_64-pc-linux-gnu/libsanitizer/config.log':
configure:15883: checking linker protected symbol support
configure:15895: [...]/build-gcc/./gcc/xgcc [...] -fchecking=1 -shared
-nostartfiles -nodefaultlibs -o conftest.so conftest.s 1>&5
/usr/bin/ld: /tmp/ccEJLiUq.o: relocation R_X86_64_PC32 against protected
symbol `foo' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
configure:15898: $? = 1
configure:15906: result: no
..., however, the libsanitizer build eventually still fails:
[...]
make[4]: Leaving directory
`[...]/build-gcc/x86_64-pc-linux-gnu/libsanitizer/tsan'
Making all in hwasan
/bin/bash: line 20: cd: hwasan: No such file or directory
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`[...]/build-gcc/x86_64-pc-linux-gnu/libsanitizer'
make[2]: *** [all] Error 2
make[2]: Leaving directory
`[...]/build-gcc/x86_64-pc-linux-gnu/libsanitizer'
make[1]: *** [all-target-libsanitizer] Error 2
make[1]: Leaving directory `[...]/build-gcc'
make: *** [all] Error 2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (3 preceding siblings ...)
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
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2022-12-15 23:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #54104|0 |1
is obsolete| |
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 54106
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54106&action=edit
An updated patch
Try this one.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (4 preceding siblings ...)
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
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-16 9:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
protected visibility is almost always a bad answer for anything.
Wouldn't it be better to get rid of it in libhwasan and use something
different?
Say an hidden alias to an exported function?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (5 preceding siblings ...)
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
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2022-12-16 13:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #6 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Comment on attachment 54106
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54106
An updated patch
Yes, that does resolve the the libsanitizer/HWASan build failure.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (6 preceding siblings ...)
2022-12-16 13:42 ` tschwinge at gcc dot gnu.org
@ 2022-12-16 16:44 ` hjl.tools at gmail dot com
2022-12-16 16:47 ` hjl.tools at gmail dot com
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2022-12-16 16:44 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (7 preceding siblings ...)
2022-12-16 16:44 ` hjl.tools at gmail dot com
@ 2022-12-16 16:47 ` hjl.tools at gmail dot com
2022-12-16 18:24 ` tschwinge at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2022-12-16 16:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #54106|0 |1
is obsolete| |
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 54114
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54114&action=edit
Add __interceptor_sigsetjmp_internal
Try this one.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (8 preceding siblings ...)
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
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2022-12-16 18:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #9 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Comment on attachment 54114
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54114
Add __interceptor_sigsetjmp_internal
Voilà:
$ size
build-gcc/x86_64-pc-linux-gnu/libsanitizer/hwasan/.libs/libhwasan.so.0.0.0
text data bss dec hex filename
445414 16620 5381552 5843586 592a82
build-gcc/x86_64-pc-linux-gnu/libsanitizer/hwasan/.libs/libhwasan.so.0.0.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (9 preceding siblings ...)
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
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-21 12:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (10 preceding siblings ...)
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
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2022-12-21 18:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608672.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (11 preceding siblings ...)
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
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-31 22:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:a9fbc6687faa09bf045c0fcee7960b7fef796fcc
commit r13-5610-ga9fbc6687faa09bf045c0fcee7960b7fef796fcc
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Jan 31 14:34:00 2023 -0800
libsanitizer: cherry-pick commit 742bcbf685bc from upstream
cherry-pick:
742bcbf685bc compiler-rt/lib: Add .Linterceptor_sigsetjmp
PR sanitizer/108106
* hwasan/hwasan_setjmp_x86_64.S (__interceptor_setjmp): Jump
to .Linterceptor_sigsetjmp instead of __interceptor_sigsetjmp.
(__interceptor_sigsetjmp): Add a local alias,
.Linterceptor_sigsetjmp.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [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
2022-12-14 16:59 [Bug sanitizer/108106] New: [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 tschwinge at gcc dot gnu.org
` (12 preceding siblings ...)
2023-01-31 22:57 ` cvs-commit at gcc dot gnu.org
@ 2023-02-01 8:29 ` tschwinge at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-02-01 8:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108106
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |hjl at gcc dot gnu.org
Resolution|--- |FIXED
Status|NEW |RESOLVED
See Also| |https://github.com/llvm/llv
| |m-project/issues/60426
--- Comment #12 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Thanks, H.J. Lu!
^ permalink raw reply [flat|nested] 15+ messages in thread