[Bug ld/11542] New: ld -r generates R_X86_64_NONE

2010-04-26 Thread mjw at redhat dot com
This comes up when building a kernel module debuginfo. A .rela.debug_info
section contains R_X86_64_NONE relocations. It is for a symbol in a section
called .discard, which the linker script discards. It seems that ld -r should
eat the reloc rather than leave *_NONE.

Reproducer based on kernel module build:

$ cat > foo.c
int here, there __attribute__ ((section (".discard")));

$ cat > module-common.lds
/*
 * Common module linker script, always used when linking a module.
 * Archs are free to supply their own linker scripts.  ld will
 * combine them automatically.
 */
SECTIONS {
/DISCARD/ : { *(.discard) }
}

$ ld -r -o foo2.o module-common.lds foo.o ld: warning: module-common.lds
contains output sections; did you forget -T?

$ ld -r -o foo2.o -T module-common.lds foo.o
$ readelf -r foo2.o

Relocation section '.rela.debug_info' at offset 0x618 contains 11 entries:
  Offset  Info   Type   Sym. ValueSym. Name + Addend
0006  0004000a R_X86_64_32    .debug_abbrev + 0
000c  0008000a R_X86_64_32    .debug_str + b
0011  0008000a R_X86_64_32    .debug_str + 38
0015  0008000a R_X86_64_32    .debug_str + 6
0019  00010001 R_X86_64_64    .text + 0
0021  00010001 R_X86_64_64    .text + 0
0029  0006000a R_X86_64_32    .debug_line + 0
002e  0008000a R_X86_64_32    .debug_str + 33
003b  000c0001 R_X86_64_64   0004 here + 0
004b  0008000a R_X86_64_32    .debug_str + 0
0058   R_X86_64_NONE

Relocation section '.rela.debug_pubnames' at offset 0x720 contains 1 entries:
  Offset  Info   Type   Sym. ValueSym. Name + Addend
0006  0005000a R_X86_64_32    .debug_info + 0

-- 
   Summary: ld -r generates R_X86_64_NONE
   Product: binutils
   Version: 2.20
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: mjw at redhat dot com
CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11542

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug gas/11544] New: .intel_syntax misassembles a forward-referenced .equ as a data reference

2010-04-26 Thread josh at joshtriplett dot org
The following three-line text case assembles incorrectly:

.intel_syntax noprefix
mov ax, AN_EQU
.equ AN_EQU, 5

Compiled with "gcc -c test.S"

Disassembled with "objdump -M intel -d test.o":

   0:   66 8b 04 25 05 00 00movax,WORD PTR ds:0x5
   7:   00 

For some reason, this assembled as a memory dereference of ds:0x5.  Somehow, gas
knew enough to substitute the value 5, but didn't know to treat it as an 
immediate.

If I move the equate before the instruction, it assembles correctly:

.intel_syntax noprefix
.equ AN_EQU, 5
mov ax, AN_EQU

   0:   66 b8 05 00 movax,0x5

If I substitute a literal 5 in the instruction, it assembles correctly:

.intel_syntax noprefix
mov ax, 5

   0:   66 b8 05 00 movax,0x5

And if I use AT&T syntax, it assembles correctly:

.att_syntax 
mov $AN_EQU, %ax
.equ AN_EQU, 5

   0:   66 b8 05 00 movax,0x5

-- 
   Summary: .intel_syntax misassembles a forward-referenced .equ as
a data reference
   Product: binutils
   Version: 2.20
Status: NEW
  Severity: normal
  Priority: P2
 Component: gas
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: josh at joshtriplett dot org
CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11544

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug gas/11544] .intel_syntax misassembles a forward-referenced .equ as a data reference

2010-04-26 Thread josh at joshtriplett dot org

--- Additional Comments From josh at joshtriplett dot org  2010-04-27 01:51 
---
I originally observed this bug in in 16-bit assembly with .code16, but as shown
in this report I can also reproduce it in 64-bit assembly.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11544

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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


[Bug ld/11545] New: generate wrongly executable, with .res file

2010-04-26 Thread lanxingcan at gmail dot com
I test wxwidgets library with a simple hello-world like program in Windows
Server 2008 R2. link with wxMain.o wxApp.o and resource.res, passing linker
flags --enable-runtime-pseudo-reloc-v2 (without this the dll could not be load).
The program could not be run with error 0x007b. I remove the resource.res,
it run properly

-- 
   Summary: generate wrongly executable, with .res file
   Product: binutils
   Version: 2.20
Status: NEW
  Severity: normal
  Priority: P1
 Component: ld
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: lanxingcan at gmail dot com
CC: bug-binutils at gnu dot org
GCC target triplet: x86_64-*mingw32


http://sourceware.org/bugzilla/show_bug.cgi?id=11545

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.


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