[llvm-bugs] [Bug 52338] New: target-features are not preserved in LTO object files that contain no functions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 28 15:52:02 PDT 2021


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

            Bug ID: 52338
           Summary: target-features are not preserved in LTO object files
                    that contain no functions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: sbc at chromium.org
                CC: llvm-bugs at lists.llvm.org

LLVM target features are attached to functions, so if there are no functions in
a given TU then the resulting LTO object file will not include any
target-features.

For native object files problem does not occurs.

The problem arrises, for example, in emscripten when one does 

```
$ emcc -s SIDE_MODULE -O2 -fPIC empty.c
wasm-ld: error: mutable global imported but 'mutable-globals' feature not
present in inputs: `__stack_pointer`. Use --no-check-features to suppress.
```

This is because clang injects the mutable-globals features when
`RelocationModel == llvm::Reloc::PIC_`, but when there is no function in the
object file this information is lost, and then when the LTO/bitcode object is
compiled it lacks this feature.

-- 
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/20211028/e093a606/attachment-0001.html>


More information about the llvm-bugs mailing list