[PATCH 04/14] Move default config to librtemsdefaultconfig.a

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 29 09:03:13 UTC 2018


An RTEMS application default configuration is contained in
cpukit/libmisc/dummy/default-configuration.c.  This default
configuration was contained in librtemscpu.a.  This had at least two
problems:

1. Application configuration errors may have pulled in the default
   configuration which in turn lead to multiply define symbols error.
   This was quite confusing.  You had to consult the linker map file to
   figure out what cased the pull in of the default configuration.  You
   needed to know what a linker map file is and how you generate it with
   your build system.  This was not very user friendly.

2. It prevented the use of default configuration items for each subsystem
   in librtemscpu.a.  This may be used to reduce the size of the
   configuration itself.

Move the default configuration to the separate library
librtemsdefaultconfig.a.

Close #3551.
---
 cpukit/Makefile.am              |  6 +++++-
 testsuites/libtests/Makefile.am | 47 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 15c1da9b52..5e1fdbd240 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -281,7 +281,6 @@ librtemscpu_a_SOURCES += libmisc/cpuuse/cpuusagereset.c
 librtemscpu_a_SOURCES += libmisc/cpuuse/cpuusagetop.c
 librtemscpu_a_SOURCES += libmisc/devnull/devnull.c
 librtemscpu_a_SOURCES += libmisc/devnull/devzero.c
-librtemscpu_a_SOURCES += libmisc/dummy/default-configuration.c
 librtemscpu_a_SOURCES += libmisc/dummy/dummy-networking.c
 librtemscpu_a_SOURCES += libmisc/dumpbuf/dumpbuf.c
 librtemscpu_a_SOURCES += libmisc/fb/mw_print.c
@@ -1831,6 +1830,11 @@ $(top_srcdir)/sapi/src/version.c: version-vc-key.h
 
 all-local: generate-vc-key
 
+project_lib_LIBRARIES += librtemsdefaultconfig.a
+
+librtemsdefaultconfig_a_SOURCES =
+librtemsdefaultconfig_a_SOURCES += libmisc/dummy/default-configuration.c
+
 project_lib_LIBRARIES += libftpd.a
 
 libftpd_a_SOURCES =
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index 1ffab4eef3..4f9d48d783 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -188,6 +188,7 @@ endif
 if TEST_calloc
 lib_tests += calloc.norun
 calloc_norun_SOURCES = POSIX/calloc.c
+calloc_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_capture01
@@ -203,11 +204,13 @@ endif
 if TEST_clock_gettime
 lib_tests += clock_gettime.norun
 clock_gettime_norun_SOURCES = POSIX/clock_gettime.c
+clock_gettime_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_close
 lib_tests += close.norun
 close_norun_SOURCES = POSIX/close.c
+close_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_complex
@@ -257,6 +260,7 @@ lib_docs += defaultconfig01/defaultconfig01.doc
 defaultconfig01_SOURCES = defaultconfig01/init.c
 defaultconfig01_CPPFLAGS = $(AM_CPPFLAGS) \
 	$(TEST_FLAGS_defaultconfig01) $(support_includes)
+defaultconfig01_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_devfs01
@@ -520,6 +524,7 @@ endif
 if TEST_dup2
 lib_tests += dup2.norun
 dup2_norun_SOURCES = POSIX/dup2.c
+dup2_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_exit01
@@ -543,6 +548,7 @@ endif
 if TEST_fcntl
 lib_tests += fcntl.norun
 fcntl_norun_SOURCES = POSIX/fcntl.c
+fcntl_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_flashdisk01
@@ -558,21 +564,25 @@ endif
 if TEST_flockfile
 lib_tests += flockfile.norun
 flockfile_norun_SOURCES = POSIX/flockfile.c
+flockfile_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_fork
 lib_tests += fork.norun
 fork_norun_SOURCES = POSIX/fork.c
+fork_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_free
 lib_tests += free.norun
 free_norun_SOURCES = POSIX/free.c
+free_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_fstat
 lib_tests += fstat.norun
 fstat_norun_SOURCES = POSIX/fstat.c
+fstat_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if NETTESTS
@@ -590,11 +600,13 @@ endif
 if TEST_ftrylockfile
 lib_tests += ftrylockfile.norun
 ftrylockfile_norun_SOURCES = POSIX/ftrylockfile.c
+ftrylockfile_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_funlockfile
 lib_tests += funlockfile.norun
 funlockfile_norun_SOURCES = POSIX/funlockfile.c
+funlockfile_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_getentropy01
@@ -609,26 +621,31 @@ endif
 if TEST_getlogin
 lib_tests += getlogin.norun
 getlogin_norun_SOURCES = POSIX/getlogin.c
+getlogin_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_getpwnam
 lib_tests += getpwnam.norun
 getpwnam_norun_SOURCES = POSIX/getpwnam.c
+getpwnam_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_getpwuid
 lib_tests += getpwuid.norun
 getpwuid_norun_SOURCES = POSIX/getpwuid.c
+getpwuid_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_gettimeofday
 lib_tests += gettimeofday.norun
 gettimeofday_norun_SOURCES = POSIX/gettimeofday.c
