[PATCH] linker: enforce some sections kept when garbage collection on

27 views
Skip to first unread message

Waldemar Kozaczuk

unread,
Dec 5, 2021, 5:29:10 PM12/5/21
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch changes the x64 linker script to keep some sections
when garbage collection (--gc-sections) is on when linking the kernel.

This mostly involves adding KEEP directives to specify number of extra
entry points - start32_address, start32_from_vmlinuz_address - so that
linker treats them as extra code roots and does not eliminate relevant code
from the resulting elf file.

Similarly we also add KEEP to .memcpy_decode, .fixup, .eh_frame*,
.tracepoint_patch_sites* and .init* sections to make them retained
when linking with garbage collection on.

This changes to not have any effect on the linker result when garbage
collection is off - the default.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
arch/x64/loader.ld | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x64/loader.ld b/arch/x64/loader.ld
index 78a3c939..debdbf15 100644
--- a/arch/x64/loader.ld
+++ b/arch/x64/loader.ld
@@ -23,14 +23,14 @@ SECTIONS
*/
.start32_address : AT(ADDR(.start32_address) - OSV_KERNEL_VM_SHIFT) {
*(.start32_address)
- }
+ KEEP(*(.start32_address)) }
. = OSV_KERNEL_VM_BASE + 0x900;
/*
* Place address of start32_from_vmlinuz routine at predefined offset in memory
*/
.start32_from_vmlinuz_address : AT(ADDR(.start32_from_vmlinuz_address) - OSV_KERNEL_VM_SHIFT) {
*(.start32_from_vmlinuz_address)
- }
+ KEEP(*(.start32_from_vmlinuz_address)) }
. = OSV_KERNEL_VM_BASE + 0x1000;
.dynamic : AT(ADDR(.dynamic) - OSV_KERNEL_VM_SHIFT) { *(.dynamic) } :dynamic :text
.text : AT(ADDR(.text) - OSV_KERNEL_VM_SHIFT) {
@@ -48,32 +48,32 @@ SECTIONS
HIDDEN(fault_fixup_start = .);
*(.fixup)
HIDDEN(fault_fixup_end = .);
- } :text
+ KEEP(*(.fixup)) } :text

. = ALIGN(8);
.memcpy_decode : AT(ADDR(.memcpy_decode) - OSV_KERNEL_VM_SHIFT) {
HIDDEN(memcpy_decode_start = .);
*(.memcpy_decode)
HIDDEN(memcpy_decode_end = .);
- } :text
+ KEEP(*(.memcpy_decode)) } :text

- .eh_frame : AT(ADDR(.eh_frame) - OSV_KERNEL_VM_SHIFT) { *(.eh_frame) } : text
+ .eh_frame : AT(ADDR(.eh_frame) - OSV_KERNEL_VM_SHIFT) { *(.eh_frame) KEEP(*(.eh_frame)); } : text
.rodata : AT(ADDR(.rodata) - OSV_KERNEL_VM_SHIFT) { *(.rodata*) } :text
- .eh_frame : AT(ADDR(.eh_frame) - OSV_KERNEL_VM_SHIFT) { *(.eh_frame) } :text
- .eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - OSV_KERNEL_VM_SHIFT) { *(.eh_frame_hdr) } :text :eh_frame
+ .eh_frame : AT(ADDR(.eh_frame) - OSV_KERNEL_VM_SHIFT) { *(.eh_frame) KEEP(*(.eh_frame)); } :text
+ .eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - OSV_KERNEL_VM_SHIFT) { *(.eh_frame_hdr) KEEP(*(.eh_frame_hdr)); } :text :eh_frame
.note : AT(ADDR(.note) - OSV_KERNEL_VM_SHIFT) { *(.note*) } :text :note
.gcc_except_table : AT(ADDR(.gcc_except_table) - OSV_KERNEL_VM_SHIFT) { *(.gcc_except_table) *(.gcc_except_table.*) } : text
.tracepoint_patch_sites ALIGN(8) : AT(ADDR(.tracepoint_patch_sites) - OSV_KERNEL_VM_SHIFT) {
HIDDEN(__tracepoint_patch_sites_start = .);
*(.tracepoint_patch_sites)
HIDDEN(__tracepoint_patch_sites_end = .);
- } : text
+ KEEP(*(.tracepoint_patch_sites)) } : text
.data.rel.ro : AT(ADDR(.data.rel.ro) - OSV_KERNEL_VM_SHIFT) { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } : text
.data : AT(ADDR(.data) - OSV_KERNEL_VM_SHIFT) { *(.data) } :text
HIDDEN(_init_array_start = .);
.init_array : AT(ADDR(.init_array) - OSV_KERNEL_VM_SHIFT) {
*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))
- *(.init_array .ctors)
+ *(.init_array .ctors) KEEP(*(.init_array .init_array.* .ctors.* .ctors))
} : text
HIDDEN(_init_array_end = .);
. = ALIGN(4096);
--
2.31.1

Waldemar Kozaczuk

unread,
Dec 5, 2021, 5:29:13 PM12/5/21
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch adds files with lists of symbols to be exported
by kernel. The files have been generated on Fedora 33 using
the scripts/extract_symbols.sh.

These files will be fed to the process to generate version script.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
.../x64/osv_ld-linux-x86-64.so.2.symbols | 2 +
.../x64/osv_ld-musl-x86_64.so.1.symbols | 1254 +++++++++++++++++
exported_symbols/x64/osv_libaio.so.1.symbols | 5 +
exported_symbols/x64/osv_libc.so.6.symbols | 1053 ++++++++++++++
.../x64/osv_libcrypt.so.1.symbols | 4 +
exported_symbols/x64/osv_libdl.so.2.symbols | 6 +
exported_symbols/x64/osv_libm.so.6.symbols | 226 +++
.../x64/osv_libpthread.so.0.symbols | 112 ++
.../x64/osv_libresolv.so.2.symbols | 0
exported_symbols/x64/osv_librt.so.1.symbols | 0
exported_symbols/x64/osv_libutil.so.symbols | 2 +
.../x64/osv_libxenstore.so.3.0.symbols | 8 +
12 files changed, 2672 insertions(+)
create mode 100644 exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols
create mode 100644 exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
create mode 100644 exported_symbols/x64/osv_libaio.so.1.symbols
create mode 100644 exported_symbols/x64/osv_libc.so.6.symbols
create mode 100644 exported_symbols/x64/osv_libcrypt.so.1.symbols
create mode 100644 exported_symbols/x64/osv_libdl.so.2.symbols
create mode 100644 exported_symbols/x64/osv_libm.so.6.symbols
create mode 100644 exported_symbols/x64/osv_libpthread.so.0.symbols
create mode 100644 exported_symbols/x64/osv_libresolv.so.2.symbols
create mode 100644 exported_symbols/x64/osv_librt.so.1.symbols
create mode 100644 exported_symbols/x64/osv_libutil.so.symbols
create mode 100644 exported_symbols/x64/osv_libxenstore.so.3.0.symbols

diff --git a/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols b/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols
new file mode 100644
index 00000000..4d119fc5
--- /dev/null
+++ b/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols
@@ -0,0 +1,2 @@
+__libc_stack_end
+__tls_get_addr
diff --git a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
new file mode 100644
index 00000000..b3f87859
--- /dev/null
+++ b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
@@ -0,0 +1,1254 @@
+a64l
+abort
+abs
+accept
+accept4
+access
+acos
+acosf
+acosh
+acoshf
+acoshl
+acosl
+addmntent
+alarm
+aligned_alloc
+alphasort
+alphasort64
+asctime
+asctime_r
+asin
+asinf
+asinh
+asinhf
+asinhl
+asinl
+asprintf
+__assert_fail
+atan
+atan2
+atan2f
+atan2l
+atanf
+atanh
+atanhf
+atanhl
+atanl
+atexit
+atof
+atoi
+atol
+atoll
+basename
+bcmp
+bcopy
+bind
+bindtextdomain
+bind_textdomain_codeset
+brk
+bsearch
+btowc
+bzero
+calloc
+catclose
+catgets
+catopen
+cbrt
+cbrtf
+cbrtl
+ceil
+ceilf
+ceill
+cfgetispeed
+cfgetospeed
+cfmakeraw
+cfsetispeed
+cfsetospeed
+cfsetspeed
+chdir
+chmod
+chown
+chroot
+clearenv
+clearerr
+clearerr_unlocked
+clock
+clock_getcpuclockid
+clock_getres
+clock_gettime
+close
+closedir
+closelog
+confstr
+connect
+copysign
+copysignf
+copysignl
+cos
+cosf
+cosh
+coshf
+coshl
+cosl
+creat
+creat64
+crypt
+crypt_r
+ctermid
+ctime
+ctime_r
+__ctype_b_loc
+__ctype_get_mb_cur_max
+__ctype_tolower_loc
+__ctype_toupper_loc
+cuserid
+__cxa_atexit
+daemon
+__daylight
+daylight
+dcgettext
+dcngettext
+dgettext
+difftime
+dirfd
+dirname
+div
+dladdr
+dlclose
+dlerror
+dl_iterate_phdr
+dlopen
+dlsym
+dn_expand
+dngettext
+dprintf
+drand48
+drem
+dremf
+dup
+dup2
+dup3
+__duplocale
+duplocale
+eaccess
+ecvt
+encrypt
+endgrent
+endmntent
+endprotoent
+endpwent
+___environ
+__environ
+_environ
+environ
+epoll_create
+epoll_create1
+epoll_ctl
+epoll_pwait
+epoll_wait
+erand48
+erf
+erfc
+erfcf
+erfcl
+erff
+erfl
+__errno_location
+euidaccess
+eventfd
+eventfd_read
+eventfd_write
+execl
+execle
+execv
+execve
+execvp
+_exit
+exit
+_Exit
+exp
+exp10
+exp10f
+exp10l
+exp2
+exp2f
+exp2l
+expf
+expl
+explicit_bzero
+expm1
+expm1f
+expm1l
+fabs
+fabsf
+fabsl
+faccessat
+fallocate
+fallocate64
+__fbufsize
+fchdir
+fchmod
+fchmodat
+fchown
+fclose
+fcntl
+fcvt
+fdatasync
+fdim
+fdimf
+fdiml
+fdopen
+fdopendir
+feclearexcept
+fegetenv
+fegetexceptflag
+fegetround
+feholdexcept
+feof
+feof_unlocked
+feraiseexcept
+ferror
+ferror_unlocked
+fesetenv
+fesetexceptflag
+fesetround
+fetestexcept
+fflush
+fflush_unlocked
+ffs
+ffsl
+ffsll
+fgetc
+fgetc_unlocked
+fgetln
+fgetpos
+fgetpos64
+fgets
+fgets_unlocked
+fgetwc
+__fgetwc_unlocked
+fgetwc_unlocked
+fgetws
+fgetws_unlocked
+fileno
+fileno_unlocked
+finite
+finitef
+__flbf
+flock
+flockfile
+floor
+floorf
+floorl
+_flushlbf
+fmax
+fmaxf
+fmaxl
+fmemopen
+fmin
+fminf
+fminl
+fmod
+fmodf
+fmodl
+fnmatch
+fopen
+fopen64
+fork
+forkpty
+fpathconf
+__fpclassify
+__fpclassifyf
+__fpclassifyl
+__fpending
+fprintf
+__fpurge
+fpurge
+fputc
+fputc_unlocked
+fputs
+fputs_unlocked
+fputwc
+__fputwc_unlocked
+fputwc_unlocked
+fputws
+fputws_unlocked
+fread
+__freadable
+__freadahead
+__freading
+__freadptr
+__freadptrinc
+fread_unlocked
+free
+freeaddrinfo
+freeifaddrs
+__freelocale
+freelocale
+freopen
+freopen64
+frexp
+frexpf
+frexpl
+fscanf
+fseek
+fseeko
+fseeko64
+__fseterr
+__fsetlocking
+fsetpos
+fsetpos64
+fstat
+fstat64
+fstatat
+fstatat64
+fstatfs
+fstatfs64
+fstatvfs
+fstatvfs64
+fsync
+ftell
+ftello
+ftello64
+ftime
+ftruncate
+ftruncate64
+ftrylockfile
+funlockfile
+futimens
+futimes
+futimesat
+fwide
+fwprintf
+__fwritable
+fwrite
+fwrite_unlocked
+__fwriting
+fwscanf
+__fxstat
+__fxstat64
+__fxstatat
+__fxstatat64
+gai_strerror
+gcvt
+getaddrinfo
+getauxval
+getc
+getchar
+getchar_unlocked
+getc_unlocked
+get_current_dir_name
+getcwd
+getdate
+getdate_err
+__getdelim
+getdelim
+getdtablesize
+getegid
+getenv
+geteuid
+getgid
+getgrent
+getgrgid
+getgrgid_r
+getgrnam
+getgrnam_r
+getgroups
+gethostbyaddr
+gethostbyaddr_r
+gethostbyname
+gethostbyname2_r
+gethostbyname_r
+gethostid
+gethostname
+getifaddrs
+getitimer
+getline
+getloadavg
+getlogin
+getlogin_r
+getmntent
+getmntent_r
+getnameinfo
+get_nprocs
+getopt
+getopt_long
+getopt_long_only
+getpagesize
+getpeername
+getpgid
+getpgrp
+getpid
+getppid
+getpriority
+getprotobyname
+getprotobynumber
+getprotoent
+getpwent
+getpwnam
+getpwnam_r
+getpwuid
+getpwuid_r
+getrandom
+getresgid
+getresuid
+getrlimit
+getrlimit64
+getrusage
+gets
+getservbyname
+getservbyname_r
+getservbyport
+getservbyport_r
+getsid
+getsockname
+getsockopt
+getsubopt
+gettext
+gettimeofday
+getuid
+getw
+getwc
+getwchar
+getwchar_unlocked
+getwc_unlocked
+glob
+glob64
+globfree
+globfree64
+gmtime
+gmtime_r
+hasmntopt
+h_errno
+__h_errno_location
+htonl
+htons
+hypot
+hypotf
+hypotl
+iconv
+iconv_close
+iconv_open
+if_freenameindex
+if_indextoname
+if_nameindex
+if_nametoindex
+ilogb
+ilogbf
+ilogbl
+imaxabs
+imaxdiv
+in6addr_any
+in6addr_loopback
+index
+inet_addr
+inet_aton
+inet_ntoa
+inet_ntop
+inet_pton
+initgroups
+initstate
+inotify_add_watch
+inotify_init
+inotify_init1
+inotify_rm_watch
+ioctl
+_IO_feof_unlocked
+_IO_ferror_unlocked
+_IO_getc
+_IO_getc_unlocked
+_IO_putc
+_IO_putc_unlocked
+isalnum
+__isalnum_l
+isalnum_l
+isalpha
+__isalpha_l
+isalpha_l
+isascii
+isatty
+isblank
+__isblank_l
+isblank_l
+iscntrl
+__iscntrl_l
+iscntrl_l
+isdigit
+__isdigit_l
+isdigit_l
+isgraph
+__isgraph_l
+isgraph_l
+islower
+__islower_l
+islower_l
+__isoc99_fscanf
+__isoc99_fwscanf
+__isoc99_scanf
+__isoc99_sscanf
+__isoc99_swscanf
+__isoc99_vfscanf
+__isoc99_vfwscanf
+__isoc99_vscanf
+__isoc99_vsscanf
+__isoc99_vswscanf
+__isoc99_vwscanf
+__isoc99_wscanf
+isprint
+__isprint_l
+isprint_l
+ispunct
+__ispunct_l
+ispunct_l
+isspace
+__isspace_l
+isspace_l
+isupper
+__isupper_l
+isupper_l
+iswalnum
+__iswalnum_l
+iswalnum_l
+iswalpha
+__iswalpha_l
+iswalpha_l
+iswblank
+__iswblank_l
+iswblank_l
+iswcntrl
+__iswcntrl_l
+iswcntrl_l
+iswctype
+__iswctype_l
+iswctype_l
+iswdigit
+__iswdigit_l
+iswdigit_l
+iswgraph
+__iswgraph_l
+iswgraph_l
+iswlower
+__iswlower_l
+iswlower_l
+iswprint
+__iswprint_l
+iswprint_l
+iswpunct
+__iswpunct_l
+iswpunct_l
+iswspace
+__iswspace_l
+iswspace_l
+iswupper
+__iswupper_l
+iswupper_l
+iswxdigit
+__iswxdigit_l
+iswxdigit_l
+isxdigit
+__isxdigit_l
+isxdigit_l
+j0
+j0f
+j1
+j1f
+jn
+jnf
+jrand48
+kill
+killpg
+l64a
+labs
+lchown
+lcong48
+ldexp
+ldexpf
+ldexpl
+ldiv
+lgamma
+lgammaf
+lgammaf_r
+lgammal
+__lgammal_r
+lgammal_r
+lgamma_r
+__libc_current_sigrtmax
+__libc_current_sigrtmin
+__libc_start_main
+link
+listen
+llabs
+lldiv
+llround
+llroundf
+llroundl
+localeconv
+localtime
+localtime_r
+lockf
+lockf64
+log
+log10
+log10f
+log10l
+log1p
+log1pf
+log1pl
+log2
+log2f
+log2l
+logb
+logbf
+logbl
+logf
+logl
+_longjmp
+longjmp
+lrand48
+lrint
+lround
+lroundf
+lroundl
+lseek
+lseek64
+lstat
+lstat64
+lutimes
+__lxstat
+__lxstat64
+madvise
+malloc
+malloc_usable_size
+mblen
+mbrlen
+mbrtowc
+mbsinit
+mbsnrtowcs
+mbsrtowcs
+mbstowcs
+mbtowc
+memalign
+memccpy
+memchr
+memcmp
+memcpy
+memmem
+memmove
+mempcpy
+memrchr
+memset
+mincore
+mkdir
+mkdirat
+mkdtemp
+mkfifo
+mkfifoat
+mknod
+mkostemp
+mkostemp64
+mkostemps
+mkostemps64
+mkstemp
+mkstemp64
+mktemp
+mktime
+mlock
+mlockall
+mmap
+mmap64
+modf
+modff
+modfl
+mount
+mprotect
+mrand48
+msync
+munlock
+munlockall
+munmap
+nan
+nanf
+nanl
+nanosleep
+nearbyint
+nearbyintf
+nearbyintl
+__newlocale
+newlocale
+nextafter
+nextafterf
+nextafterl
+nexttoward
+nexttowardf
+nexttowardl
+nftw
+nftw64
+ngettext
+nice
+__nl_langinfo
+nl_langinfo
+__nl_langinfo_l
+nl_langinfo_l
+nrand48
+ntohl
+ntohs
+open
+open64
+openat
+openat64
+opendir
+openlog
+open_memstream
+openpty
+open_wmemstream
+optarg
+opterr
+optind
+optopt
+__optpos
+__optreset
+optreset
+__overflow
+pathconf
+pause
+pclose
+perror
+pipe
+pipe2
+poll
+popen
+posix_fadvise
+posix_fadvise64
+posix_fallocate
+posix_fallocate64
+__posix_getopt
+posix_memalign
+pow
+pow10
+pow10f
+pow10l
+powf
+powl
+ppoll
+prctl
+pread
+pread64
+preadv
+preadv64
+printf
+__progname
+__progname_full
+program_invocation_name
+program_invocation_short_name
+pselect
+pthread_atfork
+pthread_attr_destroy
+pthread_attr_getdetachstate
+pthread_attr_getguardsize
+pthread_attr_getscope
+pthread_attr_getstack
+pthread_attr_getstacksize
+pthread_attr_init
+pthread_attr_setdetachstate
+pthread_attr_setguardsize
+pthread_attr_setinheritsched
+pthread_attr_setscope
+pthread_attr_setstack
+pthread_attr_setstacksize
+pthread_barrier_destroy
+pthread_barrier_init
+pthread_barrier_wait
+pthread_cancel
+_pthread_cleanup_pop
+_pthread_cleanup_push
+pthread_condattr_destroy
+pthread_condattr_getclock
+pthread_condattr_getpshared
+pthread_condattr_init
+pthread_condattr_setclock
+pthread_condattr_setpshared
+pthread_cond_broadcast
+pthread_cond_destroy
+pthread_cond_init
+pthread_cond_signal
+pthread_cond_timedwait
+pthread_cond_wait
+pthread_create
+pthread_detach
+pthread_equal
+pthread_exit
+pthread_getaffinity_np
+pthread_getattr_np
+pthread_getcpuclockid
+pthread_getschedparam
+pthread_getspecific
+pthread_join
+pthread_key_create
+pthread_key_delete
+pthread_kill
+pthread_mutexattr_destroy
+pthread_mutexattr_gettype
+pthread_mutexattr_init
+pthread_mutexattr_setpshared
+pthread_mutexattr_settype
+pthread_mutex_destroy
+pthread_mutex_init
+pthread_mutex_lock
+pthread_mutex_timedlock
+pthread_mutex_trylock
+pthread_mutex_unlock
+pthread_once
+pthread_rwlockattr_destroy
+pthread_rwlockattr_init
+pthread_rwlock_destroy
+pthread_rwlock_init
+pthread_rwlock_rdlock
+pthread_rwlock_tryrdlock
+pthread_rwlock_trywrlock
+pthread_rwlock_unlock
+pthread_rwlock_wrlock
+pthread_self
+pthread_setaffinity_np
+pthread_setcancelstate
+pthread_setcanceltype
+pthread_setname_np
+pthread_setschedparam
+pthread_setspecific
+pthread_sigmask
+pthread_spin_destroy
+pthread_spin_init
+pthread_spin_lock
+pthread_spin_trylock
+pthread_spin_unlock
+pthread_testcancel
+putc
+putchar
+putchar_unlocked
+putc_unlocked
+putenv
+puts
+putw
+putwc
+putwchar
+putwchar_unlocked
+putwc_unlocked
+pwrite
+pwrite64
+pwritev
+pwritev64
+qsort
+raise
+rand
+random
+rand_r
+read
+readdir
+readdir64
+readdir64_r
+readdir_r
+readlink
+readlinkat
+readv
+realloc
+realpath
+reboot
+recv
+recvfrom
+recvmsg
+regcomp
+regerror
+regexec
+regfree
+remainder
+remainderf
+remainderl
+remove
+remquo
+remquof
+remquol
+rename
+res_init
+res_mkquery
+rewind
+rewinddir
+rindex
+rint
+rintf
+rintl
+rmdir
+round
+roundf
+roundl
+sbrk
+scalb
+scalbf
+scalbln
+scalblnf
+scalblnl
+scalbn
+scalbnf
+scalbnl
+scandir
+scandir64
+scanf
+__sched_cpucount
+sched_getaffinity
+sched_getcpu
+sched_get_priority_max
+sched_get_priority_min
+sched_setaffinity
+sched_yield
+secure_getenv
+seed48
+seekdir
+select
+sem_destroy
+sem_init
+sem_post
+sem_timedwait
+sem_trywait
+sem_wait
+send
+sendfile
+sendfile64
+sendmsg
+sendto
+setbuf
+setbuffer
+setegid
+setenv
+seteuid
+setgid
+setgrent
+setgroups
+sethostname
+setitimer
+__setjmp
+_setjmp
+setjmp
+setkey
+setlinebuf
+setlocale
+setmntent
+setpgid
+setpgrp
+setpriority
+setprotoent
+setpwent
+setregid
+setresgid
+setresuid
+setreuid
+setrlimit
+setrlimit64
+setsid
+setsockopt
+setstate
+setuid
+setvbuf
+shmat
+shmctl
+shmdt
+shmget
+shutdown
+sigaction
+sigaddset
+sigaltstack
+sigdelset
+sigemptyset
+sigfillset
+sigignore
+siginterrupt
+sigismember
+siglongjmp
+signal
+signalfd
+__signbit
+__signbitf
+__signbitl
+__signgam
+signgam
+significand
+significandf
+sigprocmask
+__sigsetjmp
+sigsetjmp
+sigsuspend
+sigwait
+sigwaitinfo
+sin
+sincos
+sincosf
+sinf
+sinh
+sinhf
+sinhl
+sinl
+sleep
+snprintf
+socket
+socketpair
+sprintf
+sqrt
+sqrtf
+sqrtl
+srand
+srand48
+srandom
+sscanf
+__stack_chk_fail
+__stack_chk_guard
+stat
+stat64
+statfs
+statfs64
+statvfs
+statvfs64
+stderr
+stdin
+stdout
+stpcpy
+stpncpy
+strcasecmp
+__strcasecmp_l
+strcasecmp_l
+strcasestr
+strcat
+strchr
+strchrnul
+strcmp
+strcoll
+__strcoll_l
+strcoll_l
+strcpy
+strcspn
+strdup
+strerror
+__strerror_l
+strerror_l
+strerror_r
+strfmon
+strfmon_l
+strftime
+strftime_l
+strlcat
+strlcpy
+strlen
+strncasecmp
+__strncasecmp_l
+strncasecmp_l
+strncat
+strncmp
+strncpy
+strndup
+strnlen
+strpbrk
+strptime
+strrchr
+strsep
+strsignal
+strspn
+strstr
+strtod
+__strtod_l
+strtod_l
+strtof
+__strtof_l
+strtof_l
+strtoimax
+__strtoimax_internal
+strtok
+strtok_r
+strtol
+strtold
+__strtold_l
+strtold_l
+__strtol_internal
+strtoll
+__strtoll_internal
+strtoul
+__strtoul_internal
+strtoull
+__strtoull_internal
+strtoumax
+__strtoumax_internal
+strverscmp
+strxfrm
+__strxfrm_l
+strxfrm_l
+swab
+swprintf
+swscanf
+symlink
+sync
+syscall
+sysconf
+sysinfo
+system
+__sysv_signal
+tan
+tanf
+tanh
+tanhf
+tanhl
+tanl
+tcdrain
+tcflow
+tcflush
+tcgetattr
+tcgetpgrp
+tcsendbreak
+tcsetattr
+tcsetpgrp
+telldir
+tempnam
+textdomain
+tgamma
+tgammaf
+tgammal
+time
+timegm
+timerfd_create
+timerfd_gettime
+timerfd_settime
+times
+__timezone
+timezone
+__tls_get_addr
+tmpfile
+tmpfile64
+tmpnam
+toascii
+tolower
+__tolower_l
+tolower_l
+toupper
+__toupper_l
+toupper_l
+towctrans
+__towctrans_l
+towctrans_l
+towlower
+__towlower_l
+towlower_l
+towupper
+__towupper_l
+towupper_l
+trunc
+truncate
+truncate64
+truncf
+truncl
+ttyname
+ttyname_r
+__tzname
+tzname
+tzset
+__uflow
+umask
+umount
+umount2
+uname
+ungetc
+ungetwc
+unlink
+unlinkat
+unsetenv
+__uselocale
+uselocale
+usleep
+utime
+utimensat
+utimes
+vasprintf
+vdprintf
+vfork
+vfprintf
+vfscanf
+vfwprintf
+vfwscanf
+vprintf
+vscanf
+vsnprintf
+vsprintf
+vsscanf
+vswprintf
+vswscanf
+vwprintf
+vwscanf
+wait
+wait3
+wait4
+waitpid
+wcpcpy
+wcpncpy
+wcrtomb
+wcscasecmp
+wcscasecmp_l
+wcscat
+wcschr
+wcscmp
+wcscoll
+__wcscoll_l
+wcscoll_l
+wcscpy
+wcscspn
+wcsdup
+wcsftime
+__wcsftime_l
+wcsftime_l
+wcslen
+wcsncasecmp
+wcsncasecmp_l
+wcsncat
+wcsncmp
+wcsncpy
+wcsnlen
+wcsnrtombs
+wcspbrk
+wcsrchr
+wcsrtombs
+wcsspn
+wcsstr
+wcstoimax
+wcstok
+wcstol
+wcstoll
+wcstombs
+wcstoul
+wcstoull
+wcstoumax
+wcswcs
+wcswidth
+wcsxfrm
+__wcsxfrm_l
+wcsxfrm_l
+wctob
+wctomb
+wctrans
+__wctrans_l
+wctrans_l
+wctype
+__wctype_l
+wctype_l
+wcwidth
+wmemchr
+wmemcmp
+wmemcpy
+wmemmove
+wmemset
+wprintf
+write
+writev
+wscanf
+__xmknod
+__xpg_basename
+__xpg_strerror_r
+__xstat
+__xstat64
+y0
+y0f
+y1
+y1f
+yn
+ynf
diff --git a/exported_symbols/x64/osv_libaio.so.1.symbols b/exported_symbols/x64/osv_libaio.so.1.symbols
new file mode 100644
index 00000000..2b684e1d
--- /dev/null
+++ b/exported_symbols/x64/osv_libaio.so.1.symbols
@@ -0,0 +1,5 @@
+io_cancel
+io_destroy
+io_getevents
+io_setup
+io_submit
diff --git a/exported_symbols/x64/osv_libc.so.6.symbols b/exported_symbols/x64/osv_libc.so.6.symbols
new file mode 100644
index 00000000..6635cabb
--- /dev/null
+++ b/exported_symbols/x64/osv_libc.so.6.symbols
@@ -0,0 +1,1053 @@
+a64l
+abort
+abs
+accept
+accept4
+access
+addmntent
+__after_morecore_hook
+alarm
+aligned_alloc
+alphasort
+alphasort64
+asctime
+asctime_r
+asprintf
+__asprintf_chk
+__assert_fail
+atof
+atoi
+atol
+atoll
+backtrace
+backtrace_symbols
+backtrace_symbols_fd
+basename
+bcmp
+bcopy
+bind
+bindtextdomain
+bind_textdomain_codeset
+brk
+bsearch
+btowc
+bzero
+calloc
+catclose
+catgets
+catopen
+cfgetispeed
+cfgetospeed
+cfmakeraw
+cfsetispeed
+cfsetospeed
+cfsetspeed
+chdir
+chmod
+chown
+chroot
+clearenv
+clearerr
+clearerr_unlocked
+clock
+clock_getcpuclockid
+clock_getres
+clock_gettime
+close
+closedir
+closelog
+confstr
+connect
+copysign
+copysignf
+copysignl
+creat
+creat64
+ctermid
+ctime
+ctime_r
+__ctype_b_loc
+__ctype_get_mb_cur_max
+__ctype_tolower_loc
+__ctype_toupper_loc
+cuserid
+__cxa_atexit
+__cxa_thread_atexit_impl
+__cyg_profile_func_enter
+__cyg_profile_func_exit
+daemon
+__daylight
+daylight
+dcgettext
+dcngettext
+dgettext
+difftime
+dirfd
+dirname
+div
+dl_iterate_phdr
+dngettext
+dprintf
+drand48
+dup
+dup2
+dup3
+__duplocale
+duplocale
+eaccess
+ecvt
+endgrent
+endmntent
+endprotoent
+endpwent
+__environ
+_environ
+environ
+epoll_create
+epoll_create1
+epoll_ctl
+epoll_pwait
+epoll_wait
+erand48
+__errno_location
+error
+euidaccess
+eventfd
+eventfd_read
+eventfd_write
+execl
+execle
+execv
+execve
+execvp
+_exit
+exit
+_Exit
+explicit_bzero
+__explicit_bzero_chk
+faccessat
+fallocate
+fallocate64
+__fbufsize
+fchdir
+fchmod
+fchmodat
+fchown
+fclose
+fcntl
+fcntl64
+fcvt
+fdatasync
+__fdelt_chk
+fdopen
+fdopendir
+feof
+feof_unlocked
+ferror
+ferror_unlocked
+fflush
+fflush_unlocked
+ffs
+ffsl
+ffsll
+fgetc
+fgetc_unlocked
+fgetpos
+fgetpos64
+fgets
+fgets_unlocked
+fgetwc
+fgetwc_unlocked
+fgetws
+fgetws_unlocked
+fileno
+fileno_unlocked
+__finite
+finite
+__finitef
+finitef
+__finitel
+finitel
+__flbf
+flock
+flockfile
+_flushlbf
+fmemopen
+fnmatch
+fopen
+fopen64
+fork
+fpathconf
+__fpending
+fprintf
+__fprintf_chk
+__fpurge
+fputc
+fputc_unlocked
+fputs
+fputs_unlocked
+fputwc
+fputwc_unlocked
+fputws
+fputws_unlocked
+fread
+__freadable
+__fread_chk
+__freading
+fread_unlocked
+free
+freeaddrinfo
+__free_hook
+freeifaddrs
+__freelocale
+freelocale
+freopen
+freopen64
+frexp
+frexpf
+frexpl
+fscanf
+fseek
+fseeko
+fseeko64
+__fsetlocking
+fsetpos
+fsetpos64
+fstatfs
+fstatfs64
+fstatvfs
+fstatvfs64
+fsync
+ftell
+ftello
+ftello64
+ftime
+ftruncate
+ftruncate64
+ftrylockfile
+funlockfile
+futimens
+futimes
+futimesat
+fwide
+fwprintf
+__fwritable
+fwrite
+fwrite_unlocked
+__fwriting
+fwscanf
+__fxstat
+__fxstat64
+__fxstatat
+__fxstatat64
+gai_strerror
+gcvt
+getaddrinfo
+__getauxval
+getauxval
+getc
+getchar
+getchar_unlocked
+getcontext
+getc_unlocked
+get_current_dir_name
+getcwd
+getdate
+getdate_err
+__getdelim
+getdelim
+getdtablesize
+getegid
+getenv
+geteuid
+getgid
+getgrent
+getgrgid
+getgrgid_r
+getgrnam
+getgrnam_r
+getgroups
+gethostbyaddr
+gethostbyaddr_r
+gethostbyname
+gethostbyname2_r
+gethostbyname_r
+gethostid
+gethostname
+getifaddrs
+getitimer
+getline
+getloadavg
+getlogin
+getlogin_r
+getmntent
+getmntent_r
+getnameinfo
+get_nprocs
+getopt
+getopt_long
+getopt_long_only
+__getpagesize
+getpagesize
+getpeername
+getpgid
+getpgrp
+getpid
+getppid
+getpriority
+getprotobyname
+getprotobynumber
+getprotoent
+getpwent
+getpwnam
+getpwnam_r
+getpwuid
+getpwuid_r
+getrandom
+getresgid
+getresuid
+getrlimit
+getrlimit64
+getrusage
+gets
+getservbyname
+getservbyname_r
+getservbyport
+getservbyport_r
+getsid
+getsockname
+getsockopt
+getsubopt
+gettext
+gettid
+gettimeofday
+getuid
+getw
+getwc
+getwchar
+getwchar_unlocked
+getwc_unlocked
+glob
+glob64
+globfree
+globfree64
+gmtime
+__gmtime_r
+gmtime_r
+gnu_dev_major
+gnu_dev_makedev
+gnu_dev_minor
+gnu_get_libc_release
+gnu_get_libc_version
+hasmntopt
+__h_errno_location
+htonl
+htons
+iconv
+iconv_close
+iconv_open
+if_freenameindex
+if_indextoname
+if_nameindex
+if_nametoindex
+imaxabs
+imaxdiv
+in6addr_any
+in6addr_loopback
+index
+inet_addr
+inet_aton
+inet_ntoa
+inet_ntop
+inet_pton
+initgroups
+initstate
+initstate_r
+inotify_add_watch
+inotify_init
+inotify_init1
+inotify_rm_watch
+ioctl
+_IO_getc
+_IO_putc
+isalnum
+__isalnum_l
+isalnum_l
+isalpha
+__isalpha_l
+isalpha_l
+isascii
+isatty
+isblank
+__isblank_l
+isblank_l
+iscntrl
+__iscntrl_l
+iscntrl_l
+isdigit
+__isdigit_l
+isdigit_l
+isgraph
+__isgraph_l
+isgraph_l
+__isinf
+__isinff
+__isinfl
+islower
+__islower_l
+islower_l
+__isnan
+__isnanf
+__isnanl
+__isoc99_fscanf
+__isoc99_fwscanf
+__isoc99_scanf
+__isoc99_sscanf
+__isoc99_swscanf
+__isoc99_vfscanf
+__isoc99_vfwscanf
+__isoc99_vscanf
+__isoc99_vsscanf
+__isoc99_vswscanf
+__isoc99_vwscanf
+__isoc99_wscanf
+isprint
+__isprint_l
+isprint_l
+ispunct
+__ispunct_l
+ispunct_l
+isspace
+__isspace_l
+isspace_l
+isupper
+__isupper_l
+isupper_l
+iswalnum
+__iswalnum_l
+iswalnum_l
+iswalpha
+__iswalpha_l
+iswalpha_l
+iswblank
+__iswblank_l
+iswblank_l
+iswcntrl
+__iswcntrl_l
+iswcntrl_l
+iswctype
+__iswctype_l
+iswctype_l
+iswdigit
+__iswdigit_l
+iswdigit_l
+iswgraph
+__iswgraph_l
+iswgraph_l
+iswlower
+__iswlower_l
+iswlower_l
+iswprint
+__iswprint_l
+iswprint_l
+iswpunct
+__iswpunct_l
+iswpunct_l
+iswspace
+__iswspace_l
+iswspace_l
+iswupper
+__iswupper_l
+iswupper_l
+iswxdigit
+__iswxdigit_l
+iswxdigit_l
+isxdigit
+__isxdigit_l
+isxdigit_l
+jrand48
+kill
+killpg
+l64a
+labs
+lchown
+lcong48
+ldexp
+ldexpf
+ldexpl
+ldiv
+__libc_current_sigrtmax
+__libc_current_sigrtmin
+__libc_single_threaded
+__libc_start_main
+link
+listen
+llabs
+lldiv
+localeconv
+localtime
+localtime_r
+lockf
+lockf64
+_longjmp
+longjmp
+__longjmp_chk
+lrand48
+lseek
+lseek64
+lutimes
+__lxstat
+__lxstat64
+madvise
+makecontext
+malloc
+__malloc_hook
+malloc_usable_size
+mallopt
+mblen
+__mbrlen
+mbrlen
+mbrtowc
+mbsinit
+mbsnrtowcs
+mbsrtowcs
+mbstowcs
+mbtowc
+memalign
+__memalign_hook
+memccpy
+memchr
+memcmp
+memcpy
+__memcpy_chk
+memmem
+memmove
+__memmove_chk
+mempcpy
+memrchr
+memset
+__memset_chk
+mincore
+mkdir
+mkdirat
+mkdtemp
+mkfifo
+mkfifoat
+mkostemp
+mkostemp64
+mkostemps
+mkostemps64
+mkstemp
+mkstemp64
+mktemp
+mktime
+mlock
+mlockall
+mmap
+mmap64
+modf
+modff
+modfl
+mount
+mprotect
+mrand48
+msync
+munlock
+munlockall
+munmap
+nanosleep
+__newlocale
+newlocale
+nftw
+nftw64
+ngettext
+nice
+nl_langinfo
+__nl_langinfo_l
+nl_langinfo_l
+nrand48
+ntohl
+ntohs
+open
+__open_2
+open64
+__open64_2
+openat
+openat64
+opendir
+openlog
+open_memstream
+open_wmemstream
+optarg
+opterr
+optind
+optopt
+__overflow
+pathconf
+pause
+pclose
+perror
+pipe
+pipe2
+poll
+__poll_chk
+popen
+posix_fadvise
+posix_fadvise64
+posix_fallocate
+posix_fallocate64
+__posix_getopt
+posix_memalign
+ppoll
+prctl
+pread
+pread64
+__pread64_chk
+preadv
+preadv64
+printf
+__printf_chk
+__progname
+__progname_full
+program_invocation_name
+program_invocation_short_name
+pselect
+pthread_attr_destroy
+pthread_attr_getdetachstate
+pthread_attr_getscope
+pthread_attr_init
+pthread_attr_setaffinity_np
+pthread_attr_setdetachstate
+pthread_attr_setinheritsched
+pthread_attr_setscope
+pthread_condattr_destroy
+pthread_condattr_init
+pthread_cond_broadcast
+pthread_cond_destroy
+pthread_cond_init
+pthread_cond_signal
+pthread_cond_timedwait
+pthread_cond_wait
+pthread_equal
+pthread_exit
+pthread_getaffinity_np
+pthread_getattr_np
+pthread_getschedparam
+pthread_mutex_destroy
+pthread_mutex_init
+pthread_mutex_lock
+pthread_mutex_unlock
+pthread_self
+pthread_setcancelstate
+pthread_setcanceltype
+pthread_setschedparam
+pthread_sigmask
+putc
+putchar
+putchar_unlocked
+putc_unlocked
+putenv
+puts
+putw
+putwc
+putwchar
+putwchar_unlocked
+putwc_unlocked
+pwrite
+pwrite64
+pwritev
+pwritev64
+qsort
+qsort_r
+raise
+rand
+random
+random_r
+rand_r
+__rawmemchr
+rawmemchr
+read
+__read_chk
+readdir
+readdir64
+readdir64_r
+readdir_r
+readlink
+readlinkat
+readv
+realloc
+reallocarray
+__realloc_hook
+realpath
+__realpath_chk
+reboot
+recv
+recvfrom
+recvmsg
+regcomp
+regerror
+regexec
+regfree
+__register_atfork
+register_printf_modifier
+register_printf_specifier
+register_printf_type
+remove
+rename
+__res_init
+rewind
+rewinddir
+rindex
+rmdir
+sbrk
+scalbn
+scalbnf
+scalbnl
+scandir
+scandir64
+scanf
+__sched_cpualloc
+__sched_cpucount
+__sched_cpufree
+sched_getaffinity
+sched_getcpu
+sched_get_priority_max
+sched_get_priority_min
+sched_setaffinity
+sched_yield
+secure_getenv
+seed48
+seekdir
+select
+send
+sendfile
+sendfile64
+sendmsg
+sendto
+setbuf
+setbuffer
+setcontext
+setegid
+setenv
+seteuid
+setgid
+setgrent
+setgroups
+sethostid
+sethostname
+setitimer
+_setjmp
+setjmp
+setlinebuf
+setlocale
+setmntent
+setpgid
+setpgrp
+setpriority
+setprotoent
+setpwent
+setregid
+setresgid
+setresuid
+setreuid
+setrlimit
+setrlimit64
+setsid
+setsockopt
+setstate
+setstate_r
+setuid
+setvbuf
+shmat
+shmctl
+shmdt
+shmget
+shutdown
+sigaction
+sigaddset
+sigaltstack
+sigdelset
+sigemptyset
+sigfillset
+sigignore
+siginterrupt
+sigismember
+siglongjmp
+signal
+signalfd
+__signbit
+__signbitf
+__signbitl
+sigprocmask
+__sigsetjmp
+sigsuspend
+sigwait
+sigwaitinfo
+sleep
+snprintf
+__snprintf_chk
+socket
+socketpair
+sprintf
+__sprintf_chk
+srand
+srand48
+srandom
+srandom_r
+sscanf
+__stack_chk_fail
+__statfs
+statfs
+statfs64
+statvfs
+statvfs64
+statx
+stderr
+stdin
+stdout
+__stpcpy
+stpcpy
+__stpcpy_chk
+__stpncpy
+stpncpy
+strcasecmp
+__strcasecmp_l
+strcasecmp_l
+strcasestr
+strcat
+__strcat_chk
+strchr
+strchrnul
+strcmp
+strcoll
+__strcoll_l
+strcoll_l
+strcpy
+__strcpy_chk
+strcspn
+__strdup
+strdup
+strerror
+strerrordesc_np
+strerror_l
+strerror_r
+strfmon
+strfmon_l
+strftime
+__strftime_l
+strftime_l
+strlen
+strncasecmp
+__strncasecmp_l
+strncasecmp_l
+strncat
+__strncat_chk
+strncmp
+strncpy
+__strncpy_chk
+__strndup
+strndup
+strnlen
+strpbrk
+strptime
+strrchr
+strsep
+strsignal
+strspn
+strstr
+strtod
+__strtod_l
+strtod_l
+strtof
+__strtof_l
+strtof_l
+strtoimax
+strtok
+__strtok_r
+strtok_r
+strtol
+strtold
+__strtold_l
+strtold_l
+__strtol_internal
+strtoll
+__strtoll_internal
+strtoul
+__strtoul_internal
+strtoull
+__strtoull_internal
+strtoumax
+strverscmp
+strxfrm
+__strxfrm_l
+strxfrm_l
+swab
+swapcontext
+swprintf
+__swprintf_chk
+swscanf
+symlink
+sync
+syscall
+sysconf
+sysctl
+sys_errlist
+sysinfo
+__syslog_chk
+sys_nerr
+system
+__sysv_signal
+tcdrain
+tcflow
+tcflush
+tcgetattr
+tcgetpgrp
+tcsendbreak
+tcsetattr
+tcsetpgrp
+telldir
+tempnam
+textdomain
+time
+timegm
+timerfd_create
+timerfd_gettime
+timerfd_settime
+times
+__timezone
+timezone
+tmpfile
+tmpfile64
+tmpnam
+tmpnam_r
+toascii
+tolower
+__tolower_l
+tolower_l
+toupper
+__toupper_l
+toupper_l
+towctrans
+__towctrans_l
+towctrans_l
+towlower
+__towlower_l
+towlower_l
+towupper
+__towupper_l
+towupper_l
+truncate
+truncate64
+ttyname
+ttyname_r
+__tzname
+tzname
+tzset
+__uflow
+umask
+umount
+umount2
+uname
+ungetc
+ungetwc
+unlink
+unlinkat
+unsetenv
+__uselocale
+uselocale
+usleep
+utime
+utimensat
+utimes
+vasprintf
+__vasprintf_chk
+vdprintf
+vfork
+vfprintf
+__vfprintf_chk
+vfscanf
+vfwprintf
+vfwscanf
+vprintf
+__vprintf_chk
+vscanf
+vsnprintf
+__vsnprintf_chk
+vsprintf
+__vsprintf_chk
+vsscanf
+vswprintf
+vswscanf
+vwprintf
+vwscanf
+wait
+wait3
+wait4
+waitpid
+wcpcpy
+wcpncpy
+wcrtomb
+wcscasecmp
+wcscasecmp_l
+wcscat
+wcschr
+wcscmp
+wcscoll
+__wcscoll_l
+wcscoll_l
+wcscpy
+__wcscpy_chk
+wcscspn
+wcsdup
+wcsftime
+__wcsftime_l
+wcsftime_l
+wcslen
+wcsncasecmp
+wcsncasecmp_l
+wcsncat
+wcsncmp
+wcsncpy
+wcsnlen
+wcsnrtombs
+wcspbrk
+wcsrchr
+wcsrtombs
+wcsspn
+wcsstr
+wcstoimax
+wcstok
+wcstol
+wcstoll
+wcstombs
+wcstoul
+wcstoull
+wcstoumax
+wcswcs
+wcswidth
+wcsxfrm
+__wcsxfrm_l
+wcsxfrm_l
+wctob
+wctomb
+wctrans
+__wctrans_l
+wctrans_l
+wctype
+__wctype_l
+wctype_l
+wcwidth
+wmemchr
+wmemcmp
+wmemcpy
+wmemmove
+wmemset
+wprintf
+write
+writev
+wscanf
+__xmknod
+__xpg_basename
+__xpg_strerror_r
+__xstat
+__xstat64
diff --git a/exported_symbols/x64/osv_libcrypt.so.1.symbols b/exported_symbols/x64/osv_libcrypt.so.1.symbols
new file mode 100644
index 00000000..2b64be6e
--- /dev/null
+++ b/exported_symbols/x64/osv_libcrypt.so.1.symbols
@@ -0,0 +1,4 @@
+crypt
+crypt_r
+encrypt
+setkey
diff --git a/exported_symbols/x64/osv_libdl.so.2.symbols b/exported_symbols/x64/osv_libdl.so.2.symbols
new file mode 100644
index 00000000..bc19fc0d
--- /dev/null
+++ b/exported_symbols/x64/osv_libdl.so.2.symbols
@@ -0,0 +1,6 @@
+dladdr
+dlclose
+dlerror
+dlopen
+dlsym
+dlvsym
diff --git a/exported_symbols/x64/osv_libm.so.6.symbols b/exported_symbols/x64/osv_libm.so.6.symbols
new file mode 100644
index 00000000..58bbdde3
--- /dev/null
+++ b/exported_symbols/x64/osv_libm.so.6.symbols
@@ -0,0 +1,226 @@
+acos
+acosf
+acosh
+acoshf
+acoshl
+acosl
+asin
+asinf
+asinh
+asinhf
+asinhl
+asinl
+atan
+atan2
+atan2f
+atan2l
+atanf
+atanh
+atanhf
+atanhl
+atanl
+cbrt
+cbrtf
+cbrtl
+ceil
+ceilf
+ceill
+copysign
+copysignf
+copysignl
+cos
+cosf
+cosh
+coshf
+coshl
+cosl
+drem
+dremf
+erf
+erfc
+erfcf
+erfcl
+erff
+erfl
+exp
+exp10
+exp10f
+exp10l
+exp2
+exp2f
+__exp2_finite
+exp2l
+expf
+__exp_finite
+expl
+expm1
+expm1f
+expm1l
+fabs
+fabsf
+fabsl
+fdim
+fdimf
+fdiml
+feclearexcept
+fedisableexcept
+feenableexcept
+fegetenv
+fegetexcept
+fegetexceptflag
+fegetround
+feholdexcept
+feraiseexcept
+fesetenv
+fesetexceptflag
+fesetround
+fetestexcept
+__finite
+finite
+__finitef
+finitef
+__finitel
+finitel
+floor
+floorf
+floorl
+fmax
+fmaxf
+fmaxl
+fmin
+fminf
+fminl
+fmod
+fmodf
+fmodl
+__fpclassify
+__fpclassifyf
+__fpclassifyl
+frexp
+frexpf
+frexpl
+hypot
+hypotf
+hypotl
+ilogb
+ilogbf
+ilogbl
+j0
+j0f
+j1
+j1f
+jn
+jnf
+ldexp
+ldexpf
+ldexpl
+lgamma
+lgammaf
+lgammaf_r
+lgammal
+lgammal_r
+lgamma_r
+llround
+llroundf
+llroundl
+log
+log10
+log10f
+__log10_finite
+log10l
+log1p
+log1pf
+log1pl
+log2
+log2f
+__log2f_finite
+__log2_finite
+log2l
+logb
+logbf
+logbl
+logf
+__log_finite
+logl
+lrint
+lround
+lroundf
+lroundl
+modf
+modff
+modfl
+nan
+nanf
+nanl
+nearbyint
+nearbyintf
+nearbyintl
+nextafter
+nextafterf
+nextafterl
+nexttoward
+nexttowardf
+nexttowardl
+pow
+pow10
+pow10f
+pow10l
+powf
+__pow_finite
+powl
+remainder
+remainderf
+remainderl
+remquo
+remquof
+remquol
+rint
+rintf
+rintl
+round
+roundf
+roundl
+scalb
+scalbf
+scalbln
+scalblnf
+scalblnl
+scalbn
+scalbnf
+scalbnl
+__signbit
+__signbitf
+__signbitl
+__signgam
+signgam
+significand
+significandf
+sin
+sincos
+sincosf
+sinf
+sinh
+sinhf
+sinhl
+sinl
+sqrt
+sqrtf
+sqrtl
+tan
+tanf
+tanh
+tanhf
+tanhl
+tanl
+tgamma
+tgammaf
+tgammal
+trunc
+truncf
+truncl
+y0
+y0f
+y1
+y1f
+yn
+ynf
diff --git a/exported_symbols/x64/osv_libpthread.so.0.symbols b/exported_symbols/x64/osv_libpthread.so.0.symbols
new file mode 100644
index 00000000..049c5241
--- /dev/null
+++ b/exported_symbols/x64/osv_libpthread.so.0.symbols
@@ -0,0 +1,112 @@
+accept
+close
+connect
+__errno_location
+fcntl
+flockfile
+fork
+fsync
+ftrylockfile
+funlockfile
+__h_errno_location
+__libc_current_sigrtmax
+__libc_current_sigrtmin
+longjmp
+lseek
+lseek64
+msync
+open
+open64
+pause
+pread
+pread64
+pthread_atfork
+pthread_attr_getaffinity_np
+pthread_attr_getguardsize
+pthread_attr_getstack
+pthread_attr_getstacksize
+pthread_attr_setguardsize
+pthread_attr_setstack
+pthread_attr_setstacksize
+pthread_barrier_destroy
+pthread_barrier_init
+pthread_barrier_wait
+pthread_cancel
+_pthread_cleanup_pop
+_pthread_cleanup_push
+pthread_condattr_getclock
+pthread_condattr_getpshared
+pthread_condattr_setclock
+pthread_condattr_setpshared
+pthread_cond_broadcast
+pthread_cond_clockwait
+pthread_cond_signal
+pthread_cond_timedwait
+pthread_cond_wait
+pthread_create
+pthread_detach
+pthread_exit
+pthread_getcpuclockid
+pthread_getname_np
+pthread_getspecific
+pthread_join
+__pthread_key_create
+pthread_key_create
+pthread_key_delete
+pthread_kill
+pthread_mutexattr_destroy
+pthread_mutexattr_gettype
+pthread_mutexattr_init
+pthread_mutexattr_setpshared
+pthread_mutexattr_settype
+pthread_mutex_clocklock
+pthread_mutex_destroy
+pthread_mutex_init
+pthread_mutex_lock
+pthread_mutex_timedlock
+pthread_mutex_trylock
+pthread_mutex_unlock
+pthread_once
+pthread_rwlockattr_destroy
+pthread_rwlockattr_init
+pthread_rwlock_destroy
+pthread_rwlock_init
+pthread_rwlock_rdlock
+pthread_rwlock_tryrdlock
+pthread_rwlock_trywrlock
+pthread_rwlock_unlock
+pthread_rwlock_wrlock
+pthread_setaffinity_np
+pthread_setcancelstate
+pthread_setcanceltype
+pthread_setname_np
+pthread_setspecific
+pthread_spin_destroy
+pthread_spin_init
+pthread_spin_lock
+pthread_spin_trylock
+pthread_spin_unlock
+pthread_testcancel
+pthread_yield
+pwrite
+pwrite64
+raise
+read
+recv
+recvfrom
+recvmsg
+sem_destroy
+sem_init
+sem_post
+sem_timedwait
+sem_trywait
+sem_wait
+send
+sendmsg
+sendto
+sigaction
+siglongjmp
+sigwait
+system
+tcdrain
+write
diff --git a/exported_symbols/x64/osv_libresolv.so.2.symbols b/exported_symbols/x64/osv_libresolv.so.2.symbols
new file mode 100644
index 00000000..e69de29b
diff --git a/exported_symbols/x64/osv_librt.so.1.symbols b/exported_symbols/x64/osv_librt.so.1.symbols
new file mode 100644
index 00000000..e69de29b
diff --git a/exported_symbols/x64/osv_libutil.so.symbols b/exported_symbols/x64/osv_libutil.so.symbols
new file mode 100644
index 00000000..89d7bc13
--- /dev/null
+++ b/exported_symbols/x64/osv_libutil.so.symbols
@@ -0,0 +1,2 @@
+forkpty
+openpty
diff --git a/exported_symbols/x64/osv_libxenstore.so.3.0.symbols b/exported_symbols/x64/osv_libxenstore.so.3.0.symbols
new file mode 100644
index 00000000..d393f942
--- /dev/null
+++ b/exported_symbols/x64/osv_libxenstore.so.3.0.symbols
@@ -0,0 +1,8 @@
+xs_close
+xs_daemon_open
+xs_directory
+xs_read
+xs_rm
+xs_transaction_end
+xs_transaction_start
+xs_write
--
2.31.1

