[Bug 216587] cc should accept -pie argument

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jan 30 18:18:18 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216587

Dimitry Andric <dim at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |Not A Bug
             Status|In Progress                 |Closed

--- Comment #3 from Dimitry Andric <dim at FreeBSD.org> ---
Removing some stuff from the command line to clarify:

> c++ -c [...] -pie -fPIE [...] -o chatline.o src/chatlog/chatline.cpp

So this is a compilation of a .cpp file to .o, and this case the -pie option
does not apply, as it is meant for the link phase.

Examples of how to avoid "unused argument" warnings:

$ c++ -fPIE -pie helloworld.cpp -o helloworld

$ file helloworld
helloworld: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0
(1200020), FreeBSD-style, not stripped

$ c++ -fPIE -c helloworld.cpp

$ c++ -pie helloworld.o -o helloworld

$ file helloworld
helloworld: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0
(1200020), FreeBSD-style, not stripped

Alternatively, if it is difficult to get upstream software to untangle CFLAGS,
CXXFLAGS and LDFLAGS, add -Qunused-arguments.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-toolchain mailing list