Re: Alignment of .rodata symbols wasting space

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

 



John Carter <john.carter@xxxxxxxxxx> writes:

> I am linking an executable for an embedded target with very limited
> rom/ram resources.
> 
> While analysing our space requirements I noted a fairly large
> discrepancy between the amount of rodata reported by readelf vs adding
> up the individual symbols reported by objdump --syms. (About a factor
> 1.5)

This would seem to be a linker issue rather than a gcc issue, and as
such is better directed to a binutils list.  See
    http://sourceware.org/binutils/

> As far as I can see, there are two sources for this discrepancy...
>    1) Alignment. (1 byte symbol followed by a 4 byte aligned symbol)
>    2) Some large mysterious other thing between the last symbol and the end
>       of the rodata segment..
> 
> Question 1)
>   Any ld flags / linking script options / ... that I can use to pack all
>   byte aligned objects together?

No.  The linker can sort common symbols (--sort-common) but not
symbols in the .rodata section.

> Question 2)
>   Any guesses as to what are the mystery rodata items that are not showing
>   up in objdump --syms?

Use a linker map (linker -M option) to find out what is going there.

> Question 3)
>    Are these problems perhaps an artifact of the somewhat elderly version
>    of the toolchain we are using? ie. Would upgrading solve this problem?
>    sparc-rtems-gcc 2.95.2
>    sparc-rtems-objdump 2.11

Hard to be sure, but it doesn't seem especially likely.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux