This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Change PCH "checksum"


* Richard Biener:

>> Since the introduction of GNU Property notes this is (sadly) no longer
>> the correct way to iterate through ELF notes. The padding of names and
>> desc  might now depend on the alignment of the PT_NOTE segment.
>> https://sourceware.org/ml/binutils/2018-09/msg00359.html
>
> Ick, that's of course worse ;)  So it's not entirely clear what
> the correct thing to do is - from how I read the mail at the above
> link only iff sh_align of the note section is exactly 8 the above
> ALIGN would use 8 byte alignment and else 4 is correct (independent
> on sh_align).  Or can I assume sh_align of the note section is
> "correct" for all existing binaries?

sh_align doesn't come into play if you look at program headers.

A GNU build ID note will not end up in a PT_NOTE segment with 8-byte
alignment, so I think you can skip those early, like this:

+      if (info->dlpi_phdr[i].p_type != PT_NOTE
+          || info->dlpi_phdr[i].p_align != 4)
+	 continue;

(Untested, of course.)

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]