On Mon, Jun 15, 2020 at 6:59 AM Vijay Holimath via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > I need to apply this patch: > https://github.com/bespoke-silicon-group/bsg_manycore/blob/master/software/riscv-tools/newlib.patch > for > RISC-V and build compiler using crosstool-ng. Can you please tell me how to > do it? As Jonathan pointed out this is a crosstools-ng question not a gcc question. But crosstools-ng handles patches like many other tools (buildroot, open-embedded, etc). You just drop a numbered file into the package dir, and maybe update a patch file list if they have one. I don't think that crosstool-ng has a patch file list. So trying just dropping a file in the right place. See for instance packages/newlib/$VERSION and notice the 0* numbered patch list files. You need to know which newlib version you are building so that you put the patch file in the right place. But looking at the patch file, I see that it is a patch file for riscv-gnu-toolchain not for newlib. And the patch file is replacing newlib with their own newlib port. If you want to use crosstools-ng, and replace newlib with a different C library, then you need to make a change higher up in crosstools-ng. I don't know offhand how to do that. I would guess that you editing packages/newlib/package.desc to use the alternative git tree would work, but that isn't a clear way to implement this. You probably should add the new C library as a new package, with a description that points at the alternative git tree, and then change the config to use the alternative C library instead of newlib. If you really need to use this patch file, it is probably easier to just use github.com/riscv/riscv-gnu-toolchain. But the patch is from last year, so you might need to use a version of riscv-gnu-toolchain from last year. Jim