python-cryptography: bump to version 1.7.2
[buildroot-gz.git] / package / gcc / 6.3.0 / 892-libgcc-mkmap-symver-support-skip_underscore.patch
blob73ee6c5faa186f3dceab31b574c543810d260609
1 From ae9c3e354440c4a0f105a9eabfb2f77be085ebc1 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Thu, 18 Aug 2016 17:59:16 +0200
4 Subject: [PATCH] libgcc/mkmap-symver: support skip_underscore
6 Some platforms, such as Blackfin, have a special prefix for assembly
7 symbols as opposed to C symbols. For this reason, a function named
8 "foo()" in C will in fact be visible as a symbol called "_foo" in the
9 ELF binary.
11 The current linker version script logic in libgcc doesn't take into
12 account this situation properly. The Blackfin specific
13 libgcc/config/bfin/libgcc-glibc.ver has an additional "_" in front of
14 every symbol so that it matches the output of "nm" (which gets parsed to
15 produce the final linker version script). But due to this additional
16 "_", ld no longer matches with the symbols since "ld" does the matching
17 with the original symbol name, not the one prefixed with "_".
19 Due to this, none of the symbols in libgcc/config/bfin/libgcc-glibc.ver
20 are actually matched with symbols in libgcc. This causes all libgcc
21 symbols to be left as "LOCAL", which causes lots of "undefined
22 reference" whenever some C or C++ code that calls a function of libgcc
23 is compiled.
25 To address this, this commit introduces a "skip_underscore" variable to
26 the mkmap-symver script. It tells mkmap-symver to ignore the leading
27 underscore from the "nm" output.
29 Note that this new argument is different from the existing
30 "leading_underscore" argument, which *adds* an additional underscore to
31 the generated linker version script.
33 Having this functionality paves the way to using the generic linker
34 version information for Blackfin, instead of using a custom one.
36 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
37 ---
38 libgcc/mkmap-symver.awk | 6 +++++-
39 1 file changed, 5 insertions(+), 1 deletion(-)
41 diff --git a/libgcc/mkmap-symver.awk b/libgcc/mkmap-symver.awk
42 index 266832a..30bb179 100644
43 --- a/libgcc/mkmap-symver.awk
44 +++ b/libgcc/mkmap-symver.awk
45 @@ -47,7 +47,11 @@ state == "nm" && ($1 == "U" || $2 == "U") {
47 state == "nm" && NF == 3 {
48 split ($3, s, "@")
49 - def[s[1]] = 1;
50 + if (skip_underscore)
51 + symname = substr(s[1], 2);
52 + else
53 + symname = s[1];
54 + def[symname] = 1;
55 sawsymbol = 1;
56 next;
58 --
59 2.7.4