Author: aurel32
Date: 2015-09-10 15:16:30 +0000 (Thu, 10 Sep 2015)
New Revision: 6560

Modified:
   glibc-package/branches/glibc-2.21/debian/rules.d/debhelper.mk
Log:
Use the build id when manually stripping libpthread

This is similar to what dh_strip does. In the long term we should
probably add a special case for libpthread directly in dh_strip.


Modified: glibc-package/branches/glibc-2.21/debian/rules.d/debhelper.mk
===================================================================
--- glibc-package/branches/glibc-2.21/debian/rules.d/debhelper.mk       
2015-09-10 15:03:30 UTC (rev 6559)
+++ glibc-package/branches/glibc-2.21/debian/rules.d/debhelper.mk       
2015-09-10 15:16:30 UTC (rev 6560)
@@ -49,35 +49,21 @@
        # debugging library.  We keep a full copy of the symbol
        # table in libc6-dbg but basic thread debugging should
        # work even without that package installed.
-
-       # strip *.o files as dh_strip does not (yet?) do it.
-       if test "$(NOSTRIP_$(curpass))" != 1; then                              
\
-         if test "$(NODEBUG_$(curpass))" != 1; then                            
\
-           dh_strip -p$(curpass) -Xlibpthread $(DH_STRIP_DEBUG_PACKAGE);       
\
-           (cd debian/$(curpass);                                              
\
-             find . -name libpthread-\*.so -exec objcopy                       
\
-               --only-keep-debug '{}' ../$(libc)-dbg/usr/lib/debug/'{}'        
\
-               ';' || true;                                                    
\
-             find . -name libpthread-\*.so -exec objcopy                       
\
-               --add-gnu-debuglink=../$(libc)-dbg/usr/lib/debug/'{}'           
\
-               '{}' ';' || true);                                              
\
-           find debian/$(curpass) -name libpthread-\*.so -exec                 
\
-             strip --strip-debug --remove-section=.comment                     
\
-             --remove-section=.note '{}' ';' || true;                          
\
-                                                                               
\
-           (cd debian/$(curpass);                                              
\
-             find . -name \*crt\*.o -exec objcopy                              
\
-               --only-keep-debug '{}' ../$(libc)-dbg/usr/lib/debug/'{}'        
\
-               ';' || true;                                                    
\
-             find . -name \*crt\*.o -exec objcopy                              
\
-               --add-gnu-debuglink=../$(libc)-dbg/usr/lib/debug/'{}'           
\
-               '{}' ';' || true);                                              
\
-           find debian/$(curpass) -name \*crt\*.o -exec                        
\
-             strip --strip-debug --remove-section=.comment                     
\
-             --remove-section=.note '{}' ';' || true;                          
\
-         else                                                                  
\
-           dh_strip -p$(curpass) -Xlibpthread;                                 
\
-         fi                                                                    
\
+       if test "$(NOSTRIP_$(curpass))" != 1; then                              
        \
+         if test "$(NODEBUG_$(curpass))" != 1; then                            
        \
+           dh_strip -p$(curpass) -Xlibpthread $(DH_STRIP_DEBUG_PACKAGE);       
        \
+           for f in $$(find debian/$(curpass) -name libpthread-\*.so) ; do     
        \
+             dbgfile=$$(LC_ALL=C readelf -n $$f | sed -e '/Build ID:/!d'       
        \
+               -e "s#^.*Build ID: 
\([0-9a-f]\{2\}\)\([0-9a-f]\+\)#\1/\2.debug#") ;     \
+             dbgpath=debian/$(libc)-dbg/usr/lib/debug/.build-id/$$dbgfile ;    
        \
+             mkdir -p $$(dirname $$dbgpath) ;                                  
        \
+             objcopy --only-keep-debug $$f $$dbgpath ;                         
        \
+             objcopy --add-gnu-debuglink=$$dbgpath $$f ;                       
        \
+             strip --strip-debug --remove-section=.comment 
--remove-section=.note $$f ;\
+           done ;                                                              
        \
+         else                                                                  
        \
+           dh_strip -p$(curpass) -Xlibpthread;                                 
        \
+         fi                                                                    
        \
        fi
 endif
 

Reply via email to