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

fix: CMSG_HEADER_ALIGNMENT was not properly equal to the C Header file in illumos #3171

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

Toasterson
Copy link
Contributor

A small fix for illumos so we can add more archs to the definition. This aligns the defintions in libc with the corresponding C Headers.

I ran all the steps it asked me and only got an issue with cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics although that seems to me like I am using a different gcc that CI.

This is part of the ARM work goin on at the moment.
CC: @richlowe and @jclulow for coordination.

…e in illumos

Signed-off-by: Till Wegmueller <toasterson@gmail.com>
@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2023

Some changes occurred in solarish module

cc @jclulow, @pfmooney

@JohnTitor
Copy link
Member

This doesn't seem to be harmful but I'd like to hear @jclulow and/or @pfmooney's views just in case.

@pfmooney
Copy link
Contributor

pfmooney commented Apr 3, 2023

@Toasterson Have you run the libc tests with this change on x86 (and if it's functional, the in-progress ARM platform)?

@pfmooney
Copy link
Contributor

pfmooney commented Apr 3, 2023

This doesn't seem to be harmful but I'd like to hear @jclulow and/or @pfmooney's views just in case.

I'm content with the change, so long as the tests are still clean on illumos.

@Toasterson
Copy link
Contributor Author

So Originally I tested by Compiling the ARM rustc cross compiler and compiling my Rust programs for aarch64. (The rustc aarch64 target-spec is waiting for this PR to complete)

I now ran the tests and found a bug in the tests. GCC tries to compile a main.c file to get native_getpwent_r but that fails.

I get

   Compiling libc-test v0.2.140 (/ws/toasty/rust-libc/libc-test)
The following warnings were emitted during compilation:

warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getpwent_r':
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24289:24: error: 'native_getpwent_r' undeclared (first use in this function)
warning: 24289 |                 return native_getpwent_r;
warning:       |                        ^~~~~~~~~~~~~~~~~
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24289:24: note: each undeclared identifier is reported only once for each function it appears in
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getgrent_r':
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24294:24: error: 'native_getgrent_r' undeclared (first use in this function)
warning: 24294 |                 return native_getgrent_r;
warning:       |                        ^~~~~~~~~~~~~~~~~
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getpwent_r':
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24290:13: error: control reaches end of non-void function [-Werror=return-type]
warning: 24290 |             }
warning:       |             ^
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getgrent_r':
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24295:13: error: control reaches end of non-void function [-Werror=return-type]
warning: 24295 |             }
warning:       |             ^
warning: /ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: At top level:
warning: cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
warning: cc1: all warnings being treated as errors

error: failed to run custom build command for `libc-test v0.2.140 (/ws/toasty/rust-libc/libc-test)`

