Skip to content

Commit 0be67ef

Browse files
BertalanDlinusg
authored andcommitted
Ports: Use the objcopy built as part of the toolchain
Relying on host tools working correctly is not a good idea, as they may be outdated (and therefore not support features like RELR relocations) or may not exist at all (like objcopy on macOS).
1 parent b3591d2 commit 0be67ef

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Ports/.hosted_defs.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if [ "$SERENITY_TOOLCHAIN" = "Clang" ]; then
99
export AR="llvm-ar"
1010
export RANLIB="llvm-ranlib"
1111
export READELF="llvm-readelf"
12+
export OBJCOPY="llvm-objcopy"
1213
export PATH="${SERENITY_SOURCE_DIR}/Toolchain/Local/clang/bin:${HOST_PATH}"
1314
else
1415
export SERENITY_BUILD_DIR="${SERENITY_SOURCE_DIR}/Build/${SERENITY_ARCH}"
@@ -17,6 +18,7 @@ else
1718
export AR="${SERENITY_ARCH}-pc-serenity-ar"
1819
export RANLIB="${SERENITY_ARCH}-pc-serenity-ranlib"
1920
export READELF="${SERENITY_ARCH}-pc-serenity-readelf"
21+
export OBJCOPY="${SERENITY_ARCH}-pc-serenity-objcopy"
2022
export PATH="${SERENITY_SOURCE_DIR}/Toolchain/Local/${SERENITY_ARCH}/bin:${HOST_PATH}"
2123
fi
2224

Ports/.port_include.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if [ -z "${HOST_CC:=}" ]; then
1212
export HOST_RANLIB="${RANLIB:=ranlib}"
1313
export HOST_PATH="${PATH:=}"
1414
export HOST_READELF="${READELF:=readelf}"
15+
export HOST_OBJCOPY="${OBJCOPY:=objcopy}"
1516
export HOST_PKG_CONFIG_DIR="${PKG_CONFIG_DIR:=}"
1617
export HOST_PKG_CONFIG_SYSROOT_DIR="${PKG_CONFIG_SYSROOT_DIR:=}"
1718
export HOST_PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR:=}"
@@ -49,6 +50,7 @@ host_env() {
4950
export RANLIB="${HOST_RANLIB}"
5051
export PATH="${HOST_PATH}"
5152
export READELF="${HOST_READELF}"
53+
export OBJCOPY="${HOST_OBJCOPY}"
5254
export PKG_CONFIG_DIR="${HOST_PKG_CONFIG_DIR}"
5355
export PKG_CONFIG_SYSROOT_DIR="${HOST_PKG_CONFIG_SYSROOT_DIR}"
5456
export PKG_CONFIG_LIBDIR="${HOST_PKG_CONFIG_LIBDIR}"
@@ -164,8 +166,8 @@ install_icon() {
164166
run convert "$icon[0]" -resize $icon_size "app-${icon_size}.png"
165167
fi
166168
done
167-
run objcopy --add-section serenity_icon_s="app-16x16.png" "${DESTDIR}${launcher}"
168-
run objcopy --add-section serenity_icon_m="app-32x32.png" "${DESTDIR}${launcher}"
169+
run $OBJCOPY --add-section serenity_icon_s="app-16x16.png" "${DESTDIR}${launcher}"
170+
run $OBJCOPY --add-section serenity_icon_m="app-32x32.png" "${DESTDIR}${launcher}"
169171
}
170172

171173
install_main_launcher() {

Ports/Super-Mario/package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ install() {
2121
if command -v convert >/dev/null; then
2222
run convert "app.ico[0]" app-16x16.png
2323
run convert "app.ico[1]" app-32x32.png
24-
run objcopy --add-section serenity_icon_s="app-16x16.png" "${SERENITY_INSTALL_ROOT}/opt/Super_Mario/uMario"
25-
run objcopy --add-section serenity_icon_m="app-32x32.png" "${SERENITY_INSTALL_ROOT}/opt/Super_Mario/uMario"
24+
run $OBJCOPY --add-section serenity_icon_s="app-16x16.png" "${SERENITY_INSTALL_ROOT}/opt/Super_Mario/uMario"
25+
run $OBJCOPY --add-section serenity_icon_m="app-32x32.png" "${SERENITY_INSTALL_ROOT}/opt/Super_Mario/uMario"
2626
fi
2727
}

0 commit comments

Comments
 (0)