Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE]Badochov/dynamic linker gcc 14.2 #1197

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/phoenix-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inputs:
# action runner
runs:
using: 'docker'
image: 'ghcr.io/phoenix-rtos/build'
image: 'docker://phoenixrtosbadochov/build-shared:squash_gcc-14.2'
env:
CONSOLE: 'serial'
DEBUG: '1'
Expand Down
1 change: 1 addition & 0 deletions _projects/armv7a7-imx6ull-evk/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ W /sbin/dummyfs -m /var -D
W /sbin/dummyfs -m /tmp -D
X /sbin/lwip enet:0x02188000:150:PHY:0.2:irq:-5:/dev/gpio5 enet:0x020b4000:152:no-mdio:PHY:0.1:irq:-6:/dev/gpio5
X /bin/posixsrv
W /bin/ldconfig
X /bin/psh
1 change: 1 addition & 0 deletions _projects/armv7a9-zynq7000-qemu/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ W /bin/bind devfs /dev
W /sbin/dummyfs -m /tmp -D
X /bin/posixsrv
T /dev/console
W /bin/ldconfig
X /linuxrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export HOME=/root
W /bin/bind devfs /dev
W /sbin/dummyfs -m /tmp -D
X /bin/posixsrv
W /bin/ldconfig
X /bin/psh
1 change: 1 addition & 0 deletions _projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ W /sbin/dummyfs -m /tmp -D
X /bin/posixsrv
X /sbin/lwip rtl:0x18:11
T /dev/console
W /bin/ldconfig
X /bin/psh
1 change: 1 addition & 0 deletions _projects/riscv64-generic-qemu/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export HOME=/root
W /bin/bind devfs /dev
W /sbin/dummyfs -m /tmp -D
X /bin/posixsrv
W /bin/ldconfig
X /bin/psh
6 changes: 6 additions & 0 deletions _projects/sparcv8leon3-generic-qemu/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:{}:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export HOME=/root
W /bin/bind devfs /dev
X /bin/posixsrv
X /bin/psh
20 changes: 20 additions & 0 deletions _user/dlopen/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Makefile for user application
#
# Copyright 2024 Phoenix Systems
#
ifeq ($(HAVE_SHLIB), y)

NAME := libhello
LOCAL_HEADERS := hello.h
LOCAL_SRCS := hello.c

include $(shared-lib.mk)


NAME := dlopen
LOCAL_SRCS := main.c

include $(binary-dyn.mk)

endif
24 changes: 24 additions & 0 deletions _user/dlopen/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Phoenix-RTOS
*
* dlopen
*
* Example of user application using dlopen.
*
* Copyright 2024 Phoenix Systems
* Author: Hubert Badocha
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#include "hello.h"

#include <stdio.h>


int hello(void)
{
return printf("Hello shared world!\n");
}
21 changes: 21 additions & 0 deletions _user/dlopen/hello.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Phoenix-RTOS
*
* dlopen
*
* Example of user application using dlopen.
*
* Copyright 2024 Phoenix Systems
* Author: Hubert Badocha
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#ifndef _USER_DLOPEN_DYN_H_
#define _USER_DLOPEN_DYN_H_

int hello(void);

#endif
40 changes: 40 additions & 0 deletions _user/dlopen/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Phoenix-RTOS
*
* dlopen
*
* Example of user application using dlopen.
*
* Copyright 2024 Phoenix Systems
* Author: Hubert Badocha
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#include <stddef.h>
#include <stdio.h>
#include <dlfcn.h>
#include <sys/debug.h>

int main(void)
{
void *handle = dlopen("/usr/lib/libhello.so", RTLD_LAZY);
if (handle == NULL) {
printf("%s\n", dlerror());
return 1;
}
int (*hello)(void) = (int (*)(void))dlsym(handle, "hello");
if (hello == NULL) {
printf("%s\n", dlerror());
(void)dlclose(handle);
return 1;
}

hello();

(void)dlclose(handle);

return 0;
}
21 changes: 21 additions & 0 deletions _user/sharedlib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Makefile for user application
#
# Copyright 2024 Phoenix Systems
#
ifeq ($(HAVE_SHLIB), y)

NAME := libdyn
LOCAL_HEADERS := dyn.h
LOCAL_SRCS := dyn.c

include $(shared-lib.mk)


NAME := sharedlib
LOCAL_SRCS := main.c
DEP_LIBS_SHARED := libdyn

include $(binary-dyn.mk)

endif
25 changes: 25 additions & 0 deletions _user/sharedlib/dyn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Phoenix-RTOS
*
* sharedlib
*
* Example of user application using shared libraries.
*
* Copyright 2024 Phoenix Systems
* Author: Hubert Badocha
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#include "dyn.h"


