Page MenuHomePhabricator

[ELF] - Allow to combine sections of type SHT_NOTE with different attributes.
AbandonedPublic

Authored by grimar on Jan 31 2017, 4:19 AM.

Details

Reviewers
ruiu
rafael
Summary

One of linux scripts (arch/x86/kernel/vmlinux.lds) has next line:

.notes : AT(ADDR(.notes) - 0xffffffff80000000) { __start_notes = .; *(.note.*) __stop_notes = .; } :text :note

when built with --build-id, we create allocatable .note.gnu.build-id, what is fine.
And another .note.* section which script wants to combine is non-allocatable and we error out.

Patch allows combining note sections with different flags.

Diff Detail

Event Timeline

grimar created this revision.Jan 31 2017, 4:19 AM
grimar edited the summary of this revision. (Show Details)
grimar edited the summary of this revision. (Show Details)Jan 31 2017, 4:22 AM

This looks great but I think the comment could be made clearer:

If sections are of the SHT_NOTE type we allow them to be combined, even if flags are incompatible. As an example, some scripts from the linux kernal combine allocatable and non-allocatbale SHT_NOTE sections together.

This looks great but I think the comment could be made clearer:

If sections are of the SHT_NOTE type we allow them to be combined, even if flags are incompatible. As an example, some scripts from the linux kernal combine allocatable and non-allocatbale SHT_NOTE sections together.

Ok, I'll change this comment in new diff or before commit (if this patch be approved). Thanks !

grimar abandoned this revision.EditedFeb 16 2017, 7:11 AM

Issue of linux kernel. Abandoning for now.

grimar added a comment.EditedFeb 16 2017, 7:15 AM

Possible workaround for linux kernel is
change include/linux/elfnote.h to:

#define ELFNOTE(name, type, desc)               \
        ELFNOTE_START(name, type, "a")          \
                desc                    ;       \
        ELFNOTE_END