[llvm-bugs] [Bug 42482] New: LLVM's ld.lld doesn't support expressions in linker script for section's filling

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 2 03:40:08 PDT 2019


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

            Bug ID: 42482
           Summary: LLVM's ld.lld doesn't support expressions in linker
                    script for section's filling
           Product: lld
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: qwertytmp1 at gmail.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

This document
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html#OUTPUT-SECTION-FILL
states, that it is possible to fill section by expression.

It is not possible using lld.

Example:
- funnyos.lds.S:
```
#define FILL_EXPR                       \
        (((INFINITE_LOOP_OPCODE >> 24) & 0xFF) |        \
        ((INFINITE_LOOP_OPCODE << 8) & 0xFF0000) |      \
        ((INFINITE_LOOP_OPCODE >> 8) & 0xFF00) |        \
        ((INFINITE_LOOP_OPCODE << 24) & 0xFF000000))

...

SECTIONS
{
...
        .init ALIGN(PAGE_SIZE) : {
                _sinit_text = .;
                ...
                *(.init.text)
                _einit_text = .;
        } = FILL_EXPR
...
}
```

P.S. Binutil's linker can do this.

-- 
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/20190702/17a5e84d/attachment.html>


More information about the llvm-bugs mailing list