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: unassignedb...@nondot.org
          Reporter: qwertyt...@gmail.com
                CC: llvm-bugs@lists.llvm.org, peter.sm...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to