[llvm-bugs] [Bug 44265] New: LLD does not implement INPUT_SECTION_FLAGS, but parses them as if it does

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 10 10:20:11 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44265

            Bug ID: 44265
           Summary: LLD does not implement INPUT_SECTION_FLAGS, but parses
                    them as if it does
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: peter.smith at linaro.org
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

LLD doesn't implement the INPUT_SECTION_FLAGS feature
(https://sourceware.org/binutils/docs/ld/Input-Section-Basics.html)
yet it seems to parse INPUT_SECTION_FLAGS as if it were a file name, hence
ignoring it.

Consider the following example:
SECTIONS {
  .foo : { INPUT_SECTION_FLAGS (SHF_WRITE) *(.foo) }
  .foo2 :  { INPUT_SECTION_FLAGS (!SHF_WRITE) *(.foo) }
}
with obj1.o containing:
        .section .foo, "wa", %progbits
        .global d1
d1:     
        .word 0
and obj2.o containing:
        .section .foo, "a", %progbits
        .global d2
d2:     
        .word 0

The INPUT_SECTION_FLAGS are supposed to constrain the match, so .foo from
obj1.o goes into OutputSection .foo, and .foo from obj2.o goes into
OutuptSection .foo2

This feature can be very useful to filter sections by flag when it is not known
what the names are. Until we support it we should fault INPUT_SECTION_FLAGS if
we see it as a filename in an InputSectionDescription.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191210/3493678b/attachment.html>


More information about the llvm-bugs mailing list