master
 1#define _FILE_OFFSET_BITS 64
 2#include <unistd.h>
 3#include <fcntl.h>
 4#include <stdio.h>
 5#include <resolv.h>
 6
 7int main() {
 8    /* in glibc 2.28+ and _FILE_OFFSET_BITS=64 fcntl is #define'd to fcntl64
 9     * Thus headers say `fcntl64` exists, but libc.so.6 (the old one)
10     * disagrees, resulting in a linking error unless headers are made
11     * backwards-compatible.
12     *
13     * Glibc 2.28+:
14     *   FUNC    GLOBAL DEFAULT  UND fcntl64@GLIBC_2.28 (3):
15     *
16     * Glibc 2.27 or older:
17     *   FUNC    GLOBAL DEFAULT  UND fcntl@GLIBC_2.2.5
18     */
19    printf("address to fcntl: %p\n", fcntl);
20
21    /* The following functions became symbols of their own right with glibc
22     * 2.34+. Before 2.34 resolv.h would #define res_search __res_search; and
23     * __res_search is a valid symbol since the beginning of time.
24     *
25     * On glibc 2.34+ these symbols are linked this way:
26     *   FUNC    GLOBAL DEFAULT  UND res_search@GLIBC_2.34 (2)
27     *
28     * Pre-glibc 2.34:
29     *   FUNC    GLOBAL DEFAULT  UND __res_search@GLIBC_2.2.5 (4)
30     */
31    printf("address to res_search: %p\n", res_search);
32    printf("address to res_nsearch: %p\n", res_nsearch);
33    printf("address to res_query: %p\n", res_query);
34    printf("address to res_nquery: %p\n", res_nquery);
35    printf("address to res_querydomain: %p\n", res_querydomain);
36    printf("address to res_nquerydomain: %p\n", res_nquerydomain);
37    printf("address to dn_skipname: %p\n", dn_skipname);
38    printf("address to dn_comp: %p\n", dn_comp);
39    printf("address to dn_expand: %p\n", dn_expand);
40}