annotate sources/sections/ccwrap.sh @ 1774:117f1c93212a draft

Teach sh2eb toolchain to produce flat binaries unless -melf argument supplied.
author Rob Landley <rob@landley.net>
date Thu, 25 Jun 2015 02:43:17 -0500
parents c11a357ea92d
children 398efd71a43e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1210
a36e985f6198 Untangle static vs cross for ccwrap section.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
1 # build and install gcc wrapper
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
1085
2e03f846b21e Build ccwrap static unless BUILD_STATIC=none or we're doing the simple cross compiler.
Rob Landley <rob@landley.net>
parents: 981
diff changeset
3 # Which compiler do we build the wrapper with, and should it be static?
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
1210
a36e985f6198 Untangle static vs cross for ccwrap section.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
5 [ "$BUILD_STATIC" == none ] && STATIC_FLAGS= || STATIC_FLAGS=--static
a36e985f6198 Untangle static vs cross for ccwrap section.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
6 [ -z "$HOST_ARCH" ] && TEMP="$CC" || TEMP="${HOST_ARCH}-cc"
1677
c11a357ea92d Second attempt: make dynamic linker match libc in ccwrap.
Rob Landley <rob@landley.net>
parents: 1675
diff changeset
7 LIBC_TYPE=musl
c11a357ea92d Second attempt: make dynamic linker match libc in ccwrap.
Rob Landley <rob@landley.net>
parents: 1675
diff changeset
8 [ ! -z "$UCLIBC_CONFIG" ] && [ -z "$MUSL" ] && LIBC_TYPE=uClibc
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
9
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 # Build wrapper binary
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
11
1664
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
12 mkdir -p "$STAGE_DIR/bin" &&
920
a69213462fbe If "$CCWRAP" is quoted it gets passed in as a blank argument when empty, confusing the compiler.
Rob Landley <rob@landley.net>
parents: 918
diff changeset
13 "$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \
1677
c11a357ea92d Second attempt: make dynamic linker match libc in ccwrap.
Rob Landley <rob@landley.net>
parents: 1675
diff changeset
14 -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS \
1774
117f1c93212a Teach sh2eb toolchain to produce flat binaries unless -melf argument supplied.
Rob Landley <rob@landley.net>
parents: 1677
diff changeset
15 -DDYNAMIC_LINKER=\"/lib/ld-${LIBC_TYPE}.so.0\" ${ELF2FLT:+-DELF2FLT} &&
1664
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
16 echo -e "#!/bin/bash\n\n${TOOLCHAIN_PREFIX}cc -E "'"$@"' \
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
17 > "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" &&
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
18 chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow