Skip to content

support -e entry flag #378

@TheButlah

Description

@TheButlah

Disclaimer: I am a linker noob, there may be factual inaccuracies in my post.

I am attempting to build some OP-TEE Trusted Applet code, which targets aarch64-unknown-linux-gnu. I can do this successfully from my aarch64 laptop using regular cargo build. But if I attempt to use cargo zigbuild, I get an error:

[INFO ] error: linking with `/home/foobar/.cache/cargo-zigbuild/0.20.0/zigcc-aarch64-unknown-linux-gnu-7902.sh` failed: exit status: 1
[INFO ]   |
[INFO ]   = note:  "/home/foobar/.cache/cargo-zigbuild/0.20.0/zigcc-aarch64-unknown-linux-gnu-7902.sh" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "-lutee" "-lutils" "/tmp/nix-shell.KCr8aT/rustcn3p3cV/liboptee_utee_sys-d570a50e488e6533.rlib" "/home/foobar/orb-software/optee/target/aarch64-unknown-linux-gnu/artifact/deps/libcompiler_builtins-75024177c013f69b.rlib" "-L" "/tmp/nix-shell.KCr8aT/rustcn3p3cV/raw-dylibs" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/foobar/orb-software/optee/target/aarch64-unknown-linux-gnu/artifact/build/orb-secure-storage-ta-809a613a6e90caab/out" "-L" "/nix/store/2kiqs9i1jyhq2y19z402xmj112jlz119-optee-os-vexpress-aarch64-unknown-linux-gnu-4.6.0-devkit/lib" "-L" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/home/foobar/orb-software/optee/target/aarch64-unknown-linux-gnu/artifact/deps/orb_secure_storage_ta-2f59e169d44f48ef" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-all" "-nodefaultlibs" "-T/home/foobar/orb-software/optee/target/aarch64-unknown-linux-gnu/artifact/build/orb-secure-storage-ta-809a613a6e90caab/out/ta.lds" "-e__ta_entry" "-pie" "-Os" "-Wl,--sort-section=alignment" "-Wl,--dynamic-list=dyn_list"
[INFO ]   = note: some arguments are omitted. use `--verbose` to show all linker arguments
[INFO ]   = note: error: Unknown Clang option: '-e__ta_entry'
[INFO ]
[INFO ]
[INFO ] error: could not compile `orb-secure-storage-ta` (bin "orb-secure-storage-ta") due to 1 previous error

I believe this is due to the -e__ta_entry flag, which is supposed to set the entry point of the program to be this function. It is generated by a build script here.

Is it in scope for cargo-zigbuild to handle this gcc linker argument?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions