• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/binutils/2.25.1/911-xtensa-fix-localized-symbol-refcounting-with-gc-sect.patch
Gustavo ZacariasGustavo Zacarias committed a8fd20b5e6b28 Jul 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
From 8ec76b16f62d1bf386fb2c39af5f66c3afddc5cb Mon Sep 17 00:00:00 2001
2
From: Max Filippov <jcmvbkbc@gmail.com>
3
Date: Thu, 14 May 2015 05:22:55 +0300
4
Subject: [PATCH] xtensa: fix localized symbol refcounting with --gc-sections
5
​
6
elf_xtensa_gc_sweep_hook doesn't correctly unreference symbols that were
7
made local, that results in link failure with the following message:
8
​
9
  BFD (GNU Binutils) 2.24 internal error, aborting at elf32-xtensa.c line
10
  3372 in elf_xtensa_finish_dynamic_sections
11
​
12
elf_xtensa_gc_sweep_hook determines symbol reference type (PLT or GOT) by
13
relocation type. Relocation types are not changed when symbol becomes
14
local, but its PLT references are added to GOT references and
15
plt.refcount is set to 0. Such symbol cannot be unreferences in the
16
elf_xtensa_gc_sweep_hook and its extra references make calculated GOT
17
relocations section size not match number of GOT relocations.
18
​
19
Fix it by treating PLT reference as GOT reference when plt.refcount is
20
not positive.
21
​
22
2015-05-14  Max Filippov  <jcmvbkbc@gmail.com>
23
bfd/
24
    * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Treat PLT reference
25
    as GOT reference when plt.refcount is not positive.
26
​
27
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
28
---
29
Backported from: e6c9a083ec5ae7a45bd71682b26aae1939849388
30
Changes to ChangeLog are dropped.
31
​
32
 bfd/elf32-xtensa.c | 6 +++++-
33
 1 file changed, 5 insertions(+), 1 deletion(-)
34
​
35
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
36
index 53af1c6..2523670 100644
37
--- a/bfd/elf32-xtensa.c
38
+++ b/bfd/elf32-xtensa.c
39
@@ -1360,10 +1360,14 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
40
    {
41
      if (is_plt)
42
        {
43
+         /* If the symbol has been localized its plt.refcount got moved
44
+            to got.refcount.  Handle it as GOT.  */
45
          if (h->plt.refcount > 0)
46
        h->plt.refcount--;
47
+         else
48
+       is_got = TRUE;
49
        }
50
-     else if (is_got)
51
+     if (is_got)
52
        {
53
          if (h->got.refcount > 0)
54
        h->got.refcount--;
55
-- 
56
1.8.1.4
57
​
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.