delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/14/01:16:41

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Boris Vrbanić" <boris DOT vrbanic AT hi DOT hinet DOT hr>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: /DISCARD/ in linker script
Date: Tue, 14 May 2002 06:58:03 +0200
Organization: HThinet
Lines: 49
Message-ID: <abq5hj$60ho$1@as201.hinet.hr>
References: <1021312249 DOT 448613 AT queeg DOT ludd DOT luth DOT se>
NNTP-Posting-Host: ad21-m190.net.hinet.hr
X-Trace: as201.hinet.hr 1021352308 197176 195.29.56.190 (14 May 2002 04:58:28 GMT)
X-Complaints-To: abuse AT hinet DOT hr
NNTP-Posting-Date: Tue, 14 May 2002 04:58:28 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Martin Str|mberg" <ams AT speedy DOT ludd DOT luth DOT se> wrote in message
news:1021312249 DOT 448613 AT queeg DOT ludd DOT luth DOT se...
>
> Can anyone show me an example of a link script that uses the
> "/DISCARD/" section?
>
> I want to make the .bss not to be included in output file. I use the
> binary format ("ld --oformat binary").
>
> Right now I have:
> ENTRY(start)
> SECTIONS
> {
> .text 0 : {
> *(.text)
> etext = . ; _etext = .;
> . = ALIGN(0x100);
> }
> .data ALIGN(0x100) : {
> *(.data)
> edata = . ; _edata = .;
> . = ALIGN(0x100);
> }
> /DISCARD/ SIZEOF(.data) + ADDR(.data) : {
> *(.bss)
> *(COMMON)
> end = . ; _end = .;
> . = ALIGN(0x100);
> }
> }
>
> ld says "Illegal use of `/DISCARD/' section"
>
>
> Right,
>
> MartinS

/DISCARD/ section is used like any other section, example

/DISCARD/ {
    *(.eh_frame)
}

this tells linker to discard section "eh_frame" from object file



- Raw text -


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