Waldemar Kozaczuk

unread,
Dec 5, 2021, 5:29:15 PM12/5/21
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch adds new script that generates version script
based on the symbol files from exported_symbols/<arch>/*.symbols

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
scripts/generate_version_script.sh | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100755 scripts/generate_version_script.sh

diff --git a/scripts/generate_version_script.sh b/scripts/generate_version_script.sh
new file mode 100755
index 00000000..4d69def2
--- /dev/null
+++ b/scripts/generate_version_script.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+VERSION_SCRIPT_FILE=$1
+
+VERSION_SCRIPT_START=$(cat <<"EOF"
+{
+ global:
+EOF
+)
+
+VERSION_SCRIPT_END=$(cat <<"EOF"
+ local:
+ *;
+};
+EOF
+)
+
+echo "$VERSION_SCRIPT_START" > $VERSION_SCRIPT_FILE
+
+for file in exported_symbols/x64/*.symbols
+do
+ file_name=$(basename $file)
+ echo "/*------- $file_name */" >> $VERSION_SCRIPT_FILE
+ cat $file | awk '// { printf(" %s;\n", $0) }' >> $VERSION_SCRIPT_FILE
+done
+
+echo "$VERSION_SCRIPT_END" >> $VERSION_SCRIPT_FILE
--
2.31.1

