IMAGE_SCN_MEM_DISCARDABLE on .reloc vs relocatable dlls

Danny Smith danny_r_smith_2001@yahoo.co.nz
Fri Dec 19 06:29:00 GMT 2003


This patch will cause problems with stripping of relocatable dlls..

2003-12-15  Dmitry Semyonov  <Dmitry.Semyonov@oktet.ru>
	    Nick Clifton  <nickc@redhat.com>

	* peXXigen.c (_bfd_XXi_swap_scnhdr_out): Ensure that correct flags
	are set on known section types.

Setting section flags for .reloc with IMAGE_SCN_MEM_DISCARDABLE means
that it will be treated like debugging info and be stripped when using
strip with no options or when using ld -s. This will render the dll
non-relocatable.

Attached fixes.   If the user really wants to make the dll non-relocatable
'strip --remove-section=.reloc' can still be used. 

ChangeLog 

2003-12-19  Danny Smith  <dannysmith@users.sourceforge.net>

	* coffcode.h (styp_to_sec_flags): Don't treat .reloc section
	as SEC_DEBUGGING.


Index: coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.100
diff -c -3 -p -r1.100 coffcode.h
*** coffcode.h	1 Dec 2003 18:46:21 -0000	1.100
--- coffcode.h	19 Dec 2003 00:00:02 -0000
*************** styp_to_sec_flags (abfd, hdr, name, sect
*** 1064,1070 ****
  	  sec_flags &= ~ SEC_READONLY;
  	  break;
  	case IMAGE_SCN_MEM_DISCARDABLE:
! 	  sec_flags |= SEC_DEBUGGING;
  	  break;
  	case IMAGE_SCN_MEM_SHARED:
  	  sec_flags |= SEC_SHARED;
--- 1065,1072 ----
  	  sec_flags &= ~ SEC_READONLY;
  	  break;
  	case IMAGE_SCN_MEM_DISCARDABLE:
! 	  if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0)
! 	    sec_flags |= SEC_DEBUGGING;
  	  break;
  	case IMAGE_SCN_MEM_SHARED:
  	  sec_flags |= SEC_SHARED;

http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.



More information about the Binutils mailing list