summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorvonPalitroque2015-09-25 13:28:20 -0400
committervonPalitroque2015-09-25 13:28:20 -0400
commit69b896466dab2003e8dd005e9a9912bf126f493d (patch)
tree90f6590914fbfe35a4df3321662a1ecb67cba5c3
parentc0a773940ee217db35248778b0a81a1f146b5f94 (diff)
downloadaur-69b896466dab2003e8dd005e9a9912bf126f493d.tar.gz
Added missing libbfd patch.
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD10
-rw-r--r--bfd-fix.patch117
3 files changed, 126 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0c5df77a357..9b8f0528e93 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = msp430-elf-binutils
pkgdesc = GNU binary utilities for the msp430-elf target
pkgver = 2.25.1
- pkgrel = 1
+ pkgrel = 2
url = http://www.gnu.org/software/binutils/
arch = i686
arch = x86_64
@@ -11,7 +11,9 @@ pkgbase = msp430-elf-binutils
options = !libtool
options = !buildflags
source = ftp://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2
+ source = bfd-fix.patch
sha256sums = b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22
+ sha256sums = 1b5e879dbd9da83a8c7f86abac5cf706b8ba48e3f0525d893a53c651e4015124
pkgname = msp430-elf-binutils
diff --git a/PKGBUILD b/PKGBUILD
index 175c17d68cb..6205e45201b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@ pkgname=${_target}-binutils #-git
_pkgver=2.25.1
pkgver=${_pkgver}
#pkgver=2.25.r84308.c576455
-pkgrel=1
+pkgrel=2
pkgdesc="GNU binary utilities for the ${_target} target"
arch=(i686 x86_64)
options=('!libtool' '!buildflags')
@@ -20,8 +20,10 @@ depends=('zlib' 'flex')
# sha256sums=('SKIP')
# build from source
-source=(ftp://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2)
-sha256sums=('b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22')
+source=(ftp://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2
+ bfd-fix.patch)
+sha256sums=('b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22'
+ '1b5e879dbd9da83a8c7f86abac5cf706b8ba48e3f0525d893a53c651e4015124')
# pkgver() {
# cd "${srcdir}/binutils-${_pkgver}"
@@ -33,7 +35,7 @@ sha256sums=('b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22')
prepare() {
cd "${srcdir}/binutils-${_pkgver}"
# https://sourceware.org/bugzilla/show_bug.cgi?id=17940
- # patch -p1 < ../bfd-fix.patch
+ patch -p1 < ../bfd-fix.patch
# ensure a clean build
[[ -d binutils-build ]] && rm -rf binutils-build
mkdir binutils-build
diff --git a/bfd-fix.patch b/bfd-fix.patch
new file mode 100644
index 00000000000..a94ec4ac1da
--- /dev/null
+++ b/bfd-fix.patch
@@ -0,0 +1,117 @@
+diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
+index c839ea0..fdab3d3 100644
+--- a/bfd/elf32-msp430.c
++++ b/bfd/elf32-msp430.c
+@@ -1656,9 +1656,38 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr,
+ symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
+ isym = (Elf_Internal_Sym *) symtab_hdr->contents;
+ for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++)
+- if (isym->st_shndx == sec_shndx
+- && isym->st_value > addr && isym->st_value < toaddr)
+- isym->st_value -= count;
++ {
++ const char * name;
++
++ name = bfd_elf_string_from_elf_section
++ (abfd, symtab_hdr->sh_link, isym->st_name);
++ name = (name == NULL || * name == 0) ? bfd_section_name (abfd, sec) : name;
++
++ if (isym->st_shndx != sec_shndx)
++ continue;
++
++ if (isym->st_value > addr
++ && (isym->st_value < toaddr
++ /* We also adjust a symbol at the end of the section if its name is
++ on the list below. These symbols are used for debug info
++ generation and they refer to the end of the current section, not
++ the start of the next section. */
++ || (isym->st_value == toaddr
++ && name != NULL
++ && (CONST_STRNEQ (name, ".Letext")
++ || CONST_STRNEQ (name, ".LFE")))))
++ {
++ if (isym->st_value < addr + count)
++ isym->st_value = addr;
++ else
++ isym->st_value -= count;
++ }
++ /* Adjust the function symbol's size as well. */
++ else if (ELF_ST_TYPE (isym->st_info) == STT_FUNC
++ && isym->st_value + isym->st_size > addr
++ && isym->st_value + isym->st_size < toaddr)
++ isym->st_size -= count;
++ }
+
+ /* Now adjust the global symbols defined in this section. */
+ symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
+@@ -1674,7 +1703,19 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr,
+ && sym_hash->root.u.def.section == sec
+ && sym_hash->root.u.def.value > addr
+ && sym_hash->root.u.def.value < toaddr)
+- sym_hash->root.u.def.value -= count;
++ {
++ if (sym_hash->root.u.def.value < addr + count)
++ sym_hash->root.u.def.value = addr;
++ else
++ sym_hash->root.u.def.value -= count;
++ }
++ /* Adjust the function symbol's size as well. */
++ else if (sym_hash->root.type == bfd_link_hash_defined
++ && sym_hash->root.u.def.section == sec
++ && sym_hash->type == STT_FUNC
++ && sym_hash->root.u.def.value + sym_hash->size > addr
++ && sym_hash->root.u.def.value + sym_hash->size < toaddr)
++ sym_hash->size -= count;
+ }
+
+ return TRUE;
+diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h
+index 657dc1a..08115ac 100644
+--- a/gas/config/tc-msp430.h
++++ b/gas/config/tc-msp430.h
+@@ -159,7 +159,8 @@ extern bfd_boolean msp430_allow_local_subtract (expressionS *, expressionS *, se
+ linker, but this fix is simpler, and it pretty much only affects
+ object size a little bit. */
+ #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
+- (((SEC)->flags & SEC_CODE) != 0 \
++ ( ((SEC)->flags & SEC_CODE) != 0 \
++ || ((SEC)->flags & SEC_DEBUGGING) != 0 \
+ || ! SEG_NORMAL (SEC) \
+ || TC_FORCE_RELOCATION (FIX))
+
+@@ -169,4 +170,4 @@ extern bfd_boolean msp430_allow_local_subtract (expressionS *, expressionS *, se
+
+ #define DWARF2_USE_FIXED_ADVANCE_PC 1
+
+-#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_CODE)
++#define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING))
+diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
+index 5dfd980..9177bdf 100644
+--- a/gas/dwarf2dbg.c
++++ b/gas/dwarf2dbg.c
+@@ -1467,8 +1467,22 @@ out_header (asection *sec, expressionS *exp)
+ symbolS *end_sym;
+
+ subseg_set (sec, 0);
+- start_sym = symbol_temp_new_now ();
+- end_sym = symbol_temp_make ();
++#if 1
++ if (flag_dwarf_sections)
++ {
++ /* If we are going to put the start and end symbols in different
++ sections, then we need real symbols, not just fake, local ones. */
++ frag_now_fix ();
++ start_sym = symbol_make (".Ldebug_line_start");
++ end_sym = symbol_make (".Ldebug_line_end");
++ symbol_set_value_now (start_sym);
++ }
++ else
++#endif
++ {
++ start_sym = symbol_temp_new_now ();
++ end_sym = symbol_temp_make ();
++ }
+
+ /* Total length of the information. */
+ exp->X_op = O_subtract;
+