[Bug binutils/16952] New: PowerPC LD requests bug report. Issue related to EABI symbols _SDA_BASE_, _SDA2_BASE_

2014-05-16 Thread bcbrock at us dot ibm.com
https://sourceware.org/bugzilla/show_bug.cgi?id=16952

Bug ID: 16952
   Summary: PowerPC LD requests bug report. Issue related to EABI
symbols _SDA_BASE_, _SDA2_BASE_
   Product: binutils
   Version: 2.25 (HEAD)
Status: NEW
  Severity: minor
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: bcbrock at us dot ibm.com

We plan to link an embedded application using the .PPC.EMB.sdata0 facility of
the PowerPC EABI. A simple test failed, and LD requested that we report a bug.
After poking around, the problem seems to be that the linker script must define
_SDA_BASE_ and _SDA2_BASE_, even though these symbols are not explicitly
required by this example.

Source file:

.text
lwz 3, foo@sda21(0)

.data
foo:
.long   0

Linker script:

SECTIONS
{
. = 0x8000;
.text .   : { *(.text) }
.PPC.EMB.sdata0 . : { *(.data) }

/* Uncomment to eliminate the bug report

_SDA_BASE_ = .;
_SDA2_BASE_ = .;

*/
}

Messages:

as bug.S -o bug.o
ld bug.o -o bug -Tbug.cmd -Map bug.map
ld: BFD (GNU Binutils) 2.24.51.20140515 internal error, aborting at
../../binutils-gdb/bfd/elflink.c line 8855 in elf_link_output_extsym

ld: Please report this bug.

Thanks,

Bishop Brock

-- 
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 ld/16924] PowerPC Relocation R_PPC_ADDR16 is using the wrong overflow checker

2014-05-09 Thread bcbrock at us dot ibm.com
https://sourceware.org/bugzilla/show_bug.cgi?id=16924

--- Comment #3 from Bishop Brock  ---

> (In reply to Alan Modra from comment #1)
Well, I tried to delete my comments/questions about the patch, but was
unsuccessful :-)

Anyway, I had thought to ask, given that you allow ORI to treat its operand as
unsigned, shouldn't this be extended to ORIS, ANDIS, XORIS etc. as well?
Although it may be open to debate what it would or should mean, i. e., top or
bottom half?

Thanks,

Bishop

-- 
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 ld/16924] PowerPC Relocation R_PPC_ADDR16 is using the wrong overflow checker

2014-05-09 Thread bcbrock at us dot ibm.com
https://sourceware.org/bugzilla/show_bug.cgi?id=16924

--- Comment #2 from Bishop Brock  ---
(In reply to Alan Modra from comment #1)
Hi Alan,

We had trouble building the head version a couple of months ago so we based our
assembler on the 2.24 release. I see the fix and we'll incorporate it.

Regarding the patch, our assembler won't even assemble

ori 0, 0, foo


failing with

-- 
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 ld/16924] New: PowerPC Relocation R_PPC_ADDR16 is using the wrong overflow checker

2014-05-08 Thread bcbrock at us dot ibm.com
https://sourceware.org/bugzilla/show_bug.cgi?id=16924

Bug ID: 16924
   Summary: PowerPC Relocation R_PPC_ADDR16 is using the wrong
overflow checker
   Product: binutils
   Version: 2.25 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: bcbrock at us dot ibm.com

We believe there is a mistake in the definition of the R_PPC_ADDR16 relocation,
found in bfd/elf32-ppc.c

/* A standard 16 bit relocation. */
HOWTO (R_PPC_ADDR16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_PPC_ADDR16", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0x, /* dst_mask */
FALSE), /* pcrel_offset */ 

We believe the checker should be "complain_overflow_signed" instead of
"complain_overflow_bitfield".

We discovered this issue because we are building a tiny embedded system and
(please humor me) we need to use R0 (treated as 0 here) as the base address of
our "small data area" to reference data addresses in the top 32KB of the memory
space with a single instruction. So for example, this 2-line assembler file:

lwz 3, foo(0)
foo:

Can be assembled and linked with three variants of a simple linker script:

SECTIONS
{
# . = 0xFFFE; #Variant 1, fails as it should
# . = 0x; #Variant 2, does NOT fail, although it should
# . = 0x8000; #Variant 3, works as it should
   .all . { *(*) }
}

Variant 1 fails as it should, because the address of foo has obviously
overflowed out of 16 signed bits.  Variant 3 works as it should as foo is a
legal address in the top 32 KB of memory, a 16-bit "negative" address. Variant
2 should fail but does not. We believe this is because the
"complain_overflow_bitfield" check  is checking for for 16 (not 17) equal sign
bits in the final relocated address.

Thanks, 

Bishop Brock

-- 
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