validate #[link_name = "..."] & #[link(name = "...")] parameters#155817
validate #[link_name = "..."] & #[link(name = "...")] parameters#155817folkertdev wants to merge 1 commit intorust-lang:mainfrom
#[link_name = "..."] & #[link(name = "...")] parameters#155817Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
#[link_name = "..."] parameter#[link_name = "..."] & #[link(name = "...")] parameters
This comment has been minimized.
This comment has been minimized.
b94ed3f to
2ffa233
Compare
| #[link_name = "@GLIBC_2.2.5"] | ||
| pub safe fn exit_1(status: i32) -> !; //~ ERROR link name must be well-formed if link kind is `raw-dylib` |
There was a problem hiding this comment.
2ffa233 to
4338dfc
Compare
This comment has been minimized.
This comment has been minimized.
4338dfc to
5a5ae4c
Compare
This comment has been minimized.
This comment has been minimized.
specifically, do not allow NULL bytes and the empty string
5a5ae4c to
c08b9ab
Compare
|
Thanks @folkertdev for cleaning these up. @rfcbot fcp merge lang |
|
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
@rfcbot reviewed |
|
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. |
|
@bors r=mejrs rollup |
|
📋 This PR cannot be approved because it currently has the following label: |
|
@bors r=mejrs rollup |
…=mejrs validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters fixes rust-lang#155776 fixes rust-lang#155484 specifically, do not allow NULL bytes and the empty string in `#[link_name = "..."]` and `#[link(name = "...")]`. Like some of the others I think this formally needs to be looked at by T-lang because these errors would not show up if not linking. The LLVM erorr on `#[linke_name = "\0"]` is emitted here, it is not e.g. target-specific. https://github.com/llvm/llvm-project/blob/d593279c0b2891f0b0c8af3f70a1a0383b4ad1b5/llvm/lib/IR/Value.cpp#L336-L342 On `#[link(name = "")]` we already error today. A NULL byte in `#[link(name = "\0")]` is caught by the linker (https://godbolt.org/z/vnz9sYbPs), using `#[link_name = ""]` makes LLVM generate a name (https://godbolt.org/z/1hWEo4cxf) which is not useful and likely to cause linker errors. r? jdonszelmann
Rollup of 5 pull requests Successful merges: - #148214 (Consider `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` to be equivalent to `T` for must use lint) - #149362 (Add Command::get_resolved_envs) - #155188 (Add regression test for issue 144329) - #155515 (error on empty `export_name`) - #155817 (validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters)
…=mejrs validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters fixes rust-lang#155776 fixes rust-lang#155484 specifically, do not allow NULL bytes and the empty string in `#[link_name = "..."]` and `#[link(name = "...")]`. Like some of the others I think this formally needs to be looked at by T-lang because these errors would not show up if not linking. The LLVM erorr on `#[linke_name = "\0"]` is emitted here, it is not e.g. target-specific. https://github.com/llvm/llvm-project/blob/d593279c0b2891f0b0c8af3f70a1a0383b4ad1b5/llvm/lib/IR/Value.cpp#L336-L342 On `#[link(name = "")]` we already error today. A NULL byte in `#[link(name = "\0")]` is caught by the linker (https://godbolt.org/z/vnz9sYbPs), using `#[link_name = ""]` makes LLVM generate a name (https://godbolt.org/z/1hWEo4cxf) which is not useful and likely to cause linker errors. r? jdonszelmann
fixes #155776
fixes #155484
specifically, do not allow NULL bytes and the empty string in
#[link_name = "..."]and#[link(name = "...")].Like some of the others I think this formally needs to be looked at by T-lang because these errors would not show up if not linking.
The LLVM erorr on
#[linke_name = "\0"]is emitted here, it is not e.g. target-specific.https://github.com/llvm/llvm-project/blob/d593279c0b2891f0b0c8af3f70a1a0383b4ad1b5/llvm/lib/IR/Value.cpp#L336-L342
On
#[link(name = "")]we already error today. A NULL byte in#[link(name = "\0")]is caught by the linker (https://godbolt.org/z/vnz9sYbPs), using#[link_name = ""]makes LLVM generate a name (https://godbolt.org/z/1hWEo4cxf) which is not useful and likely to cause linker errors.r? jdonszelmann