[llvm-bugs] [Bug 38040] New: DEFINED doesn't work with the conditional operator

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 3 09:21:07 PDT 2018


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

            Bug ID: 38040
           Summary: DEFINED doesn't work with the conditional operator
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: royger at freebsd.org
                CC: llvm-bugs at lists.llvm.org

Hello,

The following construct:

foo = DEFINED(foo) ? foo : .;

Doesn't work with ld:

ld: error: script.lds:2: symbol not found: foo

This is one of the usages of the DEFINED builtin functions from the GNU ld
manual at:

https://sourceware.org/binutils/docs/ld/Builtin-Functions.html

Here are the steps in order to reproduce:

$ cat script.lds
SECTIONS {
        foo = DEFINED(foo) ? foo : .;
}
$ touch foo.c
$ cc -c foo.c -o foo.o
$ ld -T script.lds foo.o
ld: error: script.lds:2: symbol not found: foo

-- 
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/20180703/e48d2509/attachment.html>


More information about the llvm-bugs mailing list