[llvm-bugs] [Bug 38948] New: PROVIDE script variable defined if only referenced via other PROVIDE

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 14 04:36:01 PDT 2018


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

            Bug ID: 38948
           Summary: PROVIDE script variable defined if only referenced via
                    other PROVIDE
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: llvm-bugs at lists.llvm.org

Take the following snippet from a linker script:

    .foo : 
    { 
        PROVIDE (__foo_start = .);
        *(.foo.foo.*)
        PROVIDE (__foo_end = .);
        PROVIDE (__foo_size = __foo_end - __foo_start);
    }

When linking with LLD, __foo_start and __foo_end are always defined, even if
nothing in objects reference them, despite being marked with PROVIDE.
__foo_size is not referenced or defined in this case. It appears that the
reference is generated for the __foo_size calculation, even though the
calculation is unnecessary (beause __foo_size is not itself referenced). This
does match gold's behaviour, but differs from bfd's, and also differs from my
natural expectation, since it prevents the above pattern from being useful.

-- 
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/20180914/140a094d/attachment.html>


More information about the llvm-bugs mailing list