public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/94138] New: [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
@ 2020-03-11  9:13 laurent.stacul at gmail dot com
  2020-03-11  9:18 ` [Bug lto/94138] " laurent.stacul at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94138
           Summary: [gcc10]  unresolvable R_X86_64_TPOFF32 relocation
                    against symbol when LTO activated
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: laurent.stacul at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hello,

I am trying to build Facebook Folly library and I have this linkage problem
when LTO is activated.

/gcc/x86_64-1a-linux-gnu/10.0.1/../../../../x86_64-1a-linux-gnu/bin/ld:
cache_locality_test.ltrans0.ltrans.o(.text+0x45bb): unresolvable
R_X86_64_TPOFF32 relocation against symbol
`_ZN5folly14AccessSpreaderISt6atomicE8cpuCacheE'

I tried to create a small reproducer of this error but I failed. So I fallback
to sending you the preprocessed files in attachment.

My system:
$ uname -a
Linux 6248633baf95 5.3.0-40-generic #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020
x86_64 x86_64 x86_64 GNU/Linux
$ ./libc.so.6
GNU C Library (GNU libc) stable release version 2.31.
$ ./gcc --version
gcc (GCC) 10.0.1 20200305 (experimental)
$ ld --version
GNU ld (GNU Binutils) 2.34.0.20200305

I will try to get a reproducer in parallel but for the time being being it is
all I can provide. Tell me is you missed some files.

If you need a quick look at the code:
https://github.com/facebook/folly/blob/master/folly/concurrency/CacheLocality.h

Thanks in advance for your help.
Stac

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
@ 2020-03-11  9:18 ` laurent.stacul at gmail dot com
  2020-03-11  9:18 ` laurent.stacul at gmail dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Laurent Stacul <laurent.stacul at gmail dot com> ---
Created attachment 48015
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48015&action=edit
preprocessed sources

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
  2020-03-11  9:18 ` [Bug lto/94138] " laurent.stacul at gmail dot com
@ 2020-03-11  9:18 ` laurent.stacul at gmail dot com
  2020-03-11  9:27 ` marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Laurent Stacul <laurent.stacul at gmail dot com> ---
Created attachment 48016
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48016&action=edit
preprocessed sources

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
  2020-03-11  9:18 ` [Bug lto/94138] " laurent.stacul at gmail dot com
  2020-03-11  9:18 ` laurent.stacul at gmail dot com
@ 2020-03-11  9:27 ` marxin at gcc dot gnu.org
  2020-03-11 10:19 ` laurent.stacul at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-11  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2020-03-11

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
The provided files are not much useful. How difficult is building the Folly
from source. Can you please provide steps?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (2 preceding siblings ...)
  2020-03-11  9:27 ` marxin at gcc dot gnu.org
@ 2020-03-11 10:19 ` laurent.stacul at gmail dot com
  2020-03-11 10:26 ` laurent.stacul at gmail dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Laurent Stacul <laurent.stacul at gmail dot com> ---
Well the problem of folly is that it requires lots of dependencies.

What I can do is to isolate the link command with the needed files. Amongst all
the link errors, you will get the described error.

As the size is high, I put it there: https://www.transfernow.net/7TixXZ032020

You will have the libfolly.so built with LTO, the CacheLocalitytest.cpp.o and
run.sh with the reduced command:

/opt/1A/toolchain/x86_64-v20/bin/g++ \
    -DNDEBUG \
    -O3 -Wl,-flto -ffat-lto-objects -fuse-linker-plugin \
    -fno-working-directory -ggdb3 -Wl,--as-needed  -rdynamic \
    CacheLocalityTest.cpp.o  -o cache_locality_test -L. libfolly.so -pthread

Tell me if it is helpful or if you need something else.
Regards,
Stac

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (3 preceding siblings ...)
  2020-03-11 10:19 ` laurent.stacul at gmail dot com
@ 2020-03-11 10:26 ` laurent.stacul at gmail dot com
  2020-03-11 10:53 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Laurent Stacul <laurent.stacul at gmail dot com> ---
I forgot to remove some arguments in the command:

/opt/1A/toolchain/x86_64-v20/bin/g++ \
    -O3 -Wl,-flto -ffat-lto-objects -fuse-linker-plugin \
    CacheLocalityTest.cpp.o  -o cache_locality_test -L. libfolly.so -pthread

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (4 preceding siblings ...)
  2020-03-11 10:26 ` laurent.stacul at gmail dot com
@ 2020-03-11 10:53 ` marxin at gcc dot gnu.org
  2020-03-11 13:56 ` laurent.stacul at gmail dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-11 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Laurent Stacul from comment #5)
> I forgot to remove some arguments in the command:
> 
> /opt/1A/toolchain/x86_64-v20/bin/g++ \
>     -O3 -Wl,-flto -ffat-lto-objects -fuse-linker-plugin \
>     CacheLocalityTest.cpp.o  -o cache_locality_test -L. libfolly.so -pthread

Ok, so please provide pre-processed source file for CacheLocalityTest.cpp.o.
Just add -E option to command line.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (5 preceding siblings ...)
  2020-03-11 10:53 ` marxin at gcc dot gnu.org
@ 2020-03-11 13:56 ` laurent.stacul at gmail dot com
  2020-03-11 14:35 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Laurent Stacul <laurent.stacul at gmail dot com> ---
Created attachment 48019
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48019&action=edit
preprocessed sources

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (6 preceding siblings ...)
  2020-03-11 13:56 ` laurent.stacul at gmail dot com
@ 2020-03-11 14:35 ` marxin at gcc dot gnu.org
  2020-03-11 14:38 ` laurent.stacul at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-11 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Laurent Stacul from comment #7)
> Created attachment 48019 [details]
> preprocessed sources

Thanks and last missing piece is command line how lityTest.cpp.o is compiled?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (7 preceding siblings ...)
  2020-03-11 14:35 ` marxin at gcc dot gnu.org
@ 2020-03-11 14:38 ` laurent.stacul at gmail dot com
  2020-03-11 14:45 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-11 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Laurent Stacul <laurent.stacul at gmail dot com> ---
Here is the command line:

g++ -E 
-DFOLLY_XLOG_STRIP_PREFIXES=\"/home/docker/development/opensource-pack-builder/components/folly/BUILD/folly-2020.03.02.00:/home/docker/development/opensource-pack-builder/components/folly/BUILD/folly-2020.03.02.00/_build_shared\"
-D_GNU_SOURCE -D_REENTRANT -I../ -I.
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Boost/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/DoubleConversion/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Gflags/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Glog/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Libevent/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/OpenSSL/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/ZLib/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/BZip2/latest/osp/include
-I/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Aio/latest/osp/include
-isystem
/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Gmock/latest/osp/include
-isystem
/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Gtest/latest/osp/include
-isystem
/home/docker/development/opensource-pack-builder/components/folly/DEPS/osp/Fmt/latest/osp/include
-DNDEBUG -O3 -flto -ffat-lto-objects -fuse-linker-plugin -std=gnu++20
-fno-working-directory -ggdb3 -Wno-error=maybe-uninitialized
-Wno-error=shadow=compatible-local -Wno-error=array-bounds
-Wno-error=stringop-overflow -O2 -g -DNDEBUG -fPIE   -g -std=gnu++2a
-finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated
-Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wunused-label
-Wunused-result -Wshadow-compatible-local -Wno-noexcept-type -faligned-new
-fopenmp -std=gnu++14 -MD -MT
CMakeFiles/cache_locality_test.dir/folly/concurrency/test/CacheLocalityTest.cpp.o
-MF
CMakeFiles/cache_locality_test.dir/folly/concurrency/test/CacheLocalityTest.cpp.o.d
-o
CMakeFiles/cache_locality_test.dir/folly/concurrency/test/CacheLocalityTest.cpp.o
-c ../folly/concurrency/test/CacheLocalityTest.cpp

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (8 preceding siblings ...)
  2020-03-11 14:38 ` laurent.stacul at gmail dot com
@ 2020-03-11 14:45 ` marxin at gcc dot gnu.org
  2020-03-11 14:49 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-11 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, I see in the .s file:

$ grep _ZN5folly14AccessSpreaderISt6atomicE8cpuCacheE
cache_locality_test.ltrans0.s
        leaq    _ZN5folly14AccessSpreaderISt6atomicE8cpuCacheE@tpoff, %rbp
        leaq    _ZN5folly14AccessSpreaderISt6atomicE8cpuCacheE@tpoff, %rbx

So the symbols is a TLS static variable:
$ grep cpuCache *.ii
  static __thread CpuCache cpuCache;

Can you please reduce the .ii file with creduce:
https://gcc.gnu.org/bugs/minimize.html
?

That should be doable by grepping for the:
 unresolvable R_X86_64_TPOFF32 relocation against symbol
`_ZN5folly14AccessSpreaderISt6atomicE8cpuCacheE'

error message.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (9 preceding siblings ...)
  2020-03-11 14:45 ` marxin at gcc dot gnu.org
@ 2020-03-11 14:49 ` marxin at gcc dot gnu.org
  2020-03-13  8:15 ` laurent.stacul at gmail dot com
  2020-03-13  8:37 ` marxin at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-11 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
Good, now I can see a similar issue:

$ gcc  -o cache_locality_test -L. libfolly.so -pthread CacheLocalityTest.o
-shared
/usr/bin/ld: /tmp/cache_locality_test.Kz3DE7.ltrans0.ltrans.o: relocation
R_X86_64_TPOFF32 against `_ZL10testingCpu' can not be used when making a shared
object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status

and I can confirm adding -fPIC helps.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (10 preceding siblings ...)
  2020-03-11 14:49 ` marxin at gcc dot gnu.org
@ 2020-03-13  8:15 ` laurent.stacul at gmail dot com
  2020-03-13  8:37 ` marxin at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: laurent.stacul at gmail dot com @ 2020-03-13  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Laurent Stacul <laurent.stacul at gmail dot com> ---
Ok I think we will not waste time on this one. Actually, the build system
allows to force the standard version to build the libfolly.so (in out case
gnu++20) but somehow the tests are build with -std=gnu++14. (If I twaek the
whole build system to use gnu++20, the tests do no compile because GTest is not
C++20-ready).

So I think this ticket is invalid since we have to ensure some flags
consistency between each compilation units of a project.

For information, tt seems there is no problem in this situation if LTO is
deactivated.

Sorry for inconvenience and thanks for your investigation.
Stac

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug lto/94138] [gcc10]  unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated
  2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
                   ` (11 preceding siblings ...)
  2020-03-13  8:15 ` laurent.stacul at gmail dot com
@ 2020-03-13  8:37 ` marxin at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-13  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|WAITING                     |RESOLVED

--- Comment #13 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you, let's close it then.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-03-13  8:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11  9:13 [Bug lto/94138] New: [gcc10] unresolvable R_X86_64_TPOFF32 relocation against symbol when LTO activated laurent.stacul at gmail dot com
2020-03-11  9:18 ` [Bug lto/94138] " laurent.stacul at gmail dot com
2020-03-11  9:18 ` laurent.stacul at gmail dot com
2020-03-11  9:27 ` marxin at gcc dot gnu.org
2020-03-11 10:19 ` laurent.stacul at gmail dot com
2020-03-11 10:26 ` laurent.stacul at gmail dot com
2020-03-11 10:53 ` marxin at gcc dot gnu.org
2020-03-11 13:56 ` laurent.stacul at gmail dot com
2020-03-11 14:35 ` marxin at gcc dot gnu.org
2020-03-11 14:38 ` laurent.stacul at gmail dot com
2020-03-11 14:45 ` marxin at gcc dot gnu.org
2020-03-11 14:49 ` marxin at gcc dot gnu.org
2020-03-13  8:15 ` laurent.stacul at gmail dot com
2020-03-13  8:37 ` marxin at gcc dot gnu.org

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).