Diff for /wikisrc/symbol_versions.mdwn between versions 1.2 and 1.3

version 1.2, 2021/01/05 02:14:52 version 1.3, 2021/01/05 02:17:38
Line 64  call the symbol `__time50` using the 64- Line 64  call the symbol `__time50` using the 64-
 such as C foreign function interfaces in dynamic languages like Python,  such as C foreign function interfaces in dynamic languages like Python,
 need to know that if they want the legacy 32-bit time() function, they  need to know that if they want the legacy 32-bit time() function, they
 must use the symbol `time`, and if they want the modern 64-bit time()  must use the symbol `time`, and if they want the modern 64-bit time()
 function, they must use the symbol `__time50`.  function, they must use the symbol `__time50`.**
 Similarly, programs that use `LD_PRELOAD` (see  
   **Similarly, programs that use `LD_PRELOAD` (see
 [[!template id=man name="ld.elf_so" section="3"]])  [[!template id=man name="ld.elf_so" section="3"]])
 to interpose their own definitions of symbols, such as  to interpose their own definitions of symbols, such as
 [torsocks](https://gitlab.torproject.org/legacy/trac/-/wikis/doc/torsocks),  [torsocks](https://gitlab.torproject.org/legacy/trac/-/wikis/doc/torsocks),
 must know to define `__time50` if they want to replace the new  must know to define `__time50` if they want to replace the new
 semantics in new programs, or `time` if they want to replace the old  semantics in new programs, or `time` if they want to replace the old
 semantics in old programs.**  semantics in old programs.**
   
 The same applies to many other standard C functions, such as  The same applies to many other standard C functions, such as
 [[!template id=man name="clock_gettime" section="3"]]  [[!template id=man name="clock_gettime" section="3"]]
 (`__clock_gettime50`) and  (`__clock_gettime50`) and
Line 108  The semantics is: Line 110  The semantics is:
   
 - When creating a library, a version map may be specified like so:  - When creating a library, a version map may be specified like so:
   
     NetBSD_BASE {        NetBSD_BASE {
             global:                global:
                     __time50;                        __time50;
                     free;                        free;
                     malloc;                        malloc;
                     time;                        time;
             local:                local:
                     *;                        *;
     };        };
   
     NetBSD_6 {        NetBSD_6 {
             global:                global:
                     time;                        time;
     };        };
   
   The library can specify what versioned symbol each definition in the    The library can specify what versioned symbol each definition in the
   library is exposed with:    library is exposed with:
   
     __asm(".symver time_legacy,time@NetBSD_BASE");        __asm(".symver time_legacy,time@NetBSD_BASE");
     int time_legacy(int *t) { ... }        int time_legacy(int *t) { ... }
   
     __asm(".symver time64,time@@NetBSD_6");         /* default version */        __asm(".symver time64,time@@NetBSD_6");         /* default version */
     int64_t time64(int64_t *t) { ... }        int64_t time64(int64_t *t) { ... }
   
     __asm(".symver __time50,__time50@NetBSD_BASE");        __asm(".symver __time50,__time50@NetBSD_BASE");
     __typeof(time) __time50 __attribute__((__alias__("time64")));        __typeof(time) __time50 __attribute__((__alias__("time64")));
   
   Versions marked with `@@` are _default_ versions; versions marked    Versions marked with `@@` are _default_ versions; versions marked
   with `@` are non-default.    with `@` are non-default.
Line 160  The semantics is: Line 162  The semantics is:
   For example, if [[!template id=man name="time" section="3"]] is    For example, if [[!template id=man name="time" section="3"]] is
   declared in a header file as simply    declared in a header file as simply
   
     typedef int64_t time_t;        typedef int64_t time_t;
     time_t time(time_t *);        time_t time(time_t *);
   
   then new programs will be linked against `time@NetBSD_6`, which is    then new programs will be linked against `time@NetBSD_6`, which is
   the default version for the symbol name `time`.    the default version for the symbol name `time`.

Removed from v.1.2  
changed lines
  Added in v.1.3


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb