Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Arm compatibility #23

Merged
merged 1 commit into from
Feb 11, 2022
Merged
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 .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variables:
# If these are set witih value and description, then it gives you UI elements
DOWNSTREAM_BRANCH:
value: "main"
description: "Run a specific datadog-reliability-env branch downstream"
description: "downstream jobs are triggered on this branch"

trigger_internal_build:
variables:
Expand Down
4 changes: 2 additions & 2 deletions ddprof-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ impl<'a> TryFrom<Slice<'a, u8>> for &'a str {
}
}

impl<'a> TryFrom<Slice<'a, c_char>> for &'a str {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the error I was facing

error[E0119]: conflicting implementations of trait std::convert::TryFrom<Slice<'_, u8>> for type &str:
--> ddprof-ffi/src/lib.rs:198:1
|
189 | impl<'a> TryFrom<Slice<'a, u8>> for &'a str {
| ------------------------------------------- first implementation here
...
198 | impl<'a> TryFrom<Slice<'a, c_char>> for &'a str {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for &str

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You read my mind. I think these two tactical change are sufficient since ARM uses unsigned char.

impl<'a> TryFrom<Slice<'a, i8>> for &'a str {
type Error = Utf8Error;

fn try_from(slice: Slice<'a, c_char>) -> Result<Self, Self::Error> {
fn try_from(slice: Slice<'a, i8>) -> Result<Self, Self::Error> {
// delegate to Slice<u8> implementation
let bytes = Slice::new(slice.ptr as *const u8, slice.len);
bytes.try_into()
Expand Down
4 changes: 2 additions & 2 deletions ffi-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ target="$(rustc -vV | awk '/^host:/ { print $2 }')"
# provided. At least on Alpine, libgcc_s may not even exist in the users'
# images, so -static-libgcc is recommended there.
case "$target" in
"x86_64-alpine-linux-musl")
"x86_64-alpine-linux-musl"|"aarch64-alpine-linux-musl")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that Linux is sufficiently general in terms of the x86 and ARM builds that handling both in the same section is appropriate.

expected_native_static_libs=" -lssp_nonshared -lgcc_s -lc"
native_static_libs=" -lssp_nonshared -lc"
;;
"x86_64-apple-darwin")
expected_native_static_libs=" -framework Security -liconv -lSystem -lresolv -lc -lm -liconv"
native_static_libs="${expected_native_static_libs}"
;;
"x86_64-unknown-linux-gnu")
"x86_64-unknown-linux-gnu"|"aarch64-unknown-linux-gnu")
expected_native_static_libs=" -ldl -lrt -lpthread -lgcc_s -lc -lm -lrt -lpthread -lutil -ldl -lutil"
native_static_libs=" -ldl -lrt -lpthread -lc -lm -lrt -lpthread -lutil -ldl -lutil"
;;
Expand Down