delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/05/01/13:28:56

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Message-ID: <4DBD984E.7080501@iki.fi>
Date: Sun, 01 May 2011 20:28:46 +0300
From: Andris Pavenis <andris DOT pavenis AT iki DOT fi>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: djgpp*.djl
References: <4DBD4955 DOT 3060104 AT iki DOT fi> <831v0i5ps4 DOT fsf AT gnu DOT org> <201105011715 DOT p41HFfTe002301 AT envy DOT delorie DOT com>
In-Reply-To: <201105011715.p41HFfTe002301@envy.delorie.com>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019