Source-Changes archive

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

CVS commit: othersrc/external/bsd/agcre/dist



Module Name:    othersrc
Committed By:   agc
Date:           Sat Dec  4 01:54:51 UTC 2021

Modified Files:
        othersrc/external/bsd/agcre/dist: agcre.c agcre.h

Log Message:
Add visibility definitions for agcre.

For any sources embedding these routines, simply define HIDE_AGCRE,
before including the agcre.h header file, and the routines will have
the hidden visibility attribute set on them.  For more information on
that, see

        https://gcc.gnu.org/wiki/Visibility

To stop agcre routines being exported in a .so, simply define
HIDE_AGCRE - I've been doing this successfully in library Makefiles,
for example, this is from elex/lib/Makefile (elex is a library that
calls the agcre functions):

        # set symbol visibility for .so
        CPPFLAGS+=      -DHIDE_AGCRE

and the agcre symbols will be found just fine when linking and
running, but will not be exported by the linker.  This can save
headaches, and weird crashes, especially when combined with ASLR (when
two libraries define the same symbol, but with different structs or
arguments).

BEFORE:
        [2021/12/03 Fri 17:47:19] agc@netbsd-002 ~/local/elex-20211115 [13781] > nm -D lib/libelex.so
                         w _Jv_RegisterClasses
                         w __cxa_finalize
                         w __deregister_frame_info
                         U __fstat50
                         w __register_frame_info
                         U __sF
        000000000020f198 D _end
        000000000000c240 T _fini
        0000000000000ea0 T _init
        000000000000aa13 T agcre_new
        000000000000bc48 T agcre_regasub
        000000000000aa28 T agcre_regcomp
        000000000000adde T agcre_regerror
        000000000000ae48 T agcre_regexec
        000000000000b8fd T agcre_regfree
        000000000000b9a2 T agcre_regnsub
        000000000000b7e8 T agcre_rev_regexec
                         U asprintf
                         U calloc
        00000000000027f6 T elex_dispose
        0000000000002b6a T elex_exec
        0000000000002f5b T elex_exec_str
        0000000000002982 T elex_make_new_rule
        00000000000027bb T elex_new
                         U fclose
                         U fopen
                         U fprintf
                         U free
                         U fwrite
                         U memchr
                         U memcmp
                         U memcpy
                         U memmove
                         U memset
                         U mmap
                         U munmap
                         U printf
                         U putchar
                         U realloc
                         U snprintf
                         U strchr
                         U strcmp
                         U strdup
        000000000000c10c T striter_dispose
        000000000000c165 T striter_exec
        000000000000c1da T striter_exec_mem
        000000000000c0f7 T striter_new
                         U strlen
                         U strtol
                         U strtoul
                         U vsnprintf
                         U warn
                         U warnx
        [2021/12/03 Fri 17:47:22] agc@netbsd-002 ~/local/elex-20211115 [13782] >

AFTER adding HIDE_AGCRE (and HIDE_STRITER) to elex/lib/Makefile:
        [2021/12/03 Fri 17:47:45] agc@netbsd-002 ~/local/elex-20211115 [13774] > nm -D lib/libelex.so
                         w _Jv_RegisterClasses
                         w __cxa_finalize
                         w __deregister_frame_info
                         U __fstat50
                         w __register_frame_info
                         U __sF
        000000000020e160 D _end
        000000000000bf30 T _fini
        0000000000000c00 T _init
                         U asprintf
                         U calloc
        00000000000024e6 T elex_dispose
        000000000000285a T elex_exec
        0000000000002c4b T elex_exec_str
        0000000000002672 T elex_make_new_rule
        00000000000024ab T elex_new
                         U fclose
                         U fopen
                         U fprintf
                         U free
                         U fwrite
                         U memchr
                         U memcmp
                         U memcpy
                         U memmove
                         U memset
                         U mmap
                         U munmap
                         U printf
                         U putchar
                         U realloc
                         U snprintf
                         U strchr
                         U strcmp
                         U strdup
                         U strlen
                         U strtol
                         U strtoul
                         U vsnprintf
                         U warn
                         U warnx


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/agcre/dist/agcre.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/agcre/dist/agcre.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index