Waldemar Kozaczuk

unread,
Dec 5, 2021, 5:29:16 PM12/5/21
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch changes the main makefile to enable garbage collection of
code and data when linking kernel with most symbols hidden.

In essence it makes all object files compile with '-ffunction-sections
-fdata-sections' flags only when conf_hide_symbols is ON. This allows
linker to eliminate code and data (with --gc-sections) that is not
really used between various compilation units. As the result it allows
us to produce even smaller kernel ELF at around 4.3M, down from 5.1M
when we would hide symbols only. In order to see what exact code and
data gets eliminated, one can pass --print-gc-sections flags to the
linker like so:

./scripts/build image=native-example fs=rofs conf_hide_symbols=1 conf_linker_extra_options=--print-gc-sections

In addition this patch also changes the makefile to make linker use
version script generated by ./scripts/generate_version_script.sh which
is obnly enabled when conf_hide_symbols is ON. Using version script
(--version-script) plays some role in futher reducing number of symbols
down to what exactly we want to export in exported/<arch>/*symbols.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
Makefile | 19 +++++++++++++------
conf/base.mk | 1 +
2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index a5e45674..7acf130c 100644
--- a/Makefile
+++ b/Makefile
@@ -284,7 +284,7 @@ $(out)/libc/%.o: cc-hide-flags =
$(out)/libc/%.o: cxx-hide-flags =
$(out)/musl/%.o: cc-hide-flags =

-kernel-defines = -D_KERNEL $(source-dialects) $(cc-hide-flags)
+kernel-defines = -D_KERNEL $(source-dialects) $(cc-hide-flags) $(gc-flags)

# This play the same role as "_KERNEL", but _KERNEL unfortunately is too
# overloaded. A lot of files will expect it to be set no matter what, specially
@@ -323,6 +323,10 @@ cxx-hide-flags-0 =
cxx-hide-flags-1 = -fvisibility-inlines-hidden
cxx-hide-flags = $(cxx-hide-flags-$(conf_hide_symbols))

+gc-flags-0 =
+gc-flags-1 = -ffunction-sections -fdata-sections
+gc-flags = $(gc-flags-$(conf_hide_symbols))
+
gcc-opt-Og := $(call compiler-flag, -Og, -Og, compiler/empty.cc)

CXXFLAGS = -std=gnu++11 $(COMMON) $(cxx-hide-flags)
@@ -1944,7 +1948,7 @@ $(out)/dummy-shlib.so: $(out)/dummy-shlib.o
$(call quiet, $(CXX) -nodefaultlibs -shared $(gcc-sysroot) -o $@ $^, LINK $@)

stage1_targets = $(out)/arch/$(arch)/boot.o $(out)/loader.o $(out)/runtime.o $(drivers:%=$(out)/%) $(objects:%=$(out)/%) $(out)/dummy-shlib.so
-stage1: $(stage1_targets) links
+stage1: $(stage1_targets) links $(out)/version_script
.PHONY: stage1

loader_options_dep = $(out)/arch/$(arch)/loader_options.ld
@@ -1955,17 +1959,21 @@ $(loader_options_dep): stage1
fi

ifeq ($(conf_hide_symbols),1)
-linker_archives_options = --no-whole-archive $(libstdc++.a) $(libgcc.a) $(libgcc_eh.a) $(boost-libs) --exclude-libs libstdc++.a
+linker_archives_options = --no-whole-archive $(libstdc++.a) $(libgcc.a) $(libgcc_eh.a) $(boost-libs) \
+ --exclude-libs libstdc++.a --gc-sections --version-script=$(out)/version_script
else
linker_archives_options = --whole-archive $(libstdc++.a) $(libgcc_eh.a) $(boost-libs) --no-whole-archive $(libgcc.a)
endif

+$(out)/version_script: exported_symbols/$(arch)/*.symbols
+ $(call quiet, scripts/generate_version_script.sh $(out)/version_script, GEN version_script)
+
$(out)/loader.elf: $(stage1_targets) arch/$(arch)/loader.ld $(out)/bootfs.o $(loader_options_dep)
$(call quiet, $(LD) -o $@ --defsym=OSV_KERNEL_BASE=$(kernel_base) \
--defsym=OSV_KERNEL_VM_BASE=$(kernel_vm_base) --defsym=OSV_KERNEL_VM_SHIFT=$(kernel_vm_shift) \
-Bdynamic --export-dynamic --eh-frame-hdr --enable-new-dtags -L$(out)/arch/$(arch) \
$(^:%.ld=-T %.ld) \
- $(linker_archives_options), \
+ $(linker_archives_options) $(conf_linker_extra_options), \
LINK loader.elf)
@# Build libosv.so matching this loader.elf. This is not a separate
@# rule because that caused bug #545.
@@ -1978,10 +1986,9 @@ $(out)/kernel.elf: $(stage1_targets) arch/$(arch)/loader.ld $(out)/empty_bootfs.
--defsym=OSV_KERNEL_VM_BASE=$(kernel_vm_base) --defsym=OSV_KERNEL_VM_SHIFT=$(kernel_vm_shift) \
-Bdynamic --export-dynamic --eh-frame-hdr --enable-new-dtags -L$(out)/arch/$(arch) \
$(^:%.ld=-T %.ld) \
- $(linker_archives_options), \
+ $(linker_archives_options) $(conf_linker_extra_options), \
LINK kernel.elf)
$(call quiet, $(STRIP) $(out)/kernel.elf -o $(out)/kernel-stripped.elf, STRIP kernel.elf -> kernel-stripped.elf )
- $(call very-quiet, cp $(out)/kernel-stripped.elf $(out)/kernel.elf)

$(out)/bsd/%.o: COMMON += -DSMP -D'__FBSDID(__str__)=extern int __bogus__'

diff --git a/conf/base.mk b/conf/base.mk
index d2f87003..b4415a74 100644
--- a/conf/base.mk
+++ b/conf/base.mk
@@ -12,3 +12,4 @@ conf-DEBUG_BUILD=0

conf-debug_elf=0
conf_hide_symbols=0
+conf_linker_extra_options=
--
2.31.1

Waldemar Kozaczuk

unread,
Dec 6, 2021, 2:24:47 PM12/6/21
to osv...@googlegroups.com, Waldemar Kozaczuk
This patch adds new script that generates version script
based on the symbol files from exported_symbols/<arch>/*.symbols

Comparing to the 1st version, this one will work when building both
x64 and aarch64 versions of kernel.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
scripts/generate_version_script.sh | 34 ++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100755 scripts/generate_version_script.sh

diff --git a/scripts/generate_version_script.sh b/scripts/generate_version_script.sh
new file mode 100755
index 00000000..80223372
--- /dev/null
+++ b/scripts/generate_version_script.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+MACHINE=$(uname -m)
+if [ "${MACHINE}" == "x86_64" ]; then
+ ARCH="x64"
+else
+ ARCH="aarch64"
+fi
+
+VERSION_SCRIPT_FILE=$1
+
+VERSION_SCRIPT_START=$(cat <<"EOF"
+{
+ global:
+EOF
+)
+
+VERSION_SCRIPT_END=$(cat <<"EOF"
+ local:
+ *;
+};
+EOF
+)
+
+echo "$VERSION_SCRIPT_START" > $VERSION_SCRIPT_FILE
+
+for file in exported_symbols/$MACHINE/*.symbols

Commit Bot

unread,
Dec 12, 2021, 10:53:57 PM12/12/21
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

linker: enforce some sections kept when garbage collection on

This patch changes the x64 linker script to keep some sections
when garbage collection (--gc-sections) is on when linking the kernel.

This mostly involves adding KEEP directives to specify number of extra
entry points - start32_address, start32_from_vmlinuz_address - so that
linker treats them as extra code roots and does not eliminate relevant code
from the resulting elf file.

Similarly we also add KEEP to .memcpy_decode, .fixup, .eh_frame*,
.tracepoint_patch_sites* and .init* sections to make them retained
when linking with garbage collection on.

This changes to not have any effect on the linker result when garbage
collection is off - the default.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/arch/x64/loader.ld b/arch/x64/loader.ld

Commit Bot

unread,
Dec 12, 2021, 10:53:59 PM12/12/21
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

x64: add list files of exported symbols

This patch adds files with lists of symbols to be exported
by kernel. The files have been generated on Fedora 33 using
the scripts/extract_symbols.sh.

These files will be fed to the process to generate version script.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols b/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols
--- a/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols
+++ b/exported_symbols/x64/osv_ld-linux-x86-64.so.2.symbols
@@ -0,0 +1,2 @@
+__libc_stack_end
+__tls_get_addr
diff --git a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
--- a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
--- a/exported_symbols/x64/osv_libaio.so.1.symbols
+++ b/exported_symbols/x64/osv_libaio.so.1.symbols
@@ -0,0 +1,5 @@
+io_cancel
+io_destroy
+io_getevents
+io_setup
+io_submit
diff --git a/exported_symbols/x64/osv_libc.so.6.symbols b/exported_symbols/x64/osv_libc.so.6.symbols
--- a/exported_symbols/x64/osv_libc.so.6.symbols
--- a/exported_symbols/x64/osv_libcrypt.so.1.symbols
+++ b/exported_symbols/x64/osv_libcrypt.so.1.symbols
@@ -0,0 +1,4 @@
+crypt
+crypt_r
+encrypt
+setkey
diff --git a/exported_symbols/x64/osv_libdl.so.2.symbols b/exported_symbols/x64/osv_libdl.so.2.symbols
--- a/exported_symbols/x64/osv_libdl.so.2.symbols
+++ b/exported_symbols/x64/osv_libdl.so.2.symbols
@@ -0,0 +1,6 @@
+dladdr
+dlclose
+dlerror
+dlopen
+dlsym
+dlvsym
diff --git a/exported_symbols/x64/osv_libm.so.6.symbols b/exported_symbols/x64/osv_libm.so.6.symbols
--- a/exported_symbols/x64/osv_libm.so.6.symbols
--- a/exported_symbols/x64/osv_libpthread.so.0.symbols
--- a/exported_symbols/x64/osv_libresolv.so.2.symbols
+++ b/exported_symbols/x64/osv_libresolv.so.2.symbols
null
diff --git a/exported_symbols/x64/osv_librt.so.1.symbols b/exported_symbols/x64/osv_librt.so.1.symbols
--- a/exported_symbols/x64/osv_librt.so.1.symbols
+++ b/exported_symbols/x64/osv_librt.so.1.symbols
null
diff --git a/exported_symbols/x64/osv_libutil.so.symbols b/exported_symbols/x64/osv_libutil.so.symbols
--- a/exported_symbols/x64/osv_libutil.so.symbols
+++ b/exported_symbols/x64/osv_libutil.so.symbols
@@ -0,0 +1,2 @@
+forkpty
+openpty
diff --git a/exported_symbols/x64/osv_libxenstore.so.3.0.symbols b/exported_symbols/x64/osv_libxenstore.so.3.0.symbols
--- a/exported_symbols/x64/osv_libxenstore.so.3.0.symbols

Commit Bot

unread,
Dec 12, 2021, 10:53:59 PM12/12/21
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

scripts: add new generate_version_script.sh

This patch adds new script that generates version script
based on the symbol files from exported_symbols/<arch>/*.symbols

Comparing to the 1st version, this one will work when building both
x64 and aarch64 versions of kernel.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/scripts/generate_version_script.sh b/scripts/generate_version_script.sh
--- a/scripts/generate_version_script.sh
+for file in exported_symbols/$ARCH/*.symbols

Commit Bot

unread,
Dec 12, 2021, 10:54:01 PM12/12/21
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

makefile: enable garbage collection of code and data when hiding symbols

This patch changes the main makefile to enable garbage collection of
code and data when linking kernel with most symbols hidden.

In essence it makes all object files compile with '-ffunction-sections
-fdata-sections' flags only when conf_hide_symbols is ON. This allows
linker to eliminate code and data (with --gc-sections) that is not
really used between various compilation units. As the result it allows
us to produce even smaller kernel ELF at around 4.3M, down from 5.1M
when we would hide symbols only. In order to see what exact code and
data gets eliminated, one can pass --print-gc-sections flags to the
linker like so:

./scripts/build image=native-example fs=rofs conf_hide_symbols=1 conf_linker_extra_options=--print-gc-sections

In addition this patch also changes the makefile to make linker use
version script generated by ./scripts/generate_version_script.sh which
is obnly enabled when conf_hide_symbols is ON. Using version script
(--version-script) plays some role in futher reducing number of symbols
down to what exactly we want to export in exported/<arch>/*symbols.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/Makefile b/Makefile
Reply all
Reply to author
Forward
0 new messages