Index | Thread | Search

From:
Lucas Gabriel Vuotto <lucas@sexy.is>
Subject:
exec_elf.h: remove CONCAT definition
To:
tech@openbsd.org
Date:
Tue, 15 Apr 2025 06:34:00 +0000

Download raw body.

Thread
Hi tech,

/sys/sys/exec_elf.h defines a CONCAT macro as another name for __CONCAT
and uses it in the next 2 lines:

   751	#if defined(ELFSIZE)
   752	#define CONCAT(x,y)	__CONCAT(x,y)
   753	#define ELFNAME(x)	CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
   754	#define ELFDEFNNAME(x)	CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
   755	#endif

CONCAT tends to be commonly used for this same purpouse, and this header
can leak into public. In src tree, CONCAT is defined in:

/usr/src/gnu/gcc/gcc/config/sh/lib1funcs.h
/usr/src/gnu/llvm/lldb/tools/debugserver/source/RNBDefs.h
/usr/src/gnu/usr.bin/gcc/gcc/config/sh/lib1funcs.asm
/usr/src/gnu/usr.bin/gcc/gcc/testsuite/gcc.dg/attr-invalid.c
/usr/src/usr.bin/make/defines.h

In ports land, at least net/haproxy defines CONCAT. It's also used as
the name on some resources online.

Given that it's a common, and that its definition in exec_elf.h isn't
really doing anything, OK to unroll it? I built a kernel successfully;
idk if there is another thing I should take a care a look for. Release?
Ask for a bulk?

	Lucas


diff refs/heads/master be9bfc1925ab6ceacbff72089a3b01fc16a1769c
commit - fe0564919a5ad48e136b44be6d5be4142f626e37
commit + be9bfc1925ab6ceacbff72089a3b01fc16a1769c
blob - 4781824b4fa893f68921f4e36226bc72cca6cb06
blob + 5d4da83406ef9f439faf2842a095a02089f920d2
--- sys/sys/exec_elf.h
+++ sys/sys/exec_elf.h
@@ -749,9 +749,8 @@ struct elf_args {
 #endif
 
 #if defined(ELFSIZE)
-#define CONCAT(x,y)	__CONCAT(x,y)
-#define ELFNAME(x)	CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
-#define ELFDEFNNAME(x)	CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
+#define ELFNAME(x)	__CONCAT(elf,__CONCAT(ELFSIZE,__CONCAT(_,x)))
+#define ELFDEFNNAME(x)	__CONCAT(ELF,__CONCAT(ELFSIZE,__CONCAT(_,x)))
 #endif
 
 #if defined(ELFSIZE) && (ELFSIZE == 32)