Commit Graph

13 Commits

Author SHA1 Message Date
github-actions[bot]
263a89fa08
Merge master into staging-next 2023-11-08 12:01:20 +00:00
Adam Joseph
a738046341 Update pkgs/development/compilers/gcc/patches/default.nix 2023-11-08 10:50:07 +00:00
Randy Eckenrode
bec14225ab gcc{48,49,6,7,8,9,10}: fix missing symbol errors on x86_64-darwin
The x86_64-darwin build fails with the following symbol errors when
building gencondmd:

    Undefined symbols for architecture x86_64:
      "_ix86_excess_precision", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_ix86_fpmath", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_ix86_isa_flags", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_ix86_unsafe_math_optimizations", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o
      "_target_flags", referenced from:
          ___cxx_global_var_init.101 in gencondmd.o

This commit applies a workaround posted to the GCC BugZilla.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92061.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
93153208cc gcc{8,9}: don’t pass --gstabs to clang assembler
Darwin uses the clang integrated assembler, which does not support
`--gstabs`. While the `configure` script detects whether the assembler
supports it, Darwin passes `--gstabs` unconditionally. This patch is
backported to make the bootstrap only use it when supported.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
d4f8aac2c5 gcc{48,49,6}: don’t use -pipe with clang assembler
Older versions of GCC use `-pipe` on Darwin due to compatibility
problems with older cctools assemblers. Darwin now uses the clang
integrated assembler. While it is possible to pipe input into it, the
wrapper used in nixpkgs is not set up for it.

Fixing the wrapper would cause all of Darwin to rebuild, which is not
desirable, so just disable `-pipe` in the bootstrap configuration. The
clang integrated assembler doesn’t have the bug anyway.
2023-11-08 10:50:07 +00:00
Randy Eckenrode
e06f05d23c gcc11: fix build on aarch64-darwin
The libgcc configure script was middetecting aarch64-darwin and trying
to use a deployment target of 10.5, which is not valid for that
platform. The build was failing because the linker was looking for stubs
that don’t exist (neither as part of the source releases nor as part of
the official SDK from Apple).

Backporting the `config.host` check and `t-darwin-rpath` from GCC 12
allows GCC 11 to build again on aarch64-darwin.
2023-11-08 10:50:07 +00:00
Sergei Trofimovich
537176760c gcc12, gcc13: always mangle __FILE__ into invalid store path
Without the change `__FILE__` used in static inline functions in headers
embed paths to header files into executable images. For local headers
it's not a problem, but for headers in `/nix/store` this causes `-dev`
inputs to be retained in runtime closure.

Typical examples are `nix` -> `nlonhmann_json` and `pipewire` ->
`lttng-ust.dev`.

Ideally we would like to use `-fmacro-prefix-map=` feature of `gcc` as:

  -fmacro-prefix-map=/nix/store/$hash1-nlohmann-json-ver=/nix/store/eeee.eee-nlohmann-json-ver
  -fmacro-prefix-map=/nix/...

In practice it quickly exhausts argument lengtth limit due to `gcc`
deficiency: https://gcc.gnu.org/PR111527

Until it;s fixed let's hardcode header mangling if $NIX_STORE variable
is present in the environment.

Tested as:

    $ printf "# 0 \"/nix/store/01234567890123456789012345678901-pppppp-vvvvvvv\" \nconst char * f(void) { return __FILE__; }" | NIX_STORE=/nix/store ./gcc/xgcc -Bgcc -x c - -S -o -
    ...
    .string "/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-pppppp-vvvvvvv"
    ...

Mangled successfully.
2023-10-04 21:16:13 +01:00
Artturin
5c63f69ed2 gcc.patches: For gcc49 apply libsanitizer-no-cyclades-9 patch later
otherwise there is a conflict
2023-09-02 21:49:08 +03:00
Adam Joseph
62c676ce6f gcc: patches: reorganize and simplify
This PR sorts the huge pile of patches and deduplicates it.  Unlike
its predecessors https://github.com/NixOS/nixpkgs/pull/249707 and
https://github.com/NixOS/nixpkgs/pull/250489 this commit *does*
affect eval.

Patches below are organized into three general categories:

1. Patches relevant to gcc>=12 on every platform
2. Patches relevant to gcc>=12 on specific platforms
3. Patches relevant only to gcc<12, sorted by the newest version to
   which they might be relevant
2023-08-21 02:18:57 -07:00
Adam Joseph
b955304456 gcc: patches: fix patch name 2023-08-20 23:43:19 -07:00
Adam Joseph
39b20be057 gcc: resolve merge conflict from staging 2023-08-20 22:59:20 -07:00
Adam Joseph
869b639285 gcc: clean up version conditions 2023-08-20 22:59:20 -07:00
Adam Joseph
7367bb691d gcc: move patches attribute into patches/ subdirectory 2023-08-20 22:59:19 -07:00