This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tweak pie exports on PE targets


This change

2004-09-30  Filip Navara  <navaraf@reactos.com>

	* emultempl/pe.em (gld_${EMULATION_NAME}_set_symbols): Generate
	correct base address for position independant executables.
	* pe-dll.c (pe_dll_fill_sections): Don't mark position independant
	executables as DLLs.

enabled relocatable exe for PE targets, which is great.

But I'm not sure the behaviour is entirely correct. Currently, in absence 
of a def file or an  export directive in object file, it defaults
to -export-all-symbols, which means that compiling this:

/* foo.c */
int main(){return 0;}

with gcc -Wl,-pie foo.c

will result in am executable that exports 'main'

Is that intended behaviour, or should the rules for non-relocatable exes
apply, ie, only put explicitly marked symbols in the export table?

This patch will obtain the latter behaviour:

2004-10-11 Danny Smith  <dannysmith@users.sourceforege.net>

	* pe-dll.c (process_def_file): Don't export all symbols by default if
	building a position-independent executable.



Index: pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.73
diff -c -3 -p -r1.73 pe-dll.c
*** pe-dll.c	30 Sep 2004 17:19:19 -0000	1.73
--- pe-dll.c	10 Oct 2004 23:43:36 -0000
*************** process_def_file (bfd *abfd ATTRIBUTE_UN
*** 527,533 ****
    /* If we are not building a DLL, when there are no exports
       we do not build an export table at all.  */
    if (!pe_dll_export_everything && pe_def_file->num_exports == 0
!       && !info->shared)
      return;
  
    /* Now, maybe export everything else the default way.  */
--- 527,533 ----
    /* If we are not building a DLL, when there are no exports
       we do not build an export table at all.  */
    if (!pe_dll_export_everything && pe_def_file->num_exports == 0
!       && info->executable)
      return;
  
    /* Now, maybe export everything else the default way.  */
 

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]