[PATCH] [ELF] Fix the file look up algorithm used in the linker script GROUP command.

Simon Atanasyan simon at atanasyan.com
Wed Apr 30 12:14:06 PDT 2014


Hi Bigcheese, shankarke, ruiu,

In general the linker scripts' GROUP command works like a pair of command line options --start-group/--end-group. But there is a difference in the files look up algorithm.

The --start-group/--end-group commands use a trivial approach:
a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' suffix and search the path through library search directories.
b) Otherwise, use the path 'as-is'.

The GROUP command implements more compicated approach:
a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' suffix and search the path through library search directories.
b) If the path does not have '-l' prefix, and sysroot is configured, and the path starts with the / character, and the script being processed is located inside the sysroot, search the path under the sysroot. Otherwise, try to open the path in the current directory. If it is not found, search through library search directories.

https://www.sourceware.org/binutils/docs-2.24/ld/File-Commands.html

http://reviews.llvm.org/D3575

Files:
  include/lld/Driver/GnuLdInputGraph.h
  include/lld/ReaderWriter/ELFLinkingContext.h
  lib/Driver/GnuLdDriver.cpp
  lib/Driver/GnuLdInputGraph.cpp
  lib/ReaderWriter/ELF/ELFLinkingContext.cpp
  test/elf/Inputs/group-cmd-search-1.ls
  test/elf/Inputs/group-cmd-search-2.ls
  test/elf/group-cmd-search.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3575.8989.patch
Type: text/x-patch
Size: 9710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140430/a531fac4/attachment.bin>


More information about the llvm-commits mailing list