[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/12565] NOLOAD sections empty

From: jifl-bugzilla at jifvik dot org
Subject: [Bug ld/12565] NOLOAD sections empty
Date: Tue, 15 Mar 2011 22:38:14 +0000


--- Comment #4 from Jonathan Larmour <jifl-bugzilla at jifvik dot org> 
2011-03-15 22:37:58 UTC ---
(In reply to comment #3)
> Created attachment 5312 [details]
> A patch
> Although the linker script is bad, this patch help it.

Sorry, I was trying to emphasise earlier that using .debug_info is just an
example. It applies to any section, not just debug sections.

For example, change helloworld.c to:
#include <stdio.h>
const char foobar[]  __attribute__((section(".foobar"))) = "foobar";
int main(int argc, char *argv[])
  printf("Hello world!\n");
  return 0;

And edit script.ld to include:
  .foobar        0 : { *(.foobar) }
and you see useful data. All well and good.

But if you change that line to:
  .foobar        0 (NOLOAD) : { *(.foobar) }
then the section gets removed entirely from the binary (which is admittedly
going even further than just zeroing the contents). Objdump reports:
 25 .foobar       00000007  0000000000000000  0000000000000000  00200000  2**0
                  ALLOC, READONLY
and readelf -S reports:
  [26] .foobar           NOBITS           0000000000000000  00200000
       0000000000000007  0000000000000000   A       0     0     1

Just because some data isn't meant to be loaded into memory (by using NOLOAD),
should not affect whether that data is present in the binary.

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]