[Bug gold/14091] Gold doesn't handle R_X86_64_64 properly for x32

2012-05-10 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14091

H.J. Lu  changed:

   What|Removed |Added

URL||http://sourceware.org/ml/bi
   ||nutils/2012-05/msg00126.htm
   ||l

--- Comment #1 from H.J. Lu  2012-05-11 04:08:46 
UTC ---
A patch is posted at

http://sourceware.org/ml/binutils/2012-05/msg00126.html

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/12488] plugins don't support linkonce

2012-05-10 Thread ian at airs dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=12488

--- Comment #7 from Ian Lance Taylor  2012-05-11 03:59:50 
UTC ---
This bug report is specifically about plugins and linkonce.  Please don't add
separate bug reports to this one.  Instead, open a new bug report.  Thanks.

Without a test case it's impossible to be sure, but I think "hidden symbol is
not defined locally" is more likely to be a GCC problem.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: Binutils v2.21.1a ARM mrs disassembler.

2012-05-10 Thread Bill Pringlemeir
On 10 May 2012, bprin...@sympatico.ca wrote:

On 10 May 2012, matthew.gretton-d...@arm.com wrote:
On Wed, May 09, 2012 at 05:14:56PM +0100, Bill Pringlemeir wrote:

>>> I have issues decoding 'mrs sp,spsr' with objdump for an ARM target.
>
>>>  :
>>> 0:   e14fd000.word   0xe14fd000
>
>>> I only pass '--disassemble'.  The objdump was built with
>
>> I cannot reproduce this behaviour with binutils built from plain FSF
>> sources.
>
>> Can you please provide a small test case showing the source passed
>> into the assembler; how the assembler is invoked; and how objdump is
>> invoked on the assembler's output?
>
> Thanks.  I also can not reproduce this will a small assembler files and
> object.  It has something to do with other instructions/headers in the
> object file.

[snip]

   $ ~/x-tools/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump -j 
'.vectors.irq' -S arm926ej-s-r0p3-microvisor.o  | head

   arm926ej-s-r0p3-microvisor.o: file format elf32-littlearm


   Disassembly of section .vectors.irq:

    :
  0:   e14fd000mrs sp, SPSR
  4:   e24ee004sub lr, lr, #4
  8:   e50fe008str lr, [pc, #-8]   ; 0 


   $ ~/x-tools/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump -S 
arm926ej-s-r0p3-microvisor.o  | grep -A3 -B10 ':'

   02cc :
2cc:   .word   0x
2d0:   e1a0nop ; (mov r0, r0)
2d4:   e1a0nop ; (mov r0, r0)
2d8:   e1a0nop ; (mov r0, r0)
2dc:   e1a0nop ; (mov r0, r0)

   Disassembly of section .vectors.irq:

    :
  0:   e14fd000.word   0xe14fd000
  4:   e24ee004sub lr, lr, #4
  8:   e50fe008str lr, [pc, #-8]   ; 0 

The previous section seems to play some sort of issue.

Fwiw,
Bill Pringlemeir.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: Binutils v2.21.1a ARM mrs disassembler.

2012-05-10 Thread Bill Pringlemeir
On 10 May 2012, matthew.gretton-d...@arm.com wrote:
On Wed, May 09, 2012 at 05:14:56PM +0100, Bill Pringlemeir wrote:

>> I have issues decoding 'mrs sp,spsr' with objdump for an ARM target.
 
>>  :
>>0:   e14fd000.word   0xe14fd000
 
>> I only pass '--disassemble'.  The objdump was built with

> I cannot reproduce this behaviour with binutils built from plain FSF
> sources.

> Can you please provide a small test case showing the source passed
> into the assembler; how the assembler is invoked; and how objdump is
> invoked on the assembler's output?

Thanks.  I also can not reproduce this will a small assembler files and
object.  It has something to do with other instructions/headers in the
object file.

The project is the OKL4 'microvisor'.  It was compiled with a
CodeSourcery tool set.

$ /opt/arm-2009q1/arm-none-eabi/bin/gcc --version
gcc (Sourcery G++ Lite 2009q1-161) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The copyright to the source is not owned by me, so I can not post that.
I tried to get a reduced file that exhibits this.  The project is made
up of mixed assembler and c, with many '.section' definitions and many
'C' routines that are marked 'no_return'.

It seems that 'interrupt.o' disassembles correctly, but a partially
relocated object files does not [ a bsp/soc library and other modules
are linked to produce a final binary].

Here are the build commands,

$CC --std=gnu99 -O2 -g -nostdlib -nostdinc -fno-builtin-bzero
-fomit-frame-pointer -mword-relocations -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wundef -Wpointer-arith
-Wno-nonnull -Werror -Wnested-externs -march=armv5te -mcpu=arm926ej-s -x
assembler-with-cpp -DARM_PID_RELOC=1 -DARM_SHARED_DOMAINS=1
-DTHREAD_SAFE=1 -DTOOLCHAIN_GCC -DARCH_ARM -DENDIAN_LITTLE -D__ARMv__=5
-DARCH_ARMV5 -DARCH_VER=5 -DMAX_NUM_CPUS=1UL -DASM_MAX_NUM_CPUS=1
-DNDEBUG -DOKL4_KERNEL -DASSEMBLY -I$SRC_DIR/include
$SRC_DIR/arch/armv5/kernel/kernel_base/src/interrupt.spp -c -o
$OBJ_DIR/interrupt.o

$LD -N --strip-debug -r $OBJ_DIR/mmu_init.o $OBJ_DIR/vcpu_exception.o
$OBJ_DIR/linux_helpers.o $OBJ_DIR/vcpu_syscall.o $OBJ_DIR/user_write.o
$OBJ_DIR/copy_in_buf.o $OBJ_DIR/copy_out_buf.o $OBJ_DIR/user_read.o
$OBJ_DIR/copy_in.o $OBJ_DIR/copy_out.o $OBJ_DIR/channel_copy_from_user.o
$OBJ_DIR/channel_copy_to_user.o $OBJ_DIR/fault.o $OBJ_DIR/init.o
$OBJ_DIR/exception.o $OBJ_DIR/atomic.o $OBJ_DIR/switch_to.o
$OBJ_DIR/vectors.o $OBJ_DIR/syscall.o $OBJ_DIR/rvct.o
$OBJ_DIR/preemption-rvct.o $OBJ_DIR/linker-rvct.o $OBJ_DIR/phys_reloc.o
$OBJ_DIR/interrupt.o $OBJ_DIR/elfweaver_info.o $OBJ_DIR/kernel.o
--start-group $( $CC --std=gnu99 -O2 -g -nostdlib -nostdinc
-fno-builtin-bzero -fomit-frame-pointer -mword-relocations -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wundef
-Wpointer-arith -Wno-nonnull -Werror -Wnested-externs -march=armv5te
-mcpu=arm926ej-s --print-libgcc-file-name)  --end-group -o
$BIN_DIR/arm926ej-s-r0p3-microvisor.o

Where $LD and $CC are codesourcery v4.3.3/2009q1-161 binaries for x86
Linux.  The host is Ubuntu x86_64.

I understand if no one cares about this.  I was concerned I found
a simple issue in the decoder.  I think arm-dis.c,

  {ARM_EXT_V3, 0x0100, 0x0fb00cff, "mrs%c\t%12-15R, %R"},

should be doing the decoding.  It seems to be fine for most objects.

Fwiw,
Bill Pringlemeir.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/14091] Gold doesn't handle R_X86_64_64 properly for x32

2012-05-10 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14091

H.J. Lu  changed:

   What|Removed |Added

Summary|Gold doesn't handle |Gold doesn't handle
   |R_X86_64_RELATIVE properly  |R_X86_64_64 properly for
   |for x32 |x32

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/14091] New: Gold doesn't handle R_X86_64_RELATIVE properly for x32

2012-05-10 Thread hjl.tools at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=14091

 Bug #: 14091
   Summary: Gold doesn't handle R_X86_64_RELATIVE properly for x32
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: hjl.to...@gmail.com
CC: ccout...@google.com
Classification: Unclassified


[hjl@gnu-6 gold]$ cat main.c 
extern void foo (void);

int
main (void)
{
  foo ();
  return 0;
}
[hjl@gnu-6 gold]$ cat tst-quadmod2.S
#define BIAS 0x7fff

.section.data.rel.local,"aw",@progbits
.align 8
.Ljmp:
.quadfunc + BIAS
.text
.typefunc, @function
func:
.cfi_startproc
xorl%edi, %edi
jmpexit@PLT
.cfi_endproc
.sizefunc, .-func
.globlfoo
.typefoo, @function
foo:
.cfi_startproc
.cfi_def_cfa_register 6
movq.Ljmp(%rip), %rax
subq$BIAS, %rax
jmp*%rax
.cfi_endproc
.sizefoo, .-foo
[hjl@gnu-6 gold]$ make
gcc -B./ -mx32 -g   -c -o main.o main.c
gcc -B./ -mx32 -c -g -o tst-quadmod2.o tst-quadmod2.S
./ld -shared -m elf32_x86_64 -o libtst-quadmod2.so tst-quadmod2.o
gcc -B./ -mx32 -g -o x2 main.o libtst-quadmod2.so -Wl,-rpath,.
./readelf -r --wide libtst-quadmod2.so

Relocation section '.rela.dyn' at offset 0x164 contains 1 entries:
 Offset InfoTypeSym. Value  Symbol's Name + Addend
12f0  0008 R_X86_64_RELATIVE  7fff01a0

Relocation section '.rela.plt' at offset 0x170 contains 1 entries:
 Offset InfoTypeSym. Value  Symbol's Name + Addend
12e8  0107 R_X86_64_JUMP_SLOT    exit + 0
./x2
make: *** [all] Segmentation fault
[hjl@gnu-6 gold]$ 

The problem is

[hjl@gnu-6 gold]$ readelf -rW tst-quadmod2.o
...
 Offset InfoTypeSym. Value  Symbol's Name + Addend
  0101 R_X86_64_64   .text + 7fff

Symbol value + addend > 32bits at run-time.  BFD linker generates:

[hjl@gnu-6 gold]$ make LD=ld
gcc -B./ -mx32 -g   -c -o main.o main.c
gcc -B./ -mx32 -c -g -o tst-quadmod2.o tst-quadmod2.S
ld -shared -m elf32_x86_64 -o libtst-quadmod2.so tst-quadmod2.o
gcc -B./ -mx32 -g -o x2 main.o libtst-quadmod2.so -Wl,-rpath,.
./readelf -r --wide libtst-quadmod2.so

Relocation section '.rela.dyn' at offset 0x158 contains 1 entries:
 Offset InfoTypeSym. Value  Symbol's Name + Addend
002002b0  0026 R_X86_64_RELATIVE64 7fff0190

Relocation section '.rela.plt' at offset 0x164 contains 1 entries:
 Offset InfoTypeSym. Value  Symbol's Name + Addend
[hjl@gnu-6 gold]$ 

The difference is R_X86_64_RELATIVE64 vs R_X86_64_RELATIVE.  For
R_X86_64_64, we need to generate R_X86_64_RELATIVE64.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: Binutils v2.21.1a ARM mrs disassembler.

2012-05-10 Thread Matthew Gretton-Dann
On Wed, May 09, 2012 at 05:14:56PM +0100, Bill Pringlemeir wrote:
> 
> I have issues decoding 'mrs sp,spsr' with objdump for an ARM target.
> 
>  :
>0:   e14fd000.word   0xe14fd000
> 
> I only pass '--disassemble'.  The objdump was built with
> 'crosstool-ng'.  Here are my configure args.
> 
> [INFO ]  Installing binutils
> [EXTRA]Configuring binutils
> [DEBUG]Extra config passed: '--enable-ld=default --enable-gold=yes
> --enable-plugins --with-pkgversion=crosstool-NG hg+-c7fa97debb36
> --disable-multilib --disable-nls'
> [DEBUG]==> Executing: 'CFLAGS= -pipe ' 'CXXFLAGS= -pipe '
> '/home/bpringlemeir/crosstool-arm-4.6.3/.build/src/binutils-2.21.1a/configure'
> '--build=x86_64-build_unknown-linux-gnu'
> '--host=x86_64-build_unknown-linux-gnu'
> '--target=arm-none-linux-gnueabi'
> '--prefix=/home/bpringlemeir/x-tools/arm-none-linux-gnueabi'
> '--disable-werror' '--enable-ld=default' '--enable-gold=yes'
> '--enable-plugins' '--with-pkgversion=crosstool-NG hg+-c7fa97debb36'
> '--disable-multilib' '--disable-nls' '--with-float=soft'
> '--with-sysroot=/home/bpringlemeir/x-tools/arm-none-linux-gnueabi/arm-none-linux-gnueabi/sysroot'
>  
> 
> Here is objdump --version...
> 
>GNU objdump (crosstool-NG hg+-c7fa97debb36) 2.21.1
>Copyright 2011 Free Software Foundation, Inc.
>This program is free software; you may redistribute it under the terms
>of the GNU General Public License version 3 or (at your option) any
>later version.  This program has absolutely no warranty.
> 

I cannot reproduce this behaviour with binutils built from plain FSF
sources.

Can you please provide a small test case showing the source passed into the
assembler; how the assembler is invoked; and how objdump is invoked on the
assembler's output?

Thanks,

Matt

-- 
Matthew Gretton-Dann
Principal Engineer, PD Software, ARM Ltd.


___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/14088] Strange addend from readelf

2012-05-10 Thread sch...@linux-m68k.org
http://sourceware.org/bugzilla/show_bug.cgi?id=14088

--- Comment #1 from Andreas Schwab  2012-05-10 08:00:19 
UTC ---
Displaying it as a decimal number would be much less useful.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/12488] plugins don't support linkonce

2012-05-10 Thread vincenzo.innocente at cern dot ch
http://sourceware.org/bugzilla/show_bug.cgi?id=12488

Vincenzo Innocente  changed:

   What|Removed |Added

 CC||vincenzo.innocente at cern
   ||dot ch

--- Comment #6 from Vincenzo Innocente  
2012-05-10 07:14:48 UTC ---
with
GNU gold (GNU Binutils 2.21.1) 1.11
and
gcc-4_7-branch revision 187326

with linker-plugin enabled I get this type of errors
ld: error: hidden symbol
'_ZThn16_N5boost16exception_detail10clone_implINS0_19error_info_injectorISt11logic_errorEEED0Ev'
is not defined locally
ld: /tmp/innocent/ccggD26x.ltrans8.ltrans.o: in function
_ZTVN5boost16exception_detail10clone_implINS0_19error_info_injectorISt11logic_error.local.4390:ccggD26x.ltrans8.o(.data.rel.ro+0x1558):
warning: relocation refers to discarded section
does not occur w/o linker-plugin

is the problem on gcc or gold side?
(posted also on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47247)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils