This ld doesn't implement standard Unix ld semantics, where "options which refer to files, such as -l [...], cause the file to be read at the point at which the option appears in the command line, relative to the object files and other file options" (GNU Binutils 2.38 ld documentation).
Instead, this ld first collects all -l options:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L409-L410
..., makes them unique:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L434-L435
..., then reads all input files on the command line:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L455-L463
..., and then processes unresolved symbols:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L534-L535
This
lddoesn't implement standard Unixldsemantics, where "options which refer to files, such as-l[...], cause the file to be read at the point at which the option appears in the command line, relative to the object files and other file options" (GNU Binutils 2.38lddocumentation).Instead, this
ldfirst collects all-loptions:https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L409-L410
..., makes them unique:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L434-L435
..., then reads all input files on the command line:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L455-L463
..., and then processes unresolved symbols:
https://github.com/MentorEmbedded/nvptx-tools/blob/93e00909ceb9cbbc104f0fcba56c0361ffb3ca4b/nvptx-ld.cc#L534-L535