Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Message-ID: <00fd01c11340$d0a51900$806410ac@local> From: "Robert Collins" To: "Robert Collins" , Cc: "Charles S. Wilson" References: <00de01c1133a$23521f60$806410ac AT local> Subject: Re: ld non-relocatable Date: Mon, 23 Jul 2001 16:29:08 +1000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00FA_01C11394.993724A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-OriginalArrivalTime: 23 Jul 2001 06:15:50.0938 (UTC) FILETIME=[EBE10FA0:01C1133E] This is a multi-part message in MIME format. ------=_NextPart_000_00FA_01C11394.993724A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Concept-patch. It removes the .reloc section quite happily. I don't know whether this will produce faster code - as all the relocation logic is presumably still in the machinecode. However, it should guarantee fork() :]. Charles - care to add this to your testing pile? The new parameter --no-relocate needs to be added to the cygwin .dll link line (for somewhat obvious reasons :]). Rob ----- Original Message ----- From: "Robert Collins" To: Sent: Monday, July 23, 2001 3:40 PM Subject: ld non-relocatable > Chuck - excellent sleuthing. > > I'll have a quick look now at getting ld to omit the .reloc section(s). > > Rob > > ------=_NextPart_000_00FA_01C11394.993724A0 Content-Type: application/octet-stream; name="no-relocate.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="no-relocate.patch" ? no-relocate.patch=0A= Index: pe-dll.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/ld/pe-dll.c,v=0A= retrieving revision 1.23=0A= diff -u -p -r1.23 pe-dll.c=0A= --- pe-dll.c 2001/03/13 06:14:27 1.23=0A= +++ pe-dll.c 2001/07/23 06:23:21=0A= @@ -63,6 +63,7 @@ int pe_dll_kill_ats =3D 0;=0A= int pe_dll_stdcall_aliases =3D 0;=0A= int pe_dll_warn_dup_exports =3D 0;=0A= int pe_dll_compat_implib =3D 0;=0A= +int pe_dll_no_relocate =3D 0; =0A= =0A= = /************************************************************************=0A= =0A= @@ -484,6 +485,7 @@ build_filler_bfd (include_edata)=0A= int include_edata;=0A= {=0A= lang_input_statement_type *filler_file;=0A= +=0A= filler_file =3D lang_add_input_file ("dll stuff",=0A= lang_input_file_is_fake_enum,=0A= NULL);=0A= @@ -517,7 +519,7 @@ build_filler_bfd (include_edata)=0A= reloc_s =3D bfd_make_section_old_way (filler_bfd, ".reloc");=0A= if (reloc_s =3D=3D NULL=0A= || !bfd_set_section_flags (filler_bfd, reloc_s,=0A= - (SEC_HAS_CONTENTS=0A= + (SEC_HAS_CONTENTS=0A= | SEC_ALLOC=0A= | SEC_LOAD=0A= | SEC_KEEP=0A= @@ -1914,6 +1916,14 @@ pe_dll_fill_sections (abfd, info)=0A= =0A= edata_s->contents =3D edata_d;=0A= reloc_s->contents =3D reloc_d;=0A= +=0A= + /* if it's not used, remove the reloc setion. =0A= + * A better way would be to avoid all the relocation calculations = earlier=0A= + * as it might allow faster execution?=0A= + * Ditto for the import library=0A= + */=0A= + if (pe_dll_no_relocate)=0A= + _bfd_strip_section_from_output (info, reloc_s);=0A= }=0A= =0A= void=0A= Index: pe-dll.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/ld/pe-dll.h,v=0A= retrieving revision 1.3=0A= diff -u -p -r1.3 pe-dll.h=0A= --- pe-dll.h 2001/03/13 06:14:27 1.3=0A= +++ pe-dll.h 2001/07/23 06:23:21=0A= @@ -33,6 +33,7 @@ extern int pe_dll_kill_ats;=0A= extern int pe_dll_stdcall_aliases;=0A= extern int pe_dll_warn_dup_exports;=0A= extern int pe_dll_compat_implib;=0A= +extern int pe_dll_no_relocate;=0A= =0A= extern void pe_dll_id_target PARAMS ((const char *));=0A= extern void pe_dll_add_excludes PARAMS ((const char *));=0A= Index: emultempl/pe.em=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/ld/emultempl/pe.em,v=0A= retrieving revision 1.45=0A= diff -u -p -r1.45 pe.em=0A= --- pe.em 2001/07/11 08:11:16 1.45=0A= +++ pe.em 2001/07/23 06:23:22=0A= @@ -191,6 +191,7 @@ gld_${EMULATION_NAME}_before_parse()=0A= #define OPTION_DISABLE_AUTO_IMAGE_BASE (OPTION_ENABLE_AUTO_IMAGE_BASE + = 1)=0A= #define OPTION_DLL_SEARCH_PREFIX (OPTION_DISABLE_AUTO_IMAGE_BASE + 1)=0A= #define OPTION_NO_DEFAULT_EXCLUDES (OPTION_DLL_SEARCH_PREFIX + 1)=0A= +#define OPTION_NO_RELOCATE (OPTION_NO_DEFAULT_EXCLUDES +1)=0A= =0A= static struct option longopts[] =3D {=0A= /* PE options */=0A= @@ -228,6 +229,7 @@ static struct option longopts[] =3D {=0A= {"disable-auto-image-base", no_argument, NULL, = OPTION_DISABLE_AUTO_IMAGE_BASE},=0A= {"dll-search-prefix", required_argument, NULL, = OPTION_DLL_SEARCH_PREFIX},=0A= {"no-default-excludes", no_argument, NULL, = OPTION_NO_DEFAULT_EXCLUDES},=0A= + {"no-relocate", no_argument, NULL, OPTION_NO_RELOCATE},=0A= #endif=0A= {NULL, no_argument, NULL, 0}=0A= };=0A= @@ -313,6 +315,7 @@ gld_${EMULATION_NAME}_list_options (file=0A= fprintf (file, _(" --dll-search-prefix=3D When linking = dynamically to a dll witout an\n"));=0A= fprintf (file, _(" importlib, = use .dll \n"));=0A= fprintf (file, _(" in = preference to lib.dll \n"));=0A= + fprintf (file, _(" --no-relocate Generate a = non-relocatable dll. \n"));=0A= #endif=0A= }=0A= =0A= @@ -582,6 +585,9 @@ gld_${EMULATION_NAME}_parse_args(argc, a=0A= break;=0A= case OPTION_NO_DEFAULT_EXCLUDES:=0A= pe_dll_do_default_excludes =3D 0;=0A= + break;=0A= + case OPTION_NO_RELOCATE:=0A= + pe_dll_no_relocate =3D 1;=0A= break;=0A= #endif=0A= }=0A= ------=_NextPart_000_00FA_01C11394.993724A0--