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] |
--- Pascal Obry <obry@act-europe.fr> wrote: > > Here is the problem. The auto-import feature for non scalar syms works only > if the syms are the DATA section. So for constant arrays this not working. > The following simple example will not work properly: > > clib.c: > > const char arr[] = "azertyazertyazertyazertyazertyazertyazertyazertyazerty"; > > $ gcc -shared -o clib.dll clib.c > > main.c: > > #include <stdio.h> > > extern const char arr[]; > > int main (void) > { > int k; > > for (k=0; k<6; k++) > printf ("arr[%d]=%c\n", k, arr[k]); > } > > $ gcc -o main main.c clib.dll > $ ./main > arr[0]=ÿ > arr[1]=% > arr[2]=à > arr[3]=` > arr[4]=@ > arr[5]= > > Of course the obvious fix is to remove the "const" attribute. But this is not > a general solution. The problem occurs, for example, in the standard Ada > libraries where it is not an option to change a constant to a variable (the > spec are part of the standard). > > Is there a solution with the current GCC ? > > If not a solution would be to add an option to GCC for force all such syms > into the DATA section. > > Thoughts ? > This is fixed with 3.4 GCC (initialized constants are put in .rdata section) 2003-10-07 Danny Smith <dannysmith@users.sourceforge.net> * config/i386/cygming.h (READONLY_DATA_SECTION_ASM_OP): Define. (switch_to_section): Handle in_readonly_data. * config/i386/winnt.c (i386_pe_asm_named_section): Handle readonly data. and current binutils (when doing direct imports from dll, .rdata section as well as .data is scanned for data symbols) 2003-10-14 Danny Smith <dannysmith@users.sourceforge.net> * pe-dll.c (pe_implied_import_dll): Also scan .rdata sections to identify data symbols. Danny > Thanks, > Pascal. > > -- > > --|------------------------------------------------------ > --| Pascal Obry Team-Ada Member > --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE > --|------------------------------------------------------ > --| http://perso.wanadoo.fr/pascal.obry > --| "The best way to travel is by means of imagination" > --| > --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595 > http://greetings.yahoo.com.au - Yahoo! Greetings Send your love online with Yahoo! Greetings - FREE!
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |