public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Linker issue with long variable names
@ 2019-04-26 13:13 Bob OBrien
  0 siblings, 0 replies; only message in thread
From: Bob OBrien @ 2019-04-26 13:13 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'; +Cc: Bob OBrien, Joshua Mueller

We are getting failures to link our application for what appears to be one of the debug sections in the ELF being too big for 32-bit addresses.
The error from the gold linker is hundreds of thousands of copies of the following with different addresses):
    app-main.o(.debug_info+0x2acc): error: relocation overflow: reference to local symbol 3578 in app-main.o
and with the bfd linker:
    app-main.o:(.debug_info+0x7e): relocation truncated to fit: R_X86_64_32 against `.debug_str'
This is compiled using GCC 7.2.1 and ld/ld.gold 2.29 on an x86_64 linux host with the flags "-g -O3 -fuse-ld=gold -Wl,--strip-debug-gdb -Wl,--strip-lto-sections -Wl,--gc-sections -Wl,--no-whole-archive -Wl,--no-add-needed".
When compiled with -g0 the app is 4.3M and with -g1 is 3.6G. The object files for -g are around 5.2G.
We have tried various combinations of flags to try and workaround this issue:
-ggdb
-gdwarf-4
-gdwarf-5
-fdebug-types-section
-feliminate-unused-debug-symbols
-feliminate-unused-debug-types
-fmerge-debug-strings
-m64
-Wl,-m,elf64_x86_64
-Wl,--oformat,elf64_x86_64
-Wl,--compress-debug-sections=zlib
-gz
-g2
There were a couple of changes that were able to finish the link, but they are not workable:
-gsplit-dwarf -Wl,--gdb-index : This is unusable as it consumes 4x the RAM and not many of our machines have 150G to spare.
-g1 : This is unusable as we lose the ability to examine core files generated by the app.
-s : same as above
Do you have any suggestions to workaround this issue?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-26 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 13:13 Linker issue with long variable names Bob OBrien

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