This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM attribute merging oddity


On 20/03/09 18:03, Daniel Jacobowitz wrote:
On Fri, Mar 20, 2009 at 09:38:20AM +0000, Andrew Stubbs wrote:
I think any process that messes with attributes for files that are not
being changed is wrong (i.e. one input ->  one output).

They are being changed though - they're being linked.

If there's only one input to the link (i.e. we're using a linker script to mess with sections or addresses, perhaps), then it's reasonable to assume that all the input attributes also apply to the outputs.


Should linking two files with an unknown tag and the same value warn
about the output file, or about both input files?  Right now, it warns
about the output file:

./ld-new: Warning: tmpdir/dump: Unknown EABI object attribute 82
./ld-new: warning: cannot find entry symbol _start; defaulting to 0000000000008000

Which file name is used is probably an arbitrary descision. From elf32_arm_merge_eabi_attributes:


	  /* As present, all attributes in the list are unknown, and
	     therefore can't be merged meaningfully.  */
	  err_bfd = obfd;

If I assemble an empty file and put that at the front of the link,
I get this instead:

./ld-new: Warning: tmpdir/dump0.o: Unknown EABI object attribute 82
./ld-new: Warning: tmpdir/dump1.o: Unknown EABI object attribute 82
./ld-new: warning: cannot find entry symbol _start; defaulting to 0000000000008000

This has changed the merge. The attributes are no longer identical. 1. The output is set with no attribute - a copy of the first input. 2. The second input attribute does not match the output. - drop the attribute. - warn about input attribute. 2. The third input attribute does not match the output. - drop the attribute. - warn about input attribute.

That second one is much more useful.  If I put the empty file at the
end of the link, I get this:

./ld-new: Warning: tmpdir/dump: Unknown EABI object attribute 82
./ld-new: Warning: tmpdir/dump: Unknown EABI object attribute 82
./ld-new: warning: cannot find entry symbol _start; defaulting to 0000000000008000

That's least useful of all the options.

Again, the empty file changes the merge: 1. The out is set with attribute 82 set - a copy of the first input. 2. The second input attribute matches the output. - keep the attribute. - warn because we're guessing - use output name arbitrarily. 3. The third input attribute does not match the output. - drop the attribute. - warn about output attribute (the input has nothing to warn about).


The problem is that, at each step of the merge, we compare a single input file with a composite output file derived from one or more inputs. When the bad attribute is in the input file there's not problem, but when the bad attribute is in the accumulated composite, then we don't know what to call it.


We can make the easy fix of reporting ibfd, rather than obfd, when both contain the same attribute, but I see no easy fix when the attribute exists only in obfd.

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]