[llvm-bugs] [Bug 34311] New: Improve -O argument handling

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 24 08:50:43 PDT 2017


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

            Bug ID: 34311
           Summary: Improve -O argument handling
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: emaste at freebsd.org
                CC: llvm-bugs at lists.llvm.org
            Blocks: 23214

I am currently working through the build failures found in a FreeBSD ports
build using lld as the linker. A few ports are failing due to differences in
treatment of the -O option.

1. -O with no argument

Although not documented, ld.bfd accepts -O without an argument. Example
invocation:

% ld.bfd -O string-lib.o -x -r string-lib.o
%

Because -O is documented as taking a number it seems reasonable to reject an
invocation with no argument. Our error message could be improved though:

% ld.lld -O
ld.lld: error: -O: number expected, but got

Even "number expected, but got ''" as produced by parseInt (vs getInteger) is a
bit more clear.

2. Space before argument

Linking is sometimes performed with something like -Wl,-O,2 passed to the
compiler driver, resulting in

% ld.bfd -O 2 string-lib.o -x -r string-lib.o

-O should just be JoinedOrSeparate perhaps?

Example failing ports: archivers/lua51-zlib, www/cgihtml


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=23214
[Bug 23214] [META] Using LLD as FreeBSD's system linker
-- 
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/20170824/253104c5/attachment.html>


More information about the llvm-bugs mailing list