Mail Archives: djgpp-workers/2011/05/01/13:28:56
This is a multi-part message in MIME format.
--------------050909070507080002040506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 05/01/2011 08:15 PM, DJ Delorie wrote:
>> I'm ashamed to admit that I forgot why we have this file. I know that
>> it's a linker script, but why do we have our own in libc?
>
> Linker scripts come from one of three places:
>
> 1. Binutils - LD has a default built-in.
>
> 2. libc - djlsr, libgloss, glibc, etc.
>
> 3. project - you can provide a local script in your build.
>
> At the time, djgpp was changing much faster than binutils or gcc, so
> we needed to be able to ensure we had the correct and latest linker
> script to go with our library.
>
All latest binutils binaries for DJGPP from ftp.delorie.com have
correct (hopefully: works for me and also no one complaints) linker scripts.
FSF binutils script is not OK for DJGPP. See attached patch. As one can see from
version in directory name, it is rather old.
Andris
--------------050909070507080002040506
Content-Type: text/x-patch;
name="djcross-binutils-linker_script.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="djcross-binutils-linker_script.diff"
--- binutils-2.17/ld/scripttempl/i386go32.sc.llinkscript 2002-09-23 14:36:15.000000000 +0300
+++ binutils-2.17/ld/scripttempl/i386go32.sc 2007-03-25 18:15:06.000000000 +0300
@@ -35,14 +35,23 @@
${RELOCATING+djgpp_first_ctor = . ;
*(SORT(.ctors.*))
*(.ctor)
+ *(.ctors)
djgpp_last_ctor = . ;}
${RELOCATING+djgpp_first_dtor = . ;
*(SORT(.dtors.*))
*(.dtor)
+ *(.dtors)
djgpp_last_dtor = . ;}
+ __environ = . ;
+ PROVIDE(_environ = .) ;
+ LONG(0) ;
*(.data)
${RELOCATING+*(.data.*)}
+ /* Ugly workaround to prevent entire .bss to have attribute CONTENT */
+ /* for C++ executables. */
+ *(${RELOCATING+ .bss.*})
+
${RELOCATING+*(.gcc_exc*)}
${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
${RELOCATING+*(.eh_fram*)}
@@ -57,7 +66,7 @@
${CONSTRUCTING+${RELOCATING-$DTOR}}
.bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
{
- *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*})
+ *(.bss${RELOCATING+ .gnu.linkonce.b.*})
*(COMMON)
${RELOCATING+ end = . ; PROVIDE(_end = .) ;}
${RELOCATING+ . = ALIGN(${SEGMENT_SIZE});}
--------------050909070507080002040506--
- Raw text -