Cygwin: drop objcopy .gnu_debuglink juggle

Prior to 591fec858d01 ("Cygwin: decouple cygheap from Cygwin DLL")
the .cygheap section was required to stay the last section in the
final binary.  That required some juggling with objcopy to make
sure the .gnu_debuglink section is prior to the .cygheap section
in the final DLL.

This isn't required anymore, so just drop it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-10-27 13:05:36 +02:00
parent 49df152de7
commit ebbff10ae1
2 changed files with 5 additions and 33 deletions

View File

@ -576,28 +576,16 @@ $(PRE_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
# create cygwin1.dbg file
$(DBG_DLL_NAME): $(PRE_DLL_NAME)
$(AM_V_GEN)$(OBJCOPY) -R .gnu_debuglink_overlay \
--add-gnu-debuglink=/dev/null \
$(AM_V_GEN)$(OBJCOPY) --add-gnu-debuglink=/dev/null \
--only-keep-debug \
$(PRE_DLL_NAME) \
$(DBG_DLL_NAME)
# create stripped, temporary DLL, append .gnu_debuglink section, move
# .gnu_debuglink section in place of .gnu_debuglink_overlay placeholder
# section and store result in new-cygwin1.dll
# create stripped release DLL, append .gnu_debuglink section
$(NEW_DLL_NAME): $(PRE_DLL_NAME) $(DBG_DLL_NAME)
$(AM_V_GEN)TMP_DLL_NAME=$$( mktemp --suffix=.dll ) && \
$(OBJCOPY) -g \
--keep-section=.gnu_debuglink_overlay \
$(AM_V_GEN)$(OBJCOPY) -g \
--add-gnu-debuglink=$(DBG_DLL_NAME) \
$(PRE_DLL_NAME) $${TMP_DLL_NAME} && \
vma=$$( objdump --headers $${TMP_DLL_NAME} | \
awk '/.gnu_debuglink_overlay/{print $$4;}' ) && \
$(OBJCOPY) -R .gnu_debuglink_overlay \
--change-section-address .gnu_debuglink=0x$${vma} \
--set-section-flag .gnu_debuglink=contents,readonly,debug,noload \
$${TMP_DLL_NAME} $(NEW_DLL_NAME) && \
rm $${TMP_DLL_NAME}
$(PRE_DLL_NAME) $(NEW_DLL_NAME)
# cygwin import library
toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@

View File

@ -116,22 +116,6 @@ SECTIONS
*(.rsrc)
*(SORT(.rsrc$*))
}
.gnu_debuglink_overlay ALIGN(__section_alignment__) (NOLOAD):
{
BYTE(0) /* c */
BYTE(0) /* y */
BYTE(0) /* g */
BYTE(0) /* w */
BYTE(0) /* i */
BYTE(0) /* n */
BYTE(0) /* 1 */
BYTE(0) /* . */
BYTE(0) /* d */
BYTE(0) /* b */
BYTE(0) /* g */
BYTE(0) /* \0 */
LONG(0) /* checksum */
}
/DISCARD/ :
{
*(.debug$S)