Caused by:
  process didn't exit successfully: `/ws/toasty/.cargo-target/debug/build/libc-test-248b631f5c35cebb/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-illumos")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-illumos")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-illumos
  CC_x86_64-unknown-illumos = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_illumos
  CC_x86_64_unknown_illumos = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-illumos
  CFLAGS_x86_64-unknown-illumos = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_illumos
  CFLAGS_x86_64_unknown_illumos = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-D_XOPEN_SOURCE=700" "-o" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/src/cmsg.o" "-c" "src/cmsg.c"
  exit status: 0
  cargo:rerun-if-env-changed=AR_x86_64-unknown-illumos
  AR_x86_64-unknown-illumos = None
  cargo:rerun-if-env-changed=AR_x86_64_unknown_illumos
  AR_x86_64_unknown_illumos = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-illumos
  ARFLAGS_x86_64-unknown-illumos = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_illumos
  ARFLAGS_x86_64_unknown_illumos = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  running: "gar" "cq" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/libcmsg.a" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/src/cmsg.o"
  exit status: 0
  running: "gar" "s" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/libcmsg.a"
  exit status: 0
  cargo:rustc-link-lib=static=cmsg
  cargo:rustc-link-search=native=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out
  -----------------------------------------
  cargo:rerun-if-changed=../src/lib.rs
  cargo:rerun-if-changed=../src/macros.rs
  cargo:rerun-if-changed=../src/fixed_width_ints.rs
  cargo:rerun-if-changed=../src/unix/mod.rs
  cargo:rerun-if-changed=../src/unix/solarish/mod.rs
  cargo:rerun-if-changed=../src/unix/solarish/compat.rs
  cargo:rerun-if-changed=../src/unix/solarish/illumos.rs
  cargo:rerun-if-changed=../src/unix/solarish/x86_64.rs
  cargo:rerun-if-changed=../src/unix/solarish/x86_common.rs
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-illumos")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-illumos
  CC_x86_64-unknown-illumos = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_illumos
  CC_x86_64_unknown_illumos = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-illumos
  CFLAGS_x86_64-unknown-illumos = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_illumos
  CFLAGS_x86_64_unknown_illumos = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-address-of-packed-member" "-Wno-unknown-warning-option" "-Wno-deprecated-declarations" "-Wno-deprecated-declarations" "-D_XOPEN_SOURCE=700" "-D__EXTENSIONS__" "-D_LCONV_C99" "-o" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/67cd148b4c1ea303-main.o" "-c" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c"
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getpwent_r':
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24289:24: error: 'native_getpwent_r' undeclared (first use in this function)
  cargo:warning=24289 |                 return native_getpwent_r;
  cargo:warning=      |                        ^~~~~~~~~~~~~~~~~
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24289:24: note: each undeclared identifier is reported only once for each function it appears in
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getgrent_r':
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24294:24: error: 'native_getgrent_r' undeclared (first use in this function)
  cargo:warning=24294 |                 return native_getgrent_r;
  cargo:warning=      |                        ^~~~~~~~~~~~~~~~~
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getpwent_r':
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24290:13: error: control reaches end of non-void function [-Werror=return-type]
  cargo:warning=24290 |             }
  cargo:warning=      |             ^
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: In function '__test_fn_native_getgrent_r':
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c:24295:13: error: control reaches end of non-void function [-Werror=return-type]
  cargo:warning=24295 |             }
  cargo:warning=      |             ^
  cargo:warning=/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c: At top level:
  cargo:warning=cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
  cargo:warning=cc1: all warnings being treated as errors
  exit status: 1

  --- stderr
  rust version: 1.65.0


  error occurred: Command "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-address-of-packed-member" "-Wno-unknown-warning-option" "-Wno-deprecated-declarations" "-Wno-deprecated-declarations" "-D_XOPEN_SOURCE=700" "-D__EXTENSIONS__" "-D_LCONV_C99" "-o" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/67cd148b4c1ea303-main.o" "-c" "/ws/toasty/.cargo-target/x86_64-unknown-illumos/debug/build/libc-test-9d9b3b050483f738/out/main.c" with args "gcc" did not execute successfully (status code exit status: 1).

@pfmooney did we recently change some things in the API's there? because the C file generated tries to find all the API's like automake does just all in one big C file. So there needs to be a header definition added to that file I think

@Toasterson
Copy link
Contributor Author

In general it seems wrong to me that the C file looks for native_* without linking them because without the native_ prefix the functions exist.

@JohnTitor
Copy link
Member

The failure seems unrelated anyway, @bors r=JohnTitor,pfmooney

@bors
Copy link
Contributor

bors commented Apr 19, 2023

📌 Commit 595c2ab has been approved by JohnTitor,pfmooney

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 19, 2023

⌛ Testing commit 595c2ab with merge 362b0d7...

bors added a commit that referenced this pull request Apr 19, 2023
fix: CMSG_HEADER_ALIGNMENT was not properly equal to the C Header file in illumos

A small fix for illumos so we can add more archs to the definition. This aligns the defintions in libc with the corresponding C Headers.

I ran all the steps it asked me and only got an issue with `cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics` although that seems to me like I am using a different gcc that CI.

This is part of the ARM work goin on at the moment.
CC: `@richlowe` and `@jclulow` for coordination.
@bors
Copy link
Contributor

bors commented Apr 19, 2023

💔 Test failed - checks-actions

@JohnTitor
Copy link
Member

 error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-1.25.0.toml.sha256' to '/Users/runner/.rustup/tmp/c5re5ggquj09ubvw_file': failed to make network request: error sending request for url (https://static.rust-lang.org/dist/channel-rust-1.25.0.toml.sha256): operation timed out: operation timed out

@bors retry

@bors
Copy link
Contributor

bors commented Apr 20, 2023

⌛ Testing commit 595c2ab with merge 79b7d3c...

@bors
Copy link
Contributor

bors commented Apr 20, 2023

☀️ Test successful - checks-actions, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13, checks-cirrus-freebsd-14
Approved by: JohnTitor,pfmooney
Pushing 79b7d3c to master...

@bors bors merged commit 79b7d3c into rust-lang:master Apr 20, 2023
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants