[llvm-bugs] [Bug 44450] New: LLD doesn't support archive:file syntax in linker scripts

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 3 02:44:24 PST 2020


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

            Bug ID: 44450
           Summary: LLD doesn't support archive:file syntax in linker
                    scripts
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: john.brawn at arm.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

If you you have:

main.c
  extern int fn();
  int main() {
    return fn();
  }

example.c
  int fn() {
    return 0;
  }

script.ld
  SECTIONS
  {
    ALL 0x1000 : {
      main.o(*)
      lib.a:example.o(*)
    }
  }

And do:
  clang main.c example.c -c
  ar t lib.a
  rm example.o
  ld.lld -T script.ld main.o lib.a -M

Then the map that's output shows

             VMA              LMA     Size Align Out     In      Symbol
            1000             1000       56     4 ALL
            1000             1000       28     4         main.o:(.text)
            1000             1000        0     1                 $x.0
            1000             1000       28     1                 main
            1028             1028       2e     1         <internal>:(ALL)
            1058             1058        8     4 .text
            1058             1058        8     4        
lib.a(example.o):(.text)
            1058             1058        0     1                 $x.0
            1058             1058        8     1                 fn

The syntax of lib.a:example.o should select example.o inside of lib.a but this
isn't happening. *:example.o also doesn't work. GNU ld will also accept
*example.o (though I don't think this is documented anywhere) but this also
doesn't work with lld. What does work is *example.o* as lld treats the filename
as lib.a(example.o).

-- 
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/20200103/295de21c/attachment-0001.html>


More information about the llvm-bugs mailing list