Skip to content

Commit

Permalink
Merge pull request #65 from emproof-com/chore/document-triples
Browse files Browse the repository at this point in the history
Add recommended triples to docs
  • Loading branch information
g0ldminer authored Jul 19, 2024
2 parents b0572f5 + 71a8234 commit e1e258c
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 11 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,22 @@ Then, `nyxstone` can be used from the command line. Here's an output of its help
$ ./nyxstone --help
Allowed options:
--help Show this message
--arch arg (=x86_64) LLVM triple or architecture identifier of triple,
for example "x86_64", "x86_64-linux-gnu", "armv8",
"armv8eb", "thumbv8", "aarch64"
--cpu arg LLVM cpu specifier, refer to `llc -march=ARCH
--arch arg (=x86_64) LLVM triple or architecture identifier of triple.
For the most common architectures, we recommend:
x86_32: `i686-linux-gnu`
x86_64: `x86_64-linux-gnu`
armv6m: `armv6m-none-eabi`
armv7m: `armv7m-none-eabi`
armv8m: `armv8m.main-none-eabi`
aarch64: `aarch64-linux-gnueabihf`
Using shorthand identifiers like `arm` can lead to
Nyxstone not being able to assemble certain
instructions.
--cpu arg LLVM cpu specifier, refer to `llc -mtriple=ARCH
-mcpu=help` for a comprehensive list
--features arg LLVM features to enable/disable, comma seperated
feature strings prepended by '+' or '-' toenable or
disable respectively. Refer to `llc -march=ARCH
feature strings prepended by '+' or '-' to enable or
disable respectively. Refer to `llc -mtriple=ARCH
-mattr=help` for a comprehensive list
--address arg (=0) Address
Expand Down
17 changes: 15 additions & 2 deletions bindings/rust/examples/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,21 @@ enum Command {
/// Rust CLI for Nyxstone
#[derive(Parser)]
struct Args {
/// Architecture LLVM triple or architecture identifier of triple, for example "x86_64", "x86_64-linux-gnu",
/// "armv8", "armv8eb", "thumbv8", "aarch64"
/// LLVM triple or architecture identifier of triple. For the most common architectures, we recommend:
///
/// - x86_32: `i686-linux-gnu`
///
/// - x86_64: `x86_64-linux-gnu`
///
/// - armv6m: `armv6m-none-eabi`
///
/// - armv7m: `armv7m-none-eabi`
///
/// - armv8m: `armv8m.main-none-eabi`
///
/// - aarch64: `aarch64-linux-gnueabihf`
///
/// Using shorthand identifiers like `arm` can lead to Nyxstone not being able to assemble certain instructions.
#[arg(short = 'a', long)]
architecture: String,

Expand Down
10 changes: 10 additions & 0 deletions bindings/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ impl Nyxstone {
/// - `target_triple`: Llvm target triple or architecture identifier of triple.
/// - `config`: Optional configuration for the `Nyxstone` instance.
///
/// # Note
/// For the most common architectures, we recommend the following triples:
/// - x86_32: `i686-linux-gnu`
/// - x86_64: `x86_64-linux-gnu`
/// - armv6m: `armv6m-none-eabi`
/// - armv7m: `armv7m-none-eabi`
/// - armv8m: `armv8m.main-none-eabi`
/// - aarch64: `aarch64-linux-gnueabihf`
/// Using shorthand identifiers like `arm` can lead to Nyxstone not being able to assemble certain instructions.
///
/// # Returns
/// Ok() and the Nyxstone instance on success, Err() otherwise.
///
Expand Down
13 changes: 10 additions & 3 deletions examples/nyxstone-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ int main(int argc, char** argv)
desc.add_options()
("help", "Show this message")
("arch", po::value<std::string>()->default_value("x86_64"),
"LLVM triple or architecture identifier of triple, for example "
R"("x86_64", "x86_64-linux-gnu", "armv8", "armv8eb", "thumbv8", "aarch64")")
"LLVM triple or architecture identifier of triple. For the most common architectures, we recommend:\n"
"x86_32: `i686-linux-gnu`\n"
"x86_64: `x86_64-linux-gnu`\n"
"armv6m: `armv6m-none-eabi`\n"
"armv7m: `armv7m-none-eabi`\n"
"armv8m: `armv8m.main-none-eabi`\n"
"aarch64: `aarch64-linux-gnueabihf`\n"
"Using shorthand identifiers like `arm` can lead to Nyxstone not being able to assemble certain instructions."
)
("cpu", po::value<std::string>()->default_value(""),
"LLVM cpu specifier, refer to `llc -mtriple=ARCH -mcpu=help` for a comprehensive list")
("features", po::value<std::string>()->default_value(""),
"LLVM features to enable/disable, comma seperated feature strings prepended by '+' or '-' to"
"LLVM features to enable/disable, comma seperated feature strings prepended by '+' or '-' to "
"enable or disable respectively. Refer to `llc -mtriple=ARCH -mattr=help` for a comprehensive list")
("address", po::value<std::string>()->default_value("0"), "Address")
;
Expand Down
10 changes: 10 additions & 0 deletions include/nyxstone.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ class NyxstoneBuilder {

/// @brief Creates a NyxstoneBuilder instance.
/// @param triple Llvm target triple or architecture identifier of a triple.
///
/// @note For the most common architectures, we recommend:
/// x86_32: `i686-linux-gnu`
/// x86_64: `x86_64-linux-gnu`
/// armv6m: `armv6m-none-eabi`
/// armv7m: `armv7m-none-eabi`
/// armv8m: `armv8m.main-none-eabi`
/// aarch64: `aarch64-linux-gnueabihf`
/// Using shorthand identifiers like `arm` can lead to Nyxstone not being able to assemble certain
/// instructions.
explicit NyxstoneBuilder(std::string&& triple)
: m_triple(std::move(triple)) {};
NyxstoneBuilder(const NyxstoneBuilder&) = default;
Expand Down

0 comments on commit e1e258c

Please sign in to comment.