Skip to contentSkip to conversation

libselinux: fix compiler flags for linux + clang

PATCH Applied [email protected] 3 participants 8 messages Nov 1, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: fix compiler flags for linux + clang

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

We already have those options set for Darwin, just drop them from the clang side.

---
 libselinux/src/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
libselinux/src/Makefile +1 -2
index ae40f80..b92fe1c 100644
@@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
 	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
 else
 override CFLAGS += -Wunused-command-line-argument
-override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
-LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 ifeq ($(OS), Darwin)
 override CFLAGS += -I/opt/local/include
 override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
+LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 PCRE_LDFLAGS ?= -lpcre
Signature · 1 line
2.7.4
#1 lore raw

Nicolas,

Let us know if this works for you, I am unable to test it at the moment on Linux.
I did test this on Mac, its OK.

Quoted 46 lines · On Tue, Nov 1, 2016 at 1:23 PM, <[email protected]> wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

We already have those options set for Darwin, just drop them from the clang side.

---
 libselinux/src/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
libselinux/src/Makefile +1 -3
index ae40f80..b92fe1c 100644
@@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
        -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
 else
 override CFLAGS += -Wunused-command-line-argument
-override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
-LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 ifeq ($(OS), Darwin)
 override CFLAGS += -I/opt/local/include
 override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
+LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 PCRE_LDFLAGS ?= -lpcre
--

2.7.4

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Signature · 3 lines
Respectfully,

William C Roberts
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On 11/01/2016 04:23 PM, [email protected] wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

Quoted 8 lines

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

We already have those options set for Darwin, just drop them from the clang side.

Thanks, applied.

Quoted 26 lines
---
 libselinux/src/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
libselinux/src/Makefile +1 -2
index ae40f80..b92fe1c 100644
@@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
 	-Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
 else
 override CFLAGS += -Wunused-command-line-argument
-override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
-LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 ifeq ($(OS), Darwin)
 override CFLAGS += -I/opt/local/include
 override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
+LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 PCRE_LDFLAGS ?= -lpcre
#3 lore raw
Quoted 12 lines · Stephen Smalley
Quoted 11 lines · On 11/01/2016 04:23 PM, [email protected] wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

Quoted 4 lines
Quoted 2 lines

We already have those options set for Darwin, just drop them from the clang side.

Thanks, applied.

Did you check this with clang-3.9 locally and reproduce the error?

Quoted 33 lines
Quoted 17 lines
---
 libselinux/src/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
libselinux/src/Makefile +0 -1
index ae40f80..b92fe1c 100644
@@ -73,13 +73,12 @@ override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync
      -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wp,-D_FORTIFY_SOURCE=2
 else
 override CFLAGS += -Wunused-command-line-argument
-override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup

libselinux/src/Makefile override CFLAGS += -fipa-pure-const -Wlogical-op -Wpacked-bitfield-compat -Wsync · line 84

Quoted 10 lines
libselinux/src/Makefile +1 -1
-LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 ifeq ($(OS), Darwin)
 override CFLAGS += -I/opt/local/include
 override LDFLAGS += -L/opt/local/lib -undefined dynamic_lookup
+LD_SONAME_FLAGS=-install_name,$(LIBSO)
 endif
 
 PCRE_LDFLAGS ?= -lpcre

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Signature · 3 lines
Respectfully,

William C Roberts
#4 lore raw
Quoted 13 lines · William Roberts
Quoted 12 lines · Stephen Smalley
Quoted 11 lines · On 11/01/2016 04:23 PM, [email protected] wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

We already have those options set for Darwin, just drop them from the clang side.

Thanks, applied.

Did you check this with clang-3.9 locally and reproduce the error?

Yes. I think casting to void* will clear it.

#5 lore raw
Quoted 14 lines · Stephen Smalley
Quoted 13 lines · William Roberts
Quoted 12 lines · Stephen Smalley
Quoted 11 lines · On 11/01/2016 04:23 PM, [email protected] wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

We already have those options set for Darwin, just drop them from the clang side.

Thanks, applied.

Did you check this with clang-3.9 locally and reproduce the error?

Yes. I think casting to void* will clear it.

That's what I was leaning towards myself.

Signature · 3 lines
Respectfully,

William C Roberts
#6 lore raw
Quoted 18 lines · William Roberts
Quoted 17 lines · Stephen Smalley
Quoted 16 lines · William Roberts
Quoted 15 lines · Stephen Smalley
Quoted 13 lines · On 11/01/2016 04:23 PM, [email protected] wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

We already have those options set for Darwin, just drop them from the clang side.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Thanks, applied.

Did you check this with clang-3.9 locally and reproduce the error?

Yes. I think casting to void* will clear it.

That's what I was leaning towards myself.

Actually, if you just switch the parameter type for buf in both functions to void*, everything is fine.

#7 lore raw
Quoted 21 lines · Stephen Smalley
Quoted 20 lines · William Roberts
Quoted 19 lines · Stephen Smalley
Quoted 18 lines · William Roberts
Quoted 16 lines · Stephen Smalley
Quoted 5 lines · On 11/01/2016 04:23 PM, [email protected] wrote:

From: William Roberts <[email protected]>

As reported by Nicolas Iooss, the clang + linux build seems broken:

Quoted 8 lines

clang-3.9: warning: argument unused during compilation: '-undefined
dynamic_lookup'
/usr/bin/ld: unrecognised option: -install_name clang-3.9: error: linker command failed with exit code 1 (use -v to
see invocation)

We already have those options set for Darwin, just drop them from the clang side.

Thanks, applied.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Did you check this with clang-3.9 locally and reproduce the error?

Yes. I think casting to void* will clear it.

That's what I was leaning towards myself.

Actually, if you just switch the parameter type for buf in both functions to void*, everything is fine.

That's actually exactly what I have locally that I am testing.