Skip to content

Commit

Permalink
rtld: remove crt{begin,end}.S and define __dso_handle in c++
Browse files Browse the repository at this point in the history
  • Loading branch information
64 committed Oct 16, 2024
1 parent a3cabed commit 536c134
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 310 deletions.
8 changes: 1 addition & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -372,17 +372,11 @@ internal_sources = [
'options/internal/generic/search.cpp',
'options/internal/gcc/stack_protector.cpp',
'options/internal/gcc/guard-abi.cpp',
'options/internal/gcc/initfini.cpp',
'options/internal/gcc-extra/cxxabi.cpp',
'options/internal' / host_machine.cpu_family() / 'setjmp.S',
'options/internal' / host_machine.cpu_family() / 'fenv.S',
]

internal_dso_sources = [
'options/internal' / host_machine.cpu_family() / 'mlibc_crtbegin.S',
'options/internal' / host_machine.cpu_family() / 'mlibc_crtend.S',
]

if not no_headers
install_headers(
'options/internal/include/stdint.h'
Expand Down Expand Up @@ -520,7 +514,7 @@ if not headers_only
)
hide_everything_ld = (meson.current_source_dir()
/ 'scripts/hide-everything.ld')
libc_shared = shared_library('c', libc_all_sources + internal_dso_sources,
libc_shared = shared_library('c', libc_all_sources,
cpp_args: [libc_cpp_args],
include_directories: libc_include_dirs,
dependencies: libc_deps + rtlib_deps,
Expand Down
29 changes: 0 additions & 29 deletions options/internal/aarch64/mlibc_crtbegin.S

This file was deleted.

22 changes: 0 additions & 22 deletions options/internal/aarch64/mlibc_crtend.S

This file was deleted.

38 changes: 0 additions & 38 deletions options/internal/gcc/initfini.cpp

This file was deleted.

29 changes: 0 additions & 29 deletions options/internal/m68k/mlibc_crtbegin.S

This file was deleted.

23 changes: 0 additions & 23 deletions options/internal/m68k/mlibc_crtend.S

This file was deleted.

29 changes: 0 additions & 29 deletions options/internal/riscv64/mlibc_crtbegin.S

This file was deleted.

21 changes: 0 additions & 21 deletions options/internal/riscv64/mlibc_crtend.S

This file was deleted.

29 changes: 0 additions & 29 deletions options/internal/x86/mlibc_crtbegin.S

This file was deleted.

24 changes: 0 additions & 24 deletions options/internal/x86/mlibc_crtend.S

This file was deleted.

29 changes: 0 additions & 29 deletions options/internal/x86_64/mlibc_crtbegin.S

This file was deleted.

24 changes: 0 additions & 24 deletions options/internal/x86_64/mlibc_crtend.S

This file was deleted.

4 changes: 3 additions & 1 deletion options/lsb/generic/dso_exit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ extern "C" void __cxa_finalize(void *dso) {
}
}

extern "C" void *__dso_handle;
// This is referenced by the compiler when generating constructors for global
// C++ objects so that it can call __cxa_finalize with a unique argument.
extern "C" { [[gnu::visibility("hidden")]] void *__dso_handle; }

[[gnu::destructor]] void __mlibc_do_destructors() {
// In normal programs this call to __cxa_finalize is provided by libgcc.
Expand Down
6 changes: 1 addition & 5 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,7 @@ if library_type == 'static'
use_pie = false
test_c_args += '-no-pie'
test_link_args += ['-no-pie', '-static']
test_sources += [
'../options/internal' / host_machine.cpu_family() / 'mlibc_crtbegin.S',
'../options/internal' / host_machine.cpu_family() / 'mlibc_crtend.S',
crt,
]
test_sources += crt
else
libc_dep = declare_dependency(
include_directories: libc_include_dirs,
Expand Down

0 comments on commit 536c134

Please sign in to comment.