live-bootstrap/steps/tcc-0.9.27/patches/dont-skip-weak-symbols-ar.patch
fosslinux a67db8fcbd Make patches relative to where tarballs are extracted
Ever since an old patch version, it has (for reasonable security
reasons) not supported patched with ../ in the filename.
Many of our patches have been relying on this behaviour being OK,
because we start off with an ancient patch version that didn't perform
such checks. As soon as we need this behaviour after we build a newer
patch though, we will have problems.

So, let's change the policy.
Patches are relative to where tarballs are extracted, rather than the
"working directory" - e.g. have patches for `coreutils-9.4/src/cp.c`
instead of `src/cp.c`.
Keeping this consistent has a few implications;
- patches are applied from the build/ directory in bash era now, with
  `-p0`
- when patches are manually applied in the bash era, use `-p` as
  required, usually `-p1`
- in kaem era where patches are always manually applied, `-p1` is used
2024-12-23 15:20:42 +11:00

50 lines
1.5 KiB
Diff

SPDX-FileCopyrightText: 2021 Alexander Sosedkin <monk@unboiled.info>
SPDX-License-Identifier: LGPL-2.0-or-later
From da11cf651576f94486dbd043dbfcde469e497574 Mon Sep 17 00:00:00 2001
From: Alexander Sosedkin <monk@unboiled.info>
Date: Sat, 30 Oct 2021 16:04:11 +0200
Subject: [PATCH] Don't skip weak symbols during ar creation
```
$ echo 'int __attribute__((__weak__)) f(void) { return 4; }' > w.c
$ tcc -c w.c -o w.o
$ tcc-old -ar rc w.a w.o; nm -s w.a # previous behaviour, not indexed
w.o:
0000000000000000 W f
$ ar rc w.a w.o; nm -s w.a # GNU binutils behaviour, indexed
Archive index:
f in w.o
0000000000000000 W f
$ tcc-new rc w.a w.o; nm -s w.a # new behaviour, indexed
Archive index:
f in w.o
0000000000000000 W f
```
---
tcctools.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tcctools.c b/tcctools.c
index cf174965..4567b81a 100644
--- tcc-0.9.27/tcctools.c
+++ tcc-0.9.27/tcctools.c
@@ -200,6 +200,9 @@ ST_FUNC int tcc_tool_ar(TCCState *s1, int argc, char **argv)
(sym->st_info == 0x10
|| sym->st_info == 0x11
|| sym->st_info == 0x12
+ || sym->st_info == 0x20
+ || sym->st_info == 0x21
+ || sym->st_info == 0x22
)) {
//printf("symtab: %2Xh %4Xh %2Xh %s\n", sym->st_info, sym->st_size, sym->st_shndx, strtab + sym->st_name);
istrlen = strlen(strtab + sym->st_name)+1;
--
2.11.4.GIT