[PATCH] D29278: [ELF] Bypass section type check #2

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 08:51:34 PST 2017

grimar added a comment.

In https://reviews.llvm.org/D29278#660494, @evgeny777 wrote:

> I see. I'm not sure about the motivation behind those flag/type checks. @grimar has just found out that they prevent linux kernel from linking ....

Yes I tried to fix it in a some nice way at first, but found my solution will not work. So issue is next:

  # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
  # RUN: echo "SECTIONS { .notes : { *(.note.*) } }" > %t.script
  # RUN: ld.lld --script %t.script --build-id %t.o -o %t
  ## Check that synthetic .note.gnu.build-id links fine with non-alloc note.
  .section .note.1
  .quad 0

Testcase above should work. Linux kernel contains script:

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

and called with --build-id.

We create allocatable synthetic section  .note.gnu.build-id and fail to combine it with other non allocatable sections .note.*
At first I tried to ignore check for synthetic input sections, but that will not work in general case.

Now I am not sure what is good solution for that.



More information about the llvm-commits mailing list