Merge pull request #142 from Geertiebear/mlibc-gcc
mlibc-gcc wrapper and various fixes
This commit is contained in:
commit
1db7107729
|
@ -85,7 +85,3 @@ packages:
|
|||
environ:
|
||||
DESTDIR: '@THIS_COLLECT_DIR@'
|
||||
quiet: true
|
||||
- args: ['cp', '/usr/lib/x86_64-linux-gnu/crti.o', '@THIS_COLLECT_DIR@/usr/lib']
|
||||
quiet: true
|
||||
- args: ['cp', '/usr/lib/x86_64-linux-gnu/crtn.o', '@THIS_COLLECT_DIR@/usr/lib']
|
||||
quiet: true
|
||||
|
|
|
@ -283,7 +283,7 @@ void ObjectRepository::_fetchFromPhdrs(SharedObject *object, void *phdr_pointer,
|
|||
tls_offset = phdr->p_vaddr;
|
||||
case PT_INTERP:
|
||||
object->interpreterPath = frg::string<MemoryAllocator>{
|
||||
(char*)(phdr->p_vaddr),
|
||||
(char*)(object->baseAddress + phdr->p_vaddr),
|
||||
getAllocator()
|
||||
};
|
||||
} break;
|
||||
|
|
|
@ -45,4 +45,30 @@ if not headers_only
|
|||
install: true,
|
||||
install_dir: get_option('libdir')
|
||||
)
|
||||
|
||||
custom_target('crti',
|
||||
build_by_default: true,
|
||||
command: c_compiler.cmd_array() + ['-c', '-o', '@OUTPUT@', '@INPUT@'],
|
||||
input: 'x86_64-crt/crti.S',
|
||||
output: 'crti.o',
|
||||
install: true,
|
||||
install_dir: get_option('libdir')
|
||||
)
|
||||
|
||||
custom_target('crtn',
|
||||
build_by_default: true,
|
||||
command: c_compiler.cmd_array() + ['-c', '-o', '@OUTPUT@', '@INPUT@'],
|
||||
input: 'x86_64-crt/crtn.S',
|
||||
output: 'crtn.o',
|
||||
install: true,
|
||||
install_dir: get_option('libdir')
|
||||
)
|
||||
|
||||
install_data('mlibc-gcc.specs',
|
||||
install_dir: get_option('libdir')
|
||||
)
|
||||
|
||||
install_data('mlibc-gcc',
|
||||
install_dir: get_option('bindir')
|
||||
)
|
||||
endif
|
||||
|
|
2
sysdeps/linux/mlibc-gcc
Executable file
2
sysdeps/linux/mlibc-gcc
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec "${REALGCC:-gcc}" "$@" -specs "/usr/lib/mlibc/lib/mlibc-gcc.specs"
|
32
sysdeps/linux/mlibc-gcc.specs
Normal file
32
sysdeps/linux/mlibc-gcc.specs
Normal file
|
@ -0,0 +1,32 @@
|
|||
%rename cpp_options old_cpp_options
|
||||
|
||||
*cpp_options:
|
||||
-nostdinc -isystem /usr/lib/mlibc/include -isystem include%s %(old_cpp_options)
|
||||
|
||||
*cc1:
|
||||
%(cc1_cpu) -nostdinc -isystem /usr/lib/mlibc/include -isystem include%s
|
||||
|
||||
*link_libgcc:
|
||||
-L/usr/lib/mlibc/lib -L .%s
|
||||
|
||||
*libgcc:
|
||||
libgcc.a%s %:if-exists(libgcc_eh.a%s)
|
||||
|
||||
*startfile:
|
||||
%{!shared: /usr/lib/mlibc/lib/Scrt1.o} /usr/lib/mlibc/lib/crti.o crtbeginS.o%s
|
||||
|
||||
*endfile:
|
||||
crtendS.o%s /usr/lib/mlibc/lib/crtn.o
|
||||
|
||||
*link:
|
||||
-dynamic-linker /usr/lib/mlibc/lib/ld.so -rpath /usr/lib/mlibc/lib -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}
|
||||
|
||||
*esp_link:
|
||||
|
||||
|
||||
*esp_options:
|
||||
|
||||
|
||||
*esp_cpp_options:
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
.section .text
|
||||
.global _start
|
||||
_start:
|
||||
lea main(%rip), %rdi
|
||||
mov %rsp, %rdi
|
||||
lea main(%rip), %rsi
|
||||
call __mlibc_entry
|
||||
|
|
9
sysdeps/linux/x86_64-crt/crti.S
Normal file
9
sysdeps/linux/x86_64-crt/crti.S
Normal file
|
@ -0,0 +1,9 @@
|
|||
.section .init
|
||||
.global _init
|
||||
_init:
|
||||
push %rax
|
||||
|
||||
.section .fini
|
||||
.global _fini
|
||||
_fini:
|
||||
push %rax
|
7
sysdeps/linux/x86_64-crt/crtn.S
Normal file
7
sysdeps/linux/x86_64-crt/crtn.S
Normal file
|
@ -0,0 +1,7 @@
|
|||
.section .init
|
||||
pop %rax
|
||||
ret
|
||||
|
||||
.section .fini
|
||||
pop %rax
|
||||
ret
|
Loading…
Reference in a new issue