[ARM/gold] Fix the "DIV usage mismatch between blah.o and output" error
Ian Lance Taylor
iant@google.com
Wed Jan 9 15:27:00 GMT 2013
More information about the Binutils mailing list
Wed Jan 9 15:27:00 GMT 2013
- Previous message (by thread): [ARM/gold] Fix the "DIV usage mismatch between blah.o and output" error
- Next message (by thread): [ARM/gold] Fix the "DIV usage mismatch between blah.o and output" error
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Dec 19, 2012 at 11:32 AM, Ben Cheng <bccheng@google.com> wrote: > Gas in binutils 2.21 used to aggressively set the Tag_DIV_use flag to > 1 (ie "Not allowed"), which will be propagated through the attribute > handling code in bfd/elf32-arm.c and gold/arm.cc and serve as the big > hammer to set Tag_DIV_use to 1 in the final output. > > In 2.22 changes were made into gas and bfd to correctly allow 0 (ie > "Allowed in Thumb-ISA, v7-R or v7-M") and 2 (ie "Allowed in v7-A with > integer division extension") to co-exist, but gold is not picking up > the corresponding fix and it still strictly expects identical > Tag_DIV_use values across all binary files or at least a 1 to unify > the attribute. > > Following are two simple test functions used to reproduce the problem: > > div.c: > int div(int i, int j) > { > return i/j; > } > > main.c: > include <stdio.h> > > extern int div(int, int); > int main() > { > printf("4 / 2 = %d\n", div(4, 2)); > return 0; > } > > If div.c is compiled with -mcpu=cortex-a15 and main.c is compiled with > -mcpu=cortex-a9, only div.o will have Tag_DIV_use set to 2 and main.o > will use the default value 0, but gold will fail to link them with the > DIV usage mismatch error. > > This patch basically ports the new logic from bfd/elf32_arm.c over to > gold/arm.cc and with it the linker is able to link the program. Sorry for the slow review. Please send patches in diff -u or diff -p format. The default diff format is hard to read and hard to apply to the sources. Use // comments. For a block in a switch, put the opening brace after the case line. I committed your patch as follows. Thanks. Ian 2013-01-09 Ben Cheng <bccheng@google.com> * arm.cc (Target_arm::attributes_accept_div): New function. (Target_arm::attributes_forbid_div): New function. (Target_arm::merge_object_attributes): Merge the Tag_DIV_use attribute using the same new functions as what bfd/elf32_arm.c does. -------------- next part -------------- A non-text attachment was scrubbed... Name: foo.patch Type: application/octet-stream Size: 4851 bytes Desc: not available URL: <https://sourceware.org/pipermail/binutils/attachments/20130109/52637193/attachment.obj>
- Previous message (by thread): [ARM/gold] Fix the "DIV usage mismatch between blah.o and output" error
- Next message (by thread): [ARM/gold] Fix the "DIV usage mismatch between blah.o and output" error
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list