Date: Fri, 5 Mar 2021 17:30:37 -0800 From: Michael Forney <mforney@...rney.org> To: musl@...ts.openwall.com Cc: Rich Felker <dalias@...c.org> Subject: Re: ld-musl-* and empty .eh_frame On 2021-03-05, Fangrui Song <i@...kray.me> wrote: > Can you clarify how GNU ld creates an empty .eh_frame? Sure, see the shell snippet in my original post. > The program header PT_GNU_EH_FRAME is created from .eh_frame_hdr, which > is created by ld --eh-frame-hdr. > If .eh_frame is empty, from my observation GNU ld does not create > .eh_frame_hdr There is no PT_GNU_EH_FRAME in the executables. Based on Rich's explanation earlier, my understanding is that the issue is that GNU ld creates a empty PT_LOAD segment for the empty .eh_frame section. I attached the output of readelf -l in case that is helpful. > https://maskray.me/blog/2020-11-08-stack-unwinding#eh_frame_hdr-and-pt_eh_frame > >>I'm not too familiar with the binutils codebase, but I can try. As far >>as I can tell, the alignment is set to at least the maximum page size: >>https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf.c;h=84a5d942817a9a54b1170fbbb594787c5839aa54;hb=f35674005e609660f5f45005a9e095541ca4c5fe#l5601 > > max-page-size is for layouting PT_LOAD. > It is unrelated to PT_GNU_EH_FRAME. The empty PT_LOAD segment is the issue here, not PT_GNU_EH_FRAME. > The requirement is > http://www.sco.com/developers/gabi/latest/ch5.pheader.html > "p_vaddr should equal p_offset, modulo p_align." > > p_vaddr % p_align != 0 is valid. > > p_memsz can be zero. Are you saying that GNU ld might create PT_LOAD segments with zero size, and unaligned p_vaddr? If that's the case, I think Rich might have a valid concern here. View attachment "t-readelf.txt" of type "text/plain" (1891 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.