help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFLAGS/LDFLAGS for PIE vs PIC?


From: Jeffrey Walton
Subject: CFLAGS/LDFLAGS for PIE vs PIC?
Date: Sun, 1 Apr 2012 14:30:37 -0400

Hi All,

I'm interested in trying to figure out how to "cleanly" set options
for CFLAGS (and CXXFLAGS) and LDFLAGS. I also want it to intelligently
apply to programs and shared objects. The problem I am having is
programs need:

  CFLAGS += -fPIE
  LDFLAGS += -pie

while shared objects need:

  CFLAGS += -fPIC
  LDFLAGS += -shared

So I can't run configure to set up a project properly:

$ configure CFLAGS="-Wall -Wextra -Wconversion -fPIE -pie
    -Wno-unused-parameter -Wformat=2 -Wformat-security
    -fstack-protector-all -Wstrict-overflow
    -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"

I see others have also felt the same discomfort
(http://lists.fedoraproject.org/pipermail/devel-announce/2011-August/000821.html):

    "All of this is only an issue because most build systems don't
    let you say different CFLAGS or LDFLAGS for shared libraries
    and executables.  Sigh."

Any ideas?

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]