#4523: gdb 9.1 no longer builds on Cygwin (thread local error)
----------------------------+--------------------
Reporter: Joel Sherrill | Owner: (none)
Type: defect | Status: new
Priority: normal | Milestone: 5.2
Component: admin | Version: 5
Severity: normal | Keywords:
Blocked By: | Blocking:
----------------------------+--------------------
The Cygwin link error is:
{{{
cp-support.o: in function `gdb_demangle(char const*, int)':
/home/Christian/binutils-gdb/obj/gdb/../../gdb/cp-
support.c:1619:(.text+0x6472): relocation truncated to fit: R_X86_64_PC32
against undefined symbol `TLS init function for thread_local_segv_handler'
/home/Christian/binutils-gdb/obj/gdb/../../gdb/cp-
support.c:1619:(.text+0x648b): relocation truncated to fit: R_X86_64_PC32
against undefined symbol `TLS init function for thread_local_segv_handler'
collect2: error: ld returned 1 exit status
}}}
The issue appears to be that Cygwin changed their base address for
executables and there are multiple approaches to fixing this on the
Internet. None of these applied cleanly to a vanilla gdb 9.1. I adapted
the patch presented at https://stackoverflow.com/questions/61984974
/failed-to-build-avr-and-arm-gdb-9-1-under-cygwin-relocation-truncated-to-
fit
This patch avoids using a thread-local extern variable, which causes link
errors on some platforms, notably Cygwin. The poster through this was a
better pattern even outside of working around linker bugs because it
encapsulates direct access to the variable inside the class, instead of
having a global extern variable.
It should be noted that gdb 10.1 builds cleanly on Cygwin but discussions
leaned against bumping the gdb on the 5 branch. Hence we end up with a
Cygwin specific patch for gdb 9.1 on Cygwin.
--
Ticket URL: <http://devel.rtems.org/ticket/4523>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs