Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo asm does not handle $env:CARGO_TARGET_DIR being set #24

Closed
CAD97 opened this issue Aug 19, 2022 · 2 comments
Closed

cargo asm does not handle $env:CARGO_TARGET_DIR being set #24

CAD97 opened this issue Aug 19, 2022 · 2 comments

Comments

@CAD97
Copy link

CAD97 commented Aug 19, 2022

# pwsh session
PS> $env:CARGO_TARGET_DIR
D:\.rust\target

PS> cargo asm
    Finished release [optimized] target(s) in 0.00s
Error: Compilation produced no files satisfying .\deps\lib-*.s, this is a bug

PS> $env:CARGO_TARGET_DIR = $null

PS> cargo asm
    Finished release [optimized] target(s) in 0.00s
lib::add:
.Lfunc_begin0:
        .cv_func_id 0
        .cv_file        1 "D:\\git\\cad97\\playground\\src\\lib.rs" "9D57490222A66006B2F72186655C847E190625EB" 2
        .cv_loc 0 1 2 0
        lea eax, [rcx + rdx]
        .cv_loc 0 1 3 0
        ret
.Ltmp0:
.Lfunc_end0:
@CAD97
Copy link
Author

CAD97 commented Aug 19, 2022

The correct behavior is to check cargo metadata, which has a key for target_directory.

@pacak
Copy link
Owner

pacak commented Aug 20, 2022

Thank you for the report.

Should fixed, released a new version. Not using cargo metadata for now but will keep it in mind.

@pacak pacak closed this as completed Aug 20, 2022
pacak added a commit that referenced this issue Dec 28, 2023
feat: Optionally leave function names in asm listings unmangled.

Output of `cargo run -- --keep-mangled --lib -C symbol-mangling-version=v0  --asm 4` (shortened for brevity):
Without `--keep-mangled`:
```
	mov w0, #8
	mov w1, #24
	bl alloc::alloc::handle_alloc_error
```
With `--keep-mangled`:
```
	mov w0, #8
	mov w1, #24
	bl __ZN5alloc5alloc18handle_alloc_error17h04014ba8bc4ecf83E
```
With `--full-name`:
```
	mov w0, #8
	mov w1, #24
	bl alloc::alloc::handle_alloc_error::h04014ba8bc4ecf83
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants