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

supporting other linkers #1

Open
japaric opened this issue Sep 14, 2020 · 4 comments
Open

supporting other linkers #1

japaric opened this issue Sep 14, 2020 · 4 comments
Labels
difficulty: medium Somewhat difficult to solve priority: low status: needs design This feature needs design work to move forward type: enhancement New feature or request

Comments

@japaric
Copy link
Member

japaric commented Sep 14, 2020

Unresolved questions

1. How to expose this feature?

Maybe a command line interface that looks like this:

flip-link $actual_linker_arguments --linker=arm-none-eabi-gcc 

Where --linker may appear in any position. flip-link will use arm-none-eabi-gcc as the linker.

This way the user species flip-link in their config.toml like this:

# .cargo/config.toml
rustflags = [
    "-C", "linker=flip-link",
    "-C", "link-arg=--linker=arm-none-eabi-gcc", # <- may appear in any position
    "-C", "linker-flavor=gcc", # <- not passed to the linker
    # ..
]

2. How to determine the linker flavor?

flip-link passes extra linker arguments to the underlying linker.
It currently assumes the linker flavor is "ld". If you want to use gcc those extra linker arguments need to be prefixed by -Wl, (iirc), i.e. -Wl,--defsym=something instead of just --defsym=something.
flip-link will not see the -C linker-flavor passed to rustc. Should the user also pass a --linker-flavor argument to flip-link?

japaric added a commit that referenced this issue Sep 18, 2020
@Urhengulas Urhengulas added the type: enhancement New feature or request label Feb 28, 2021
@Urhengulas Urhengulas added status: needs design This feature needs design work to move forward difficulty: medium Somewhat difficult to solve priority: low labels Mar 15, 2021
bors bot added a commit that referenced this issue Apr 12, 2021
32: Minimize deps r=Urhengulas a=Urhengulas

This PR disables the default features of the dependency `object`, which results in good gains in build time (debug: `-2.622s`; release: `-3.676s`) and binary size (debug: `-4.6MB`; release: `-69.3kB`) _(see results below)_.

It also updates and upgrades the other dependencies.

---
```command
# this pr
$ hyperfine -p 'cargo clean' 'cargo build' 'cargo build --release'
Benchmark #1: cargo build
  Time (mean ± σ):      6.959 s ±  0.216 s    [User: 38.446 s, System: 2.313 s]
  Range (min … max):    6.476 s …  7.200 s    10 runs
 
Benchmark #2: cargo build --release
  Time (mean ± σ):     12.412 s ±  0.209 s    [User: 102.318 s, System: 2.519 s]
  Range (min … max):   12.196 s … 12.907 s    10 runs
 
Summary
  'cargo build' ran
    1.78 ± 0.06 times faster than 'cargo build --release'

$ exa -lB target/debug/flip-link && exa -lB target/release/flip-link
.rwxr-xr-x@ 19,621,368 urhengulas 11 Apr 17:18 target/debug/flip-link
.rwxr-xr-x@ 4,460,304 urhengulas 11 Apr 17:18 target/release/flip-link

# main
$ hyperfine -p 'cargo clean' 'cargo build' 'cargo build --release'
Benchmark #1: cargo build
  Time (mean ± σ):      9.581 s ±  0.112 s    [User: 55.811 s, System: 3.263 s]
  Range (min … max):    9.355 s …  9.765 s    10 runs
 
Benchmark #2: cargo build --release
  Time (mean ± σ):     16.088 s ±  0.116 s    [User: 150.146 s, System: 3.622 s]
  Range (min … max):   15.909 s … 16.281 s    10 runs
 
Summary
  'cargo build' ran
    1.68 ± 0.02 times faster than 'cargo build --release'

$ exa -lB target/debug/flip-link && exa -lB target/release/flip-link
.rwxr-xr-x@ 24,227,272 urhengulas 11 Apr 17:18 target/debug/flip-link
.rwxr-xr-x@ 4,529,560 urhengulas 11 Apr 17:18 target/release/flip-link
```

Co-authored-by: Urhengulas <[email protected]>
@pwnorbitals
Copy link

Just pinging this issue as I believe it would be a very useful feature ! Thanks :)

@pwnorbitals
Copy link

https://app.bountysource.com/issues/110784469-supporting-other-linkers

@paulober
Copy link

Any updates on this? Or support for windows-gnu toolchain variant?

@Urhengulas
Copy link
Member

No update so far. If you want to give it a shot I am happy to support you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium Somewhat difficult to solve priority: low status: needs design This feature needs design work to move forward type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants