Bug 3763 - testObjectFile(lib.elf.tests.TestElf)junit.framework.AssertionFailedError: section-1-alignment expected:<0> but was:<4> on x86_64
Summary: testObjectFile(lib.elf.tests.TestElf)junit.framework.AssertionFailedError: se...
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-19 12:57 UTC by Mark Wielaard
Modified: 2007-01-09 14:03 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments
`AC_SYS_LARGEFILE' for whole Frysk as elfutils is using it (467 bytes, patch)
2006-12-23 15:20 UTC, Jan Kratochvil
Details | Diff
alignment info for Elf test (639 bytes, patch)
2007-01-02 09:38 UTC, Mark Wielaard
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2006-12-19 12:57:59 UTC
This test passes just fine on x86, but fails as follows on x86_64:

1) testObjectFile(lib.elf.tests.TestElf)junit.framework.AssertionFailedError:
section-1-alignment expected:<0> but was:<4>
   at lib.elf.tests.TestElf.testObjectFile(TestRunner)
   at frysk.junit.Runner.runCases(TestRunner)
   at frysk.junit.Runner.runArchCases(TestRunner)
   at frysk.junit.Runner.runTestCases(TestRunner)
   at TestRunner.main(TestRunner)
Comment 1 Mark Wielaard 2006-12-20 13:51:17 UTC
Note that this test was disabled till recently according to bug #2712
Comment 2 Jan Kratochvil 2006-12-23 15:20:32 UTC
Created attachment 1470 [details]
`AC_SYS_LARGEFILE' for whole Frysk as elfutils is using it

This patch should be reviewed by a Frysk architect as I am not sure if this
change really needs to be global.
It is definitely needed for any code sharing ABI with elfutils as elfutils is
already using it.
It is also needed for any code accessing arbitrary files, which can be possibly
larger than 2GB.

Currently the layout:

/* Descriptor for data to be converted to or from memory format.  */
typedef struct
{
  void *d_buf;			/* Pointer to the actual data.	*/
  Elf_Type d_type;		/* Type of this piece of data.	*/
  unsigned int d_version;	/* ELF version.  */
  size_t d_size;		/* Size in bytes.  */
  off_t d_off;			/* Offset into section.  */ 
  size_t d_align;		/* Alignment in section.  */
} Elf_Data;

was handled differently in different parts of Frysk as `off_t' was sometimes
compiled on i686 as 4 bytes and sometimes as 8 bytes, therefore in some cases
`d_align' was fetched from a wrong offset.

After this `AC_SYS_LARGEFILE' fix gets committed the testcase
  frysk-imports$ ./TestRunner lib.elf.tests.TestElf
needs to be updated as currently it expects the buggy value 0 everywhere, there
should be some `expectedDataAlignments' and the alignments should match the
column `Al' of the output of:
  frysk-imports$ readelf -a ./frysk/pkgdatadir/helloworld.o
Comment 3 Mark Wielaard 2007-01-02 09:38:43 UTC
Created attachment 1472 [details]
alignment info for Elf test

This adds the allignment info to the test.
This works well on x86_64, but not on x86 where the read data always seems to
come out as zero.
Comment 4 Jan Kratochvil 2007-01-09 14:03:28 UTC
Committed the patch of Comment 2 (to `common/'), after Andrew Cagney's approval.