This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from autamus/add/binutils
adding binutils
- Loading branch information
Showing
3 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- old/opcodes/cr16-dis.c 2014-10-14 03:32:04.000000000 -0400 | ||
+++ new/opcodes/cr16-dis.c 2016-01-14 21:54:26.000000000 -0500 | ||
@@ -78,7 +78,7 @@ | ||
REG_ARG_TYPE; | ||
|
||
/* Current opcode table entry we're disassembling. */ | ||
-const inst *instruction; | ||
+extern const inst *instruction; | ||
/* Current instruction we're disassembling. */ | ||
ins cr16_currInsn; | ||
/* The current instruction is read into 3 consecutive words. */ | ||
@@ -86,12 +86,12 @@ | ||
/* Contains all words in appropriate order. */ | ||
ULONGLONG cr16_allWords; | ||
/* Holds the current processed argument number. */ | ||
-int processing_argument_number; | ||
+extern int processing_argument_number; | ||
/* Nonzero means a IMM4 instruction. */ | ||
int imm4flag; | ||
/* Nonzero means the instruction's original size is | ||
incremented (escape sequence is used). */ | ||
-int size_changed; | ||
+extern int size_changed; | ||
|
||
|
||
/* Print the constant expression length. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
import sys | ||
|
||
|
||
class Binutils(AutotoolsPackage, GNUMirrorPackage): | ||
"""GNU binutils, which contain the linker, assembler, objdump and others""" | ||
|
||
homepage = "http://www.gnu.org/software/binutils/" | ||
gnu_mirror_path = "binutils/binutils-2.28.tar.bz2" | ||
|
||
version('2.36.1', sha256='5b4bd2e79e30ce8db0abd76dd2c2eae14a94ce212cfc59d3c37d23e24bc6d7a3') | ||
version('2.35.2', sha256='cfa7644dbecf4591e136eb407c1c1da16578bd2b03f0c2e8acdceba194bb9d61') | ||
version('2.35.1', sha256='320e7a1d0f46fcd9f413f1046e216cbe23bb2bce6deb6c6a63304425e48b1942') | ||
version('2.35', sha256='7d24660f87093670738e58bcc7b7b06f121c0fcb0ca8fc44368d675a5ef9cff7') | ||
version('2.34', sha256='89f010078b6cf69c23c27897d686055ab89b198dddf819efb0a4f2c38a0b36e6') | ||
version('2.33.1', sha256='0cb4843da15a65a953907c96bad658283f3c4419d6bcc56bf2789db16306adb2') | ||
version('2.32', sha256='de38b15c902eb2725eac6af21183a5f34ea4634cb0bcef19612b50e5ed31072d') | ||
version('2.31.1', sha256='ffcc382695bf947da6135e7436b8ed52d991cf270db897190f19d6f9838564d0') | ||
version('2.29.1', sha256='1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc') | ||
version('2.28', sha256='6297433ee120b11b4b0a1c8f3512d7d73501753142ab9e2daa13c5a3edd32a72') | ||
version('2.27', sha256='369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88') | ||
version('2.26', sha256='c2ace41809542f5237afc7e3b8f32bb92bc7bc53c6232a84463c423b0714ecd9') | ||
version('2.25.1', sha256='b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22') | ||
version('2.25', sha256='22defc65cfa3ef2a3395faaea75d6331c6e62ea5dfacfed3e2ec17b08c882923') | ||
version('2.24', sha256='e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137') | ||
version('2.23.2', sha256='fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097') | ||
version('2.20.1', sha256='71d37c96451333c5c0b84b170169fdcb138bbb27397dc06281905d9717c8ed64') | ||
|
||
variant('plugins', default=False, | ||
description="enable plugins, needed for gold linker") | ||
variant('gold', default=(sys.platform != 'darwin'), | ||
description="build the gold linker") | ||
variant('libiberty', default=False, description='Also install libiberty.') | ||
variant('nls', default=True, description='Enable Native Language Support') | ||
variant('headers', default=False, description='Install extra headers (e.g. ELF)') | ||
variant('lto', default=False, description='Enable lto.') | ||
variant('ld', default=False, description='Enable ld.') | ||
variant('interwork', default=False, description='Enable interwork.') | ||
|
||
patch('cr16.patch', when='@:2.29.1') | ||
patch('update_symbol-2.26.patch', when='@2.26') | ||
|
||
depends_on('zlib') | ||
depends_on('diffutils', type='build') | ||
depends_on('gettext', when='+nls') | ||
|
||
# Prior to 2.30, gold did not distribute the generated files and | ||
# thus needs bison, even for a one-time build. | ||
depends_on('m4', type='build', when='@:2.29.99 +gold') | ||
depends_on('bison', type='build', when='@:2.29.99 +gold') | ||
|
||
# 2.34 needs makeinfo due to a bug, see: | ||
# https://sourceware.org/bugzilla/show_bug.cgi?id=25491 | ||
depends_on('texinfo', type='build', when='@2.34') | ||
|
||
conflicts('+gold', when='platform=darwin', | ||
msg="Binutils cannot build linkers on macOS") | ||
|
||
def configure_args(self): | ||
spec = self.spec | ||
|
||
args = [ | ||
'--disable-dependency-tracking', | ||
'--disable-werror', | ||
'--enable-multilib', | ||
'--enable-shared', | ||
'--enable-64-bit-bfd', | ||
'--enable-targets=all', | ||
'--with-system-zlib', | ||
'--with-sysroot=/', | ||
] | ||
|
||
args += self.enable_or_disable('lto') | ||
args += self.enable_or_disable('ld') | ||
args += self.enable_or_disable('interwork') | ||
args += self.enable_or_disable('gold') | ||
args += self.enable_or_disable('plugins') | ||
|
||
if '+libiberty' in spec: | ||
args.append('--enable-install-libiberty') | ||
else: | ||
args.append('--disable-install-libiberty') | ||
|
||
if '+nls' in spec: | ||
args.append('--enable-nls') | ||
args.append('LDFLAGS=-lintl') | ||
else: | ||
args.append('--disable-nls') | ||
|
||
# To avoid namespace collisions with Darwin/BSD system tools, | ||
# prefix executables with "g", e.g., gar, gnm; see Homebrew | ||
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/binutils.rb | ||
if spec.satisfies('platform=darwin'): | ||
args.append('--program-prefix=g') | ||
|
||
return args | ||
|
||
# 2.36 is missing some dependencies and requires serial make install. | ||
# https://sourceware.org/bugzilla/show_bug.cgi?id=27482 | ||
@when('@2.36:') | ||
def install(self, spec, prefix): | ||
with working_dir(self.build_directory): | ||
make('-j', '1', *self.install_targets) | ||
|
||
@run_after('install') | ||
def install_headers(self): | ||
# some packages (like TAU) need the ELF headers, so install them | ||
# as a subdirectory in include/extras | ||
if '+headers' in self.spec: | ||
extradir = join_path(self.prefix.include, 'extra') | ||
mkdirp(extradir) | ||
# grab the full binutils set of headers | ||
install_tree('include', extradir) | ||
# also grab the headers from the bfd directory | ||
install(join_path(self.build_directory, 'bfd', '*.h'), | ||
extradir) | ||
|
||
def flag_handler(self, name, flags): | ||
# To ignore the errors of narrowing conversions for | ||
# the Fujitsu compiler | ||
if name == 'cxxflags' and ( | ||
self.spec.satisfies('@:2.31.1') and | ||
self.compiler.name in ('fj', 'clang', 'apple-clang') | ||
): | ||
flags.append('-Wno-narrowing') | ||
elif name == 'cflags': | ||
if self.spec.satisfies('@:2.34 %gcc@10:'): | ||
flags.append('-fcommon') | ||
return (flags, None, None) | ||
|
||
def test(self): | ||
spec_vers = str(self.spec.version) | ||
|
||
checks = { | ||
'ar': spec_vers, | ||
'c++filt': spec_vers, | ||
'coffdump': spec_vers, | ||
'dlltool': spec_vers, | ||
'elfedit': spec_vers, | ||
'gprof': spec_vers, | ||
'ld': spec_vers, | ||
'nm': spec_vers, | ||
'objdump': spec_vers, | ||
'ranlib': spec_vers, | ||
'readelf': spec_vers, | ||
'size': spec_vers, | ||
'strings': spec_vers, | ||
} | ||
|
||
for exe in checks: | ||
expected = checks[exe] | ||
reason = 'test: ensuring version of {0} is {1}' \ | ||
.format(exe, expected) | ||
self.run_test(exe, '--version', expected, installed=True, | ||
purpose=reason, skip_missing=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
From 544ddf9322b1b83982e5cb84a54d084ee7e718ea Mon Sep 17 00:00:00 2001 | ||
From: H.J. Lu <hjl.tools@gmail.com> | ||
Date: Wed, 24 Feb 2016 15:13:35 -0800 | ||
Subject: [PATCH] Update symbol version for symbol from linker script | ||
|
||
We need to update symbol version for symbols from linker script. | ||
|
||
Backport from master | ||
|
||
bfd/ | ||
|
||
PR ld/19698 | ||
* elflink.c (bfd_elf_record_link_assignment): Set versioned if | ||
symbol version is unknown. | ||
|
||
ld/ | ||
|
||
PR ld/19698 | ||
* testsuite/ld-elf/pr19698.d: New file. | ||
* testsuite/ld-elf/pr19698.s: Likewise. | ||
* testsuite/ld-elf/pr19698.t: Likewise. | ||
--- | ||
bfd/ChangeLog | 9 +++++++++ | ||
bfd/elflink.c | 13 +++++++++++++ | ||
ld/ChangeLog | 10 ++++++++++ | ||
ld/testsuite/ld-elf/pr19698.d | 10 ++++++++++ | ||
ld/testsuite/ld-elf/pr19698.s | 5 +++++ | ||
ld/testsuite/ld-elf/pr19698.t | 11 +++++++++++ | ||
6 files changed, 58 insertions(+), 0 deletions(-) | ||
create mode 100644 ld/testsuite/ld-elf/pr19698.d | ||
create mode 100644 ld/testsuite/ld-elf/pr19698.s | ||
create mode 100644 ld/testsuite/ld-elf/pr19698.t | ||
|
||
diff --git a/bfd/elflink.c b/bfd/elflink.c | ||
index ae8d148..8fcaadd 100644 | ||
--- a/bfd/elflink.c | ||
+++ b/bfd/elflink.c | ||
@@ -555,6 +555,19 @@ bfd_elf_record_link_assignment (bfd *output_bfd, | ||
if (h == NULL) | ||
return provide; | ||
|
||
+ if (h->versioned == unknown) | ||
+ { | ||
+ /* Set versioned if symbol version is unknown. */ | ||
+ char *version = strrchr (name, ELF_VER_CHR); | ||
+ if (version) | ||
+ { | ||
+ if (version > name && version[-1] != ELF_VER_CHR) | ||
+ h->versioned = versioned_hidden; | ||
+ else | ||
+ h->versioned = versioned; | ||
+ } | ||
+ } | ||
+ | ||
switch (h->root.type) | ||
{ | ||
case bfd_link_hash_defined: | ||
diff --git a/ld/testsuite/ld-elf/pr19698.d b/ld/testsuite/ld-elf/pr19698.d | ||
new file mode 100644 | ||
index 0000000..a39f67a | ||
--- /dev/null | ||
+++ b/ld/testsuite/ld-elf/pr19698.d | ||
@@ -0,0 +1,10 @@ | ||
+#ld: -shared $srcdir/$subdir/pr19698.t | ||
+#readelf : --dyn-syms --wide | ||
+#target: *-*-linux* *-*-gnu* *-*-solaris* | ||
+ | ||
+Symbol table '\.dynsym' contains [0-9]+ entries: | ||
+#... | ||
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +foo@VERS.1 | ||
+#... | ||
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ +foo@@VERS.2 | ||
+#pass | ||
diff --git a/ld/testsuite/ld-elf/pr19698.s b/ld/testsuite/ld-elf/pr19698.s | ||
new file mode 100644 | ||
index 0000000..875dca4 | ||
--- /dev/null | ||
+++ b/ld/testsuite/ld-elf/pr19698.s | ||
@@ -0,0 +1,5 @@ | ||
+ .text | ||
+ .globl foo | ||
+ .type foo, %function | ||
+foo: | ||
+ .byte 0 | ||
diff --git a/ld/testsuite/ld-elf/pr19698.t b/ld/testsuite/ld-elf/pr19698.t | ||
new file mode 100644 | ||
index 0000000..09d9125 | ||
--- /dev/null | ||
+++ b/ld/testsuite/ld-elf/pr19698.t | ||
@@ -0,0 +1,11 @@ | ||
+"foo@VERS.1" = foo; | ||
+ | ||
+VERSION { | ||
+VERS.2 { | ||
+ global: | ||
+ foo; | ||
+}; | ||
+ | ||
+VERS.1 { | ||
+}; | ||
+} | ||
-- | ||
1.7.1 | ||
|