extern void *_DYNAMIC;


void *dyn(void)
{
return &_DYNAMIC;
}
22 changes: 22 additions & 0 deletions _user/sharedlib/dyn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Phoenix-RTOS
*
* sharedlib
*
* Example of user application using shared libraries.
*
* Copyright 2024 Phoenix Systems
* Author: Hubert Badocha
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/


#ifndef _USER_SHAREDLIB_DYN_H_
#define _USER_SHAREDLIB_DYN_H_

void *dyn(void);

#endif
25 changes: 25 additions & 0 deletions _user/sharedlib/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Phoenix-RTOS
*
* sharedlib
*
* Example of user application using shared libraries.
*
* Copyright 2024 Phoenix Systems
* Author: Hubert Badocha
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#include <stdio.h>

#include "dyn.h"

int main(void)
{
printf("Dynamic section pointer %p\n", dyn());

return 0;
}
2 changes: 1 addition & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

DOCKER_IMG_NAME=phoenixrtos/build
DOCKER_IMG_NAME=docker://phoenixrtosbadochov/build-shared:squash_gcc-14.2
if [ -e .docker_build_img ]; then
DOCKER_IMG_NAME="$(cat .docker_build_img)"
fi
Expand Down
2 changes: 1 addition & 1 deletion phoenix-rtos-build
Submodule phoenix-rtos-build updated 41 files
+8 −0 Makefile.common
+3 −0 build-core-armv7a7-imx6ull.sh
+3 −0 build-core-armv7a9-zynq7000.sh
+3 −0 build-core-ia32-generic.sh
+3 −0 build-core-riscv64-generic.sh
+3 −0 build-core-riscv64-noelv.sh
+3 −0 build-core-sparcv8leon3-generic.sh
+3 −0 build-core-sparcv8leon3-gr712rc.sh
+25 −0 makes/binary-dyn.mk
+8 −0 makes/binary.mk
+6 −0 makes/check-env.mk
+153 −0 makes/shared-lib.mk
+1 −1 makes/static-lib.mk
+8 −0 target/armv7a.mk
+5 −1 target/armv7m.mk
+5 −1 target/armv8m.mk
+5 −1 target/armv8r.mk
+3 −0 target/host.mk
+8 −0 target/ia32.mk
+8 −0 target/riscv64.mk
+13 −1 target/sparcv8leon3.mk
+72 −31 toolchain/build-toolchain.sh
+6 −3 toolchain/gcc-14.2.0-01-arm-phoenix-multilib.patch
+40 −0 toolchain/gcc-14.2.0-02-i386-pc-phoenix.patch
+22 −0 toolchain/gcc-14.2.0-03-riscv64-phoenix.patch
+16 −14 toolchain/gcc-14.2.0-04-arm-pic_crtstuff.patch
+81 −81 toolchain/gcc-14.2.0-05-libstdcpp.patch
+24 −22 toolchain/gcc-14.2.0-06-sparc-phoenix.patch
+32 −38 toolchain/gcc-14.2.0-07-sparc-mno-pditr.patch
+16 −13 toolchain/gcc-14.2.0-08-sparc-pic_crtstuff.patch
+16 −0 toolchain/gcc-14.2.0-09-fix-libc-spec.patch
+24 −22 toolchain/gcc-14.2.0-10-armv-r-phoenix-multilib.patch
+23 −0 toolchain/gcc-14.2.0-11-fix-link-spec.patch
+60 −0 toolchain/gcc-14.2.0-12-set-init-files.patch
+52 −0 toolchain/gcc-14.2.0-13-compile-shared-libgcc.patch
+106 −0 toolchain/gcc-14.2.0-14-compile-shared-libstdc++.patch
+41 −0 toolchain/gcc-14.2.0-15-disable-thumb1-targets.patch
+0 −38 toolchain/gcc-9.5.0-02-i386-pc-phoenix.patch
+0 −21 toolchain/gcc-9.5.0-03-riscv64-phoenix.patch
+0 −10 toolchain/gcc-9.5.0-04-disable_tm.patch
+0 −13 toolchain/gcc-9.5.0-10-fix-libc-spec.patch
2 changes: 1 addition & 1 deletion phoenix-rtos-filesystems
2 changes: 1 addition & 1 deletion phoenix-rtos-lwip
2 changes: 1 addition & 1 deletion phoenix-rtos-ports
2 changes: 1 addition & 1 deletion phoenix-rtos-tests
Submodule phoenix-rtos-tests updated 67 files
+5 −0 Makefile
+28 −0 ld.elf_so/LICENSE.NetBSD
+173 −0 ld.elf_so/Makefile
+5 −0 ld.elf_so/README.md
+49 −0 ld.elf_so/h_df_1_noopen.c
+42 −0 ld.elf_so/h_dl_symver.c
+50 −0 ld.elf_so/h_ifunc.c
+149 −0 ld.elf_so/h_locking.c
+93 −0 ld.elf_so/h_thread_local_dtor.c
+10 −0 ld.elf_so/helper_abuse_dynamic/Makefile
+37 −0 ld.elf_so/helper_abuse_dynamic/h_abuse_dynamic.c
+10 −0 ld.elf_so/helper_abuse_static/Makefile
+37 −0 ld.elf_so/helper_abuse_static/h_abuse_static.c
+6 −0 ld.elf_so/helper_def_dynamic/Makefile
+37 −0 ld.elf_so/helper_def_dynamic/h_def_dynamic.c
+6 −0 ld.elf_so/helper_def_static/Makefile
+37 −0 ld.elf_so/helper_def_static/h_def_static.c
+6 −0 ld.elf_so/helper_dso1/Makefile
+66 −0 ld.elf_so/helper_dso1/h_helper_dso1.c
+10 −0 ld.elf_so/helper_dso2/Makefile
+57 −0 ld.elf_so/helper_dso2/h_helper_dso2.c
+11 −0 ld.elf_so/helper_dso3/Makefile
+46 −0 ld.elf_so/helper_dso3/h_helper_dso3.cpp
+6 −0 ld.elf_so/helper_ifunc_dso/Makefile
+84 −0 ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c
+10 −0 ld.elf_so/helper_onlyctor_dynamic/Makefile
+36 −0 ld.elf_so/helper_onlyctor_dynamic/h_onlyctor_dynamic.c
+6 −0 ld.elf_so/helper_onlydef/Makefile
+29 −0 ld.elf_so/helper_onlydef/h_onlydef.c
+6 −0 ld.elf_so/helper_onlydef_static/Makefile
+29 −0 ld.elf_so/helper_onlydef_static/h_onlydef_static.c
+10 −0 ld.elf_so/helper_onlyuse_dynamic/Makefile
+37 −0 ld.elf_so/helper_onlyuse_dynamic/h_onlyuse_dynamic.c
+10 −0 ld.elf_so/helper_onlyuse_static/Makefile
+37 −0 ld.elf_so/helper_onlyuse_static/h_onlyuse_static.c
+27 −0 ld.elf_so/helper_symver_dso0/Makefile
+39 −0 ld.elf_so/helper_symver_dso0/h_helper_symver_dso0.c
+28 −0 ld.elf_so/helper_symver_dso1/Makefile
+41 −0 ld.elf_so/helper_symver_dso1/h_helper_symver_dso1.c
+5 −0 ld.elf_so/helper_symver_dso1/h_helper_symver_dso1.map
+28 −0 ld.elf_so/helper_symver_dso2/Makefile
+59 −0 ld.elf_so/helper_symver_dso2/h_helper_symver_dso2.c
+13 −0 ld.elf_so/helper_symver_dso2/h_helper_symver_dso2.map
+10 −0 ld.elf_so/helper_use_dynamic/Makefile
+37 −0 ld.elf_so/helper_use_dynamic/h_use_dynamic.c
+10 −0 ld.elf_so/helper_use_static/Makefile
+37 −0 ld.elf_so/helper_use_static/h_use_static.c
+29 −0 ld.elf_so/helpers.h
+6 −0 ld.elf_so/libexecassert/Makefile
+124 −0 ld.elf_so/libexecassert/execassert.c
+24 −0 ld.elf_so/libexecassert/execassert.h
+96 −0 ld.elf_so/t_df_1_noopen.c
+139 −0 ld.elf_so/t_dl_symver.c
+92 −0 ld.elf_so/t_dlerror-cleared.c
+106 −0 ld.elf_so/t_dlerror-false.c
+144 −0 ld.elf_so/t_dlinfo.c
+220 −0 ld.elf_so/t_dlvsym.c
+237 −0 ld.elf_so/t_hash.c
+234 −0 ld.elf_so/t_ifunc.c
+199 −0 ld.elf_so/t_rtld_r_debug.c
+88 −0 ld.elf_so/t_thread_local_dtor.c
+138 −0 ld.elf_so/t_tls_extern-nightly.c
+380 −0 ld.elf_so/t_tls_extern.c
+51 −0 ld.elf_so/test.yaml
+2 −2 proc/test_priority.c
+1 −1 thread-local/tls.c
+2 −0 thread-local/tls_functions.c
2 changes: 1 addition & 1 deletion phoenix-rtos-utils
2 changes: 1 addition & 1 deletion plo