clarify the purpose of this project
[nyanglibc.git] / make / elf.sh
blobf9549832e1f18d1b25b97a8cd5ffa1989526c8ec
1 printf "\
2 ELF*****************************************************************************\n"
3 gens="\
4 dl-usage.shared.s.in \
5 dl-cache.s.in \
6 dl-cache.shared.s.in \
8 mkdir -p $build_dir/elf
9 for g in $gens
11 printf "CONFIGURING $g\n"
12 # order matters
13 sed -E -e "s@CONF_PREFIX_BYTES_N@$conf_prefix_bytes_n@;s@CONF_PREFIX@$conf_prefix@" \
14 $src_dir/elf/$g >$build_dir/elf/$(basename $g .in)
15 done
16 gens="\
17 dl-load.s.in \
18 dl-load.shared.s.in \
20 # do not include the terminating 0
21 conf_system_dirs_str="$conf_prefix/lib/"
22 conf_system_dirs_str_bytes_n=$(printf "$conf_system_dirs_str\0" | wc -c)
23 for g in $gens
25 printf "CONFIGURING $g\n"
26 # order matters
27 sed -E -e "s@CONF_SYSTEM_DIRS_STR_BYTES_N@$conf_system_dirs_str_bytes_n@;s@CONF_SYSTEM_DIRS_STR@$conf_system_dirs_str@" \
28 $src_dir/elf/$g >$build_dir/elf/$(basename $g .in)
29 done
30 paths_pie_shared="\
31 $src_dir/elf/dl-iteratephdr \
32 $src_dir/elf/dl-addr \
33 $src_dir/elf/dl-addr-obj \
34 $src_dir/elf/dl-profstub \
35 $src_dir/elf/dl-libc \
36 $src_dir/elf/dl-sym \
37 $src_dir/elf/dl-error \
38 $src_dir/elf/libc_early_init \
39 $src_dir/elf/get-cpuid-feature-leaf \
40 $build_dir/elf/dl-load \
41 $src_dir/elf/dl-lookup \
42 $src_dir/elf/dl-object \
43 $src_dir/elf/dl-reloc \
44 $src_dir/elf/dl-deps \
45 $src_dir/elf/dl-runtime \
46 $src_dir/elf/dl-init \
47 $src_dir/elf/dl-fini \
48 $src_dir/elf/dl-debug \
49 $src_dir/elf/dl-scope \
50 $src_dir/elf/dl-execstack \
51 $src_dir/elf/dl-open \
52 $src_dir/elf/dl-close \
53 $src_dir/elf/dl-exception \
54 $src_dir/elf/dl-sort-maps \
55 $src_dir/elf/dl-lookup-direct \
56 $src_dir/elf/dl-call-libc-early-init \
57 $src_dir/elf/dl-write \
58 $src_dir/elf/dl-thread_gscope_wait \
59 $build_dir/elf/dl-cache \
60 $src_dir/elf/dl-tunables \
61 $src_dir/elf/tlsdesc \
62 $src_dir/elf/dl-get-cpu-features \
63 $src_dir/elf/dl-sysdep \
64 $src_dir/elf/dl-trampoline \
65 $src_dir/elf/dl-tlsdesc \
66 $src_dir/elf/tls_get_addr \
67 $src_dir/elf/dl-misc \
68 $src_dir/elf/dl-version \
69 $src_dir/elf/dl-profile \
70 $src_dir/elf/dl-tls \
71 $src_dir/elf/dl-origin \
73 paths_pie="\
74 $paths_pie_shared \
75 $src_dir/elf/dl-support \
76 $src_dir/elf/enbl-secure \
77 $src_dir/elf/dl-reloc-static-pie \
79 paths_shared="\
80 $paths_pie_shared \
81 $src_dir/elf/rtld \
82 $src_dir/elf/dl-environ \
83 $src_dir/elf/dl-minimal \
84 $src_dir/elf/dl-error-minimal \
85 $src_dir/elf/dl-conflict \
86 $src_dir/elf/dl-hwcaps \
87 $src_dir/elf/dl-hwcaps_split \
88 $src_dir/elf/dl-hwcaps-subdirs \
89 $build_dir/elf/dl-usage \
90 $src_dir/elf/dl-brk \
91 $src_dir/elf/dl-sbrk \
92 $src_dir/elf/dl-getcwd \
93 $src_dir/elf/dl-openat64 \
94 $src_dir/elf/dl-opendir \
96 mkdir -p $build_dir/elf
97 for p in $paths_pie
99 printf "ASSEMBLING PIE $p\n"
100 $as $p.s -o $build_dir/elf/$(basename $p .in).o
101 done
102 for p in $paths_shared
104 printf "ASSEMBLING SHARED $p\n"
105 $as $p.shared.s -o $build_dir/elf/$(basename $p .in).os
106 done
107 printf 'CREATING STAMPS FILES\n'
108 printf 'elf/dl-load.o elf/dl-lookup.o elf/dl-object.o elf/dl-reloc.o elf/dl-deps.o elf/dl-runtime.o elf/dl-init.o elf/dl-fini.o elf/dl-debug.o elf/dl-misc.o elf/dl-version.o elf/dl-profile.o elf/dl-tls.o elf/dl-origin.o elf/dl-scope.o elf/dl-execstack.o elf/dl-open.o elf/dl-close.o elf/dl-trampoline.o elf/dl-exception.o elf/dl-sort-maps.o elf/dl-lookup-direct.o elf/dl-call-libc-early-init.o elf/dl-write.o elf/dl-thread_gscope_wait.o elf/dl-cache.o elf/dl-tunables.o elf/tlsdesc.o elf/dl-tlsdesc.o elf/tls_get_addr.o elf/dl-get-cpu-features.o elf/dl-support.o elf/dl-iteratephdr.o elf/dl-addr.o elf/dl-addr-obj.o elf/enbl-secure.o elf/dl-profstub.o elf/dl-libc.o elf/dl-sym.o elf/dl-sysdep.o elf/dl-error.o elf/dl-reloc-static-pie.o elf/libc_early_init.o elf/get-cpuid-feature-leaf.o\n' >$build_dir/elf/stamp.o
109 printf 'elf/dl-iteratephdr.os elf/dl-addr.os elf/dl-addr-obj.os elf/dl-profstub.os elf/dl-libc.os elf/dl-sym.os elf/dl-error.os elf/libc_early_init.os elf/get-cpuid-feature-leaf.os\n' >$build_dir/elf/stamp.os
110 printf '' >$build_dir/elf/stamp.oS
111 printf 'CREATING SHARED DL-ALLOBJS.OS\n'
112 $ld -nostdlib -r -o $build_dir/elf/dl-allobjs.os $build_dir/elf/rtld.os $build_dir/elf/dl-load.os $build_dir/elf/dl-lookup.os $build_dir/elf/dl-object.os $build_dir/elf/dl-reloc.os $build_dir/elf/dl-deps.os $build_dir/elf/dl-runtime.os $build_dir/elf/dl-init.os $build_dir/elf/dl-fini.os $build_dir/elf/dl-debug.os $build_dir/elf/dl-misc.os $build_dir/elf/dl-version.os $build_dir/elf/dl-profile.os $build_dir/elf/dl-tls.os $build_dir/elf/dl-origin.os $build_dir/elf/dl-scope.os $build_dir/elf/dl-execstack.os $build_dir/elf/dl-open.os $build_dir/elf/dl-close.os $build_dir/elf/dl-trampoline.os $build_dir/elf/dl-exception.os $build_dir/elf/dl-sort-maps.os $build_dir/elf/dl-lookup-direct.os $build_dir/elf/dl-call-libc-early-init.os $build_dir/elf/dl-write.os $build_dir/elf/dl-thread_gscope_wait.os $build_dir/elf/dl-cache.os $build_dir/elf/dl-tunables.os $build_dir/elf/tlsdesc.os $build_dir/elf/dl-tlsdesc.os $build_dir/elf/tls_get_addr.os $build_dir/elf/dl-get-cpu-features.os $build_dir/elf/dl-sysdep.os $build_dir/elf/dl-environ.os $build_dir/elf/dl-minimal.os $build_dir/elf/dl-error-minimal.os $build_dir/elf/dl-conflict.os $build_dir/elf/dl-hwcaps.os $build_dir/elf/dl-hwcaps_split.os $build_dir/elf/dl-hwcaps-subdirs.os $build_dir/elf/dl-usage.os $build_dir/elf/dl-brk.os $build_dir/elf/dl-sbrk.os $build_dir/elf/dl-getcwd.os $build_dir/elf/dl-openat64.os $build_dir/elf/dl-opendir.os