Subject: Re: ELF alignment: linker problem or not?
To: matthew green , David Laight <david@l8s.co.uk>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-toolchain
Date: 07/06/2006 19:08:18
mrg@eterna.com.au said:
> what happens when you do not output .eh_frame at all?  (ie, i guess
> use flags to ld or objcopy to remove it.) 

I haven't found the right flag to gcc or ld yet.

david@l8s.co.uk said:
>  Linux kernels builds run with the compiler option to exclude the
> section. 

I've copied the appearently relevant -f flags from a linux
driver module build (which indeed doesn't create a .eh_frame
section), but this didn't help. Can you tell me more?

Anyway, I've removed that section with objcopy later, and the
module loads now. I had to find out however that the problem
isn't easy to reproduce, it is just one out of ten modules
which exhibit the "overlap" problem at all. (I was just lucky
that the first one I tried was one of these.) It must be a
subtle combination of section lengths modulo alignment which
triggers this.
I believe that the overlap problem is not related to the
existence of .eh_frame. That section is not handled specially
by the linker as far as address allocation and alignment
are concerned. And I had the linker code instrumented and
found that section lengths indeed change during ldemul_finish(),
so I think my statement about ld checking too early is correct.

best regards
Matthias