1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

If using GNUC and ELF, make __IDSTRING() expand into an inline asm

statement to put the rcsid into the .comment section.  This allows
the comments (ie:version id's of compiler, headers, source, etc) to be
stripped out with the standard tools (strip/objcopy).  SVR4 has a
tool called 'mcs' (manipulate comment section) which allows you to
add/remove/compact strings.  Removing duplicate strings helps a lot
if the headers generate them.
Using __attribute__((section(".comment"))) would probably also work,
but that still leaves the RCSID occupying C name space somewhere.
This commit is contained in:
Peter Wemm 1999-08-30 03:57:47 +00:00
parent 158562983e
commit 4e731e62c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50614

View File

@ -190,7 +190,11 @@
#endif /* __ELF__ */
#endif /* __GNUC__ */
#if defined(__GNUC__) && defined(__ELF__)
#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
#else
#define __IDSTRING(name,string) static const char name[] __unused = string
#endif
#ifndef __RCSID
#define __RCSID(s) __IDSTRING(rcsid,s)