parent
fa5028ddee
commit
2ecd494691
@ -1,20 +0,0 @@ |
||||
--- a/src/mklibs-readelf/elf.cpp
|
||||
+++ b/src/mklibs-readelf/elf.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
using namespace Elf;
|
||||
|
||||
--- a/src/mklibs-readelf/main.cpp
|
||||
+++ b/src/mklibs-readelf/main.cpp
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <elf.h>
|
||||
#include <getopt.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
#include "elf.hpp"
|
||||
|
@ -0,0 +1,39 @@ |
||||
--- a/src/mklibs
|
||||
+++ b/src/mklibs
|
||||
@@ -509,10 +509,7 @@ while 1:
|
||||
num_unresolved = 0
|
||||
unresolved = set()
|
||||
for name in needed_symbols:
|
||||
- if not name in present_symbols:
|
||||
- debug(DEBUG_SPAM, "Still need: %s" % name)
|
||||
- unresolved.add(name)
|
||||
- num_unresolved = num_unresolved + 1
|
||||
+ library_symbols[library][name] = symbol
|
||||
|
||||
debug (DEBUG_NORMAL, `len(needed_symbols)`, "symbols,",
|
||||
`num_unresolved`, "unresolved")
|
||||
@@ -531,7 +528,6 @@ while 1:
|
||||
|
||||
library_symbols = {}
|
||||
library_symbols_used = {}
|
||||
- symbol_provider = {}
|
||||
|
||||
# WORKAROUND: Always add libgcc on old-abi arm
|
||||
header = elf_header(find_lib(libraries.copy().pop()))
|
||||
@@ -557,12 +553,10 @@ while 1:
|
||||
|
||||
# which symbols are actually used from each lib
|
||||
for name in needed_symbols:
|
||||
- if not name in symbol_provider:
|
||||
- if not needed_symbols[name].weak:
|
||||
- print "WARNING: Unresolvable symbol %s" % name
|
||||
- else:
|
||||
- lib = symbol_provider[name]
|
||||
- library_symbols_used[lib].add(library_symbols[lib][name])
|
||||
+ for lib in libraries:
|
||||
+ if name in library_symbols[lib]:
|
||||
+ library_symbols_used[lib].add(library_symbols[lib][name])
|
||||
+
|
||||
|
||||
# reduce libraries
|
||||
for library in libraries:
|
@ -1,33 +0,0 @@ |
||||
--- a/src/mklibs-readelf/main.cpp
|
||||
+++ b/src/mklibs-readelf/main.cpp
|
||||
@@ -57,6 +57,10 @@ static void process_elf_header (Elf::fil
|
||||
static void process_dynamics (Elf::file *file, int64_t tag)
|
||||
{
|
||||
const Elf::section_type<Elf::section_type_DYNAMIC> *section = file->get_section_DYNAMIC ();
|
||||
+
|
||||
+ if (!section)
|
||||
+ return;
|
||||
+
|
||||
for (std::vector<Elf::dynamic *>::const_iterator it = section->get_dynamics ().begin (); it != section->get_dynamics ().end (); ++it)
|
||||
{
|
||||
Elf::dynamic *dynamic = *it;
|
||||
@@ -67,6 +71,9 @@ static void process_dynamics (Elf::file
|
||||
|
||||
static void process_symbols_provided (const Elf::section_type<Elf::section_type_DYNSYM> *section)
|
||||
{
|
||||
+ if (!section)
|
||||
+ return;
|
||||
+
|
||||
for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
|
||||
{
|
||||
const Elf::symbol *symbol = *it;
|
||||
@@ -95,6 +102,9 @@ static void process_symbols_provided (co
|
||||
|
||||
static void process_symbols_undefined (const Elf::section_type<Elf::section_type_DYNSYM> *section)
|
||||
{
|
||||
+ if (!section)
|
||||
+ return;
|
||||
+
|
||||
for (std::vector<Elf::symbol *>::const_iterator it = section->get_symbols ().begin (); it != section->get_symbols ().end (); ++it)
|
||||
{
|
||||
const Elf::symbol *symbol = *it;
|
@ -1,32 +0,0 @@ |
||||
--- a/src/mklibs.py
|
||||
+++ b/src/mklibs.py
|
||||
@@ -507,7 +507,6 @@ while 1:
|
||||
|
||||
library_symbols = {}
|
||||
library_symbols_used = {}
|
||||
- symbol_provider = {}
|
||||
|
||||
# WORKAROUND: Always add libgcc on old-abi arm
|
||||
header = elf_header(find_lib(libraries.copy().pop()))
|
||||
@@ -525,17 +524,13 @@ while 1:
|
||||
library_symbols_used[library] = set()
|
||||
for symbol in symbols:
|
||||
for name in symbol.base_names():
|
||||
- if name in symbol_provider:
|
||||
- debug(DEBUG_SPAM, "duplicate symbol %s in %s and %s" % (symbol, symbol_provider[name], library))
|
||||
- else:
|
||||
- library_symbols[library][name] = symbol
|
||||
- symbol_provider[name] = library
|
||||
+ library_symbols[library][name] = symbol
|
||||
|
||||
# which symbols are actually used from each lib
|
||||
for name in needed_symbols:
|
||||
- if name in symbol_provider:
|
||||
- lib = symbol_provider[name]
|
||||
- library_symbols_used[lib].add(library_symbols[lib][name])
|
||||
+ for lib in libraries:
|
||||
+ if name in library_symbols[lib]:
|
||||
+ library_symbols_used[lib].add(library_symbols[lib][name])
|
||||
|
||||
# reduce libraries
|
||||
for library in libraries:
|
@ -1,6 +1,6 @@ |
||||
--- a/src/mklibs.py
|
||||
+++ b/src/mklibs.py
|
||||
@@ -571,6 +571,11 @@ while 1:
|
||||
--- a/src/mklibs
|
||||
+++ b/src/mklibs
|
||||
@@ -597,6 +597,11 @@ while 1:
|
||||
extra_post_obj.append(sysroot + libc_extras_dir + "/sofini.o")
|
||||
symbols.add(ProvidedSymbol('__dso_handle', None, None, True))
|
||||
|
@ -1,6 +1,6 @@ |
||||
--- a/src/mklibs.py
|
||||
+++ b/src/mklibs.py
|
||||
@@ -583,7 +583,7 @@ while 1:
|
||||
--- a/src/mklibs
|
||||
+++ b/src/mklibs
|
||||
@@ -609,7 +609,7 @@ while 1:
|
||||
# compile in only used symbols
|
||||
cmd = []
|
||||
cmd.extend(gcc_options)
|
@ -0,0 +1,20 @@ |
||||
--- a/src/mklibs-readelf/main.cpp
|
||||
+++ b/src/mklibs-readelf/main.cpp
|
||||
@@ -84,7 +84,7 @@ static void process_symbols_provided (co
|
||||
continue;
|
||||
if (shndx == SHN_UNDEF || shndx == SHN_ABS)
|
||||
continue;
|
||||
- if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_GNU_IFUNC && type != STT_COMMON && type != STT_TLS)
|
||||
+ if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_COMMON && type != STT_TLS)
|
||||
continue;
|
||||
if (!name.size())
|
||||
continue;
|
||||
@@ -115,7 +115,7 @@ static void process_symbols_undefined (c
|
||||
continue;
|
||||
if (shndx != SHN_UNDEF)
|
||||
continue;
|
||||
- if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_GNU_IFUNC && type != STT_COMMON && type != STT_TLS)
|
||||
+ if (type != STT_NOTYPE && type != STT_OBJECT && type != STT_FUNC && type != STT_COMMON && type != STT_TLS)
|
||||
continue;
|
||||
if (!name.size())
|
||||
continue;
|
Loading…
Reference in new issue