Skip to contentSkip to conversation

objtool: Hide unnecessary compiler error message

PATCH Applied David Engraf 3 participants 3 messages Feb 3, 2025 – Mar 14, 2025 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: Hide unnecessary compiler error message

The check for using old libelf prints an error message when libelf.h is not available but does not abort. This may confuse so hide the compiler error message.

---
 tools/objtool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/Makefile +1 -1
index f56e277275341..38609e3612ba1 100644
@@ -37,7 +37,7 @@ OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBE
 OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
 
 # Allow old libelf to be used:
-elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - | grep elf_getshdr)
+elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - 2>/dev/null | grep elf_getshdr)
 OBJTOOL_CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
 
 # Always want host compilation.
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · David Engraf

The check for using old libelf prints an error message when libelf.h is not available but does not abort. This may confuse so hide the compiler error message.

---
 tools/objtool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Queued, thanks!

Signature · 1 line
Josh
merge bot Applied
#2 lore raw
In reply to David Engraf
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     bf71940fc16953bed84caa59b7b076ead70d42f6
Gitweb:        https://git.kernel.org/tip/bf71940fc16953bed84caa59b7b076ead70d42f6
Author:        David Engraf <[email protected]>
AuthorDate:    Mon, 03 Feb 2025 08:36:10 +01:00
Committer:     Josh Poimboeuf <[email protected]>
CommitterDate: Wed, 12 Mar 2025 15:43:38 -07:00

objtool: Hide unnecessary compiler error message

The check for using old libelf prints an error message when libelf.h is not available but does not abort. This may confuse so hide the compiler error message.

---
 tools/objtool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/Makefile +1 -1
index 7a65948..8c20361 100644
@@ -37,7 +37,7 @@ OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBE
 OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
 
 # Allow old libelf to be used:
-elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - | grep elf_getshdr)
+elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - 2>/dev/null | grep elf_getshdr)
 OBJTOOL_CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
 
 # Always want host compilation.