From f964859cf99dbc211a44b277907981586781c689 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Mon, 13 Oct 2025 15:40:57 +0300 Subject: [PATCH] sdcc: fix build with gcc15 - add patch from fedora changing signature from `elf()` to `elf(int)` in `aslink.h`: https://src.fedoraproject.org/rpms/sdcc/raw/4a7c2a7e32369461eb451fc6f4d678a010135afc/f/sdcc-4.4.0-aslink.patch Upstream issue: https://sourceforge.net/p/sdcc/bugs/3846/ Fixes build failure with gcc15: ``` lklex.c: In function 'skip': lkelf.c:857:1: error: conflicting types for 'elf'; have 'void(int)' 857 | elf (int i) | ^~~ In file included from lkelf.c:25: aslink.h:1315:25: note: previous declaration of 'elf' with type 'void(void)' 1315 | extern VOID elf(); | ^~~ lkout.c:115:17: error: too many arguments to function 'elf'; expected 0, have 1 115 | elf(i); | ^~~ ~ In file included from lkout.c:30: aslink.h:1315:25: note: declared here 1315 | extern VOID elf(); | ^~~ ``` --- pkgs/by-name/sd/sdcc/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/sd/sdcc/package.nix b/pkgs/by-name/sd/sdcc/package.nix index d96e7a988215..c1f3dc77015d 100644 --- a/pkgs/by-name/sd/sdcc/package.nix +++ b/pkgs/by-name/sd/sdcc/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchurl, + fetchpatch, autoconf, bison, boost, @@ -70,6 +71,16 @@ stdenv.mkDerivation (finalAttrs: { gputils ]; + patches = [ + # Fix build with gcc15 + # https://sourceforge.net/p/sdcc/bugs/3846/ + (fetchpatch { + name = "sdcc-fix-aslink-elf-signature.patch"; + url = "https://src.fedoraproject.org/rpms/sdcc/raw/4a7c2a7e32369461eb451fc6f4d678a010135afc/f/sdcc-4.4.0-aslink.patch"; + hash = "sha256-xGilNetecPBj2VV3ebmln5BKqs3OoWFf6y2S3TBTHMQ="; + }) + ]; + # sdcc 4.5.0 massively rewrote sim/ucsim/Makefile.in, and lost the `.PHONY` # rule in the process. As a result, on macOS (which uses a case-insensitive # filesystem), the INSTALL file keeps the `install` target in the ucsim