+gettimeofday_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_getuid
 lib_tests += getuid.norun
 getuid_norun_SOURCES = POSIX/getuid.c
+getuid_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_gxx01
@@ -651,6 +668,7 @@ endif
 if TEST_htonl
 lib_tests += htonl.norun
 htonl_norun_SOURCES = POSIX/htonl.c
+htonl_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_i2c01
@@ -665,21 +683,25 @@ endif
 if TEST_iconv
 lib_tests += iconv.norun
 iconv_norun_SOURCES = POSIX/iconv.c
+iconv_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_iconv_close
 lib_tests += iconv_close.norun
 iconv_close_norun_SOURCES = POSIX/iconv_close.c
+iconv_close_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_iconv_open
 lib_tests += iconv_open.norun
 iconv_open_norun_SOURCES = POSIX/iconv_open.c
+iconv_open_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_kill
 lib_tests += kill.norun
 kill_norun_SOURCES = POSIX/kill.c
+kill_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_libfdt01
@@ -694,21 +716,25 @@ endif
 if TEST_longjmp
 lib_tests += longjmp.norun
 longjmp_norun_SOURCES = POSIX/longjmp.c
+longjmp_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_lseek
 lib_tests += lseek.norun
 lseek_norun_SOURCES = POSIX/lseek.c
+lseek_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_lstat
 lib_tests += lstat.norun
 lstat_norun_SOURCES = POSIX/lstat.c
+lstat_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_malloc
 lib_tests += malloc.norun
 malloc_norun_SOURCES = POSIX/malloc.c
+malloc_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_malloc02
@@ -835,6 +861,7 @@ endif
 if TEST_nanosleep
 lib_tests += nanosleep.norun
 nanosleep_norun_SOURCES = POSIX/nanosleep.c
+nanosleep_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if NETTESTS
@@ -860,16 +887,19 @@ endif
 if TEST_open
 lib_tests += open.norun
 open_norun_SOURCES = POSIX/open.c
+open_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_pipe
 lib_tests += pipe.norun
 pipe_norun_SOURCES = POSIX/pipe.c
+pipe_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_posix_memalign
 lib_tests += posix_memalign.norun
 posix_memalign_norun_SOURCES = POSIX/posix_memalign.c
+posix_memalign_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_putenvtest
@@ -910,16 +940,19 @@ endif
 if TEST_read
 lib_tests += read.norun
 read_norun_SOURCES = POSIX/read.c
+read_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_readv
 lib_tests += readv.norun
 readv_norun_SOURCES = POSIX/readv.c
+readv_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_realloc
 lib_tests += realloc.norun
 realloc_norun_SOURCES = POSIX/realloc.c
+realloc_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_rtmonuse
@@ -934,6 +967,7 @@ endif
 if TEST_setjmp
 lib_tests += setjmp.norun
 setjmp_norun_SOURCES = POSIX/setjmp.c
+setjmp_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sha
@@ -956,31 +990,37 @@ endif
 if TEST_sigaddset
 lib_tests += sigaddset.norun
 sigaddset_norun_SOURCES = POSIX/sigaddset.c
+sigaddset_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sigdelset
 lib_tests += sigdelset.norun
 sigdelset_norun_SOURCES = POSIX/sigdelset.c
+sigdelset_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sigemptyset
 lib_tests += sigemptyset.norun
 sigemptyset_norun_SOURCES = POSIX/sigemptyset.c
+sigemptyset_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sigfillset
 lib_tests += sigfillset.norun
 sigfillset_norun_SOURCES = POSIX/sigfillset.c
+sigfillset_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sigismember
 lib_tests += sigismember.norun
 sigismember_norun_SOURCES = POSIX/sigismember.c
+sigismember_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sigprocmask
 lib_tests += sigprocmask.norun
 sigprocmask_norun_SOURCES = POSIX/sigprocmask.c
+sigprocmask_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_sparsedisk01
@@ -1022,6 +1062,7 @@ endif
 if TEST_stat
 lib_tests += stat.norun
 stat_norun_SOURCES = POSIX/stat.c
+stat_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_stringto01
@@ -1273,6 +1314,7 @@ endif
 if TEST_unlink
 lib_tests += unlink.norun
 unlink_norun_SOURCES = POSIX/unlink.c
+unlink_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_utf8proc01
@@ -1287,26 +1329,31 @@ endif
 if TEST_vfork
 lib_tests += vfork.norun
 vfork_norun_SOURCES = POSIX/vfork.c
+vfork_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_wait
 lib_tests += wait.norun
 wait_norun_SOURCES = POSIX/wait.c
+wait_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_waitpid
 lib_tests += waitpid.norun
 waitpid_norun_SOURCES = POSIX/waitpid.c
+waitpid_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_write
 lib_tests += write.norun
 write_norun_SOURCES = POSIX/write.c
+write_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 if TEST_writev
 lib_tests += writev.norun
 writev_norun_SOURCES = POSIX/writev.c
+writev_norun_LDADD = $(LDADD) $(RTEMS_ROOT)cpukit/librtemsdefaultconfig.a
 endif
 
 rtems_tests_PROGRAMS = $(lib_tests)
-- 
2.16.4




More information about the devel mailing list