From ebbff10ae1ba25c541be34213a6f7f9d9a2f2774 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 27 Oct 2022 13:05:36 +0200 Subject: [PATCH] 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 --- winsup/cygwin/Makefile.am | 22 +++++----------------- winsup/cygwin/cygwin.sc.in | 16 ---------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am index 8debd0144..024634d28 100644 --- a/winsup/cygwin/Makefile.am +++ b/winsup/cygwin/Makefile.am @@ -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 \ - --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} + $(AM_V_GEN)$(OBJCOPY) -g \ + --add-gnu-debuglink=$(DBG_DLL_NAME) \ + $(PRE_DLL_NAME) $(NEW_DLL_NAME) # cygwin import library toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@ diff --git a/winsup/cygwin/cygwin.sc.in b/winsup/cygwin/cygwin.sc.in index d984c51c9..69526f5d8 100644 --- a/winsup/cygwin/cygwin.sc.in +++ b/winsup/cygwin/cygwin.sc.in @@ -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)