VirtualBox

Changeset 72137 in vbox


Ignore:
Timestamp:
May 7, 2018 12:31:41 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122533
Message:

Some more fixes for building backwards-compatible Linux Additions binaries.
bugref:9112: Linux Additions: fix building binaries for older Linux user space

  • Only link with --hash-style=sysv where that option is supported.
  • Fix chk_stubs.c build mess by building it as a normal source file. It does

not need to come after the static libraries using its symbols on the command
line as it is an object file, not a library, and therefore its symbols are
always pulled in.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r72114 r72137  
    27612761        $(QUIET)$(APPEND) '$@' 'VBOX_GCC_mtune-generic         ?= $(call VBOX_GCC_CHECK_CC,-mtune=generic,)'
    27622762        $(QUIET)$(APPEND) '$@' 'VBOX_LD_as_needed              ?= $(call VBOX_GCC_CHECK_LD,--as-needed,)'
     2763        $(QUIET)$(APPEND) '$@' 'VBOX_LD_hash_style_sysv        ?= $(call VBOX_GCC_CHECK_LD,--hash-style=sysv,)'
    27632764# gcc version < 3.4 has a bug in handling __attribute__((regparm(3))).
    27642765# See http://osdir.com/ml/gcc.prs/2002-08/msg00223.html and probably http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20004
     
    66436644TEMPLATE_VBOXGUESTR3EXE_CFLAGS.linux      = $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS.linux)
    66446645# The GNU_HASH ELF tag is not supported by older systems.
    6645 TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux      += -Wl,--hash-style=sysv
     6646TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux      += $(VBOX_LD_hash_style_sysv)
    66466647
    66476648#
     
    68476848TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TARGET) = $(NO_SUCH_VARIABLE)
    68486849# The GNU_HASH ELF tag is not supported by older glibc dynamic linkers.
    6849 TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.linux = --hash-style=sysv
     6850TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.linux = $(subst -Wl$(COMMA),,$(VBOX_LD_hash_style_sysv))
    68506851TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.$(KBUILD_TYPE)   = $(NO_SUCH_VARIABLE)
    68516852TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS          = -r
  • trunk/src/VBox/Additions/x11/VBoxClient/Makefile.kmk

    r72124 r72137  
    3939        display-svga.cpp \
    4040        display-svga-x11.cpp
     41VBoxClient_SOURCES.linux = \
     42        chk_stubs.c
    4143VBoxClient_LIBPATH = \
    4244        $(VBOX_LIBPATH32_X11)
     
    6870        supc++ \
    6971        gcc_eh
    70 # This has to be in LIBS, so as to be linked in after supc++ and gcc_eh, which
    71 # depend on the symbols it provides.  Static supc++ and gcc_eh on at least
    72 # Ubuntu 17.04 contain references to __sprintf_chk and __stack_chk_fail.
    73 # Furthermore, they contain references to memcpy, which needs to be resolved
    74 # to memcpy@GLIBC_2.2.5, which we solve in a not-very-satisfactory way with a
    75 # wrapper.
    76 ##
    77 ## @todo r=bird: With all due respect, what are you smoking??  The above does not compute,
    78 ## so there is either some other reason which you fail to describe or you've got it all wrong.
    79 ## It cannot be for reasons of symbol resolution, because puttin chk_stubs.c in SOURCES would
    80 ## make absolutely sure the symbols in it would always be part of the link and present in the
    81 ## symbol table before any library searching is done.  I cannot see how the --wrap-memcpy could
    82 ## have anything to do with this either.
    83 ##
    84 ## Your query on IRC why chk_stubs.c is treated as C++, that's because the linker is called g++.
    85 ##
    86 ## Please explain why this nonsese is required or I will revert it and leave you deal with the consequences.
    87 ##
    88 ## -bird
    89 ##
     72
     73# This forces the memcpy references in the static libraries to go to
     74# __wrap_memcpy, which we can wrap around memcpy@GLIBC_2.2.5.  I do not know
     75# how else to do that without recompiling or implementing our own memcpy.
    9076ifeq ($(KBUILD_TARGET),linux)
    91 VBoxClient_LIBS    += \
    92         $(PATH_ROOT)/src/VBox/Additions/x11/VBoxClient/chk_stubs.c
    9377VBoxClient_LDFLAGS.amd64 += \
    9478        -Wl,--wrap=memcpy
  • trunk/src/VBox/Additions/x11/VBoxClient/chk_stubs.c

    r72122 r72137  
    5050 * supc++ and gcc_eh contain references which we cannot change. */
    5151
    52 #ifdef __cplusplus
    53 extern "C" void *__wrap_memcpy(void *dest, const void *src, size_t n);
    54 #endif
     52extern void *__wrap_memcpy(void *dest, const void *src, size_t n);
    5553
    5654asm (".symver memcpy, memcpy@GLIBC_2.2.5");
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette