On 01/08/17 20:41, Ian Abbott wrote:
Hi folks,

I encountered a build error when using ptxdist-2017.07.0 with OSELAS.Toolchain-2014.12.2 (specifically, the "oselas.toolchain-2014.12.2-arm-v7a-linux-gnueabihf-gcc-4.9.2-glibc-2.20-binutils-2.24-kernel-3.16-sanitized" Debian package) to build barebox_mlo for an Altera SoCFPGA target.


Here are the last few lines of the build output:

   LD      barebox
   SYSMAP  System.map
   OBJCOPY barebox.bin
   LDS     images/pbl.lds
   LZO     images/barebox.z
   LD      images/start_socfpga_socrates_xload.pbl
   OBJCOPYB images/start_socfpga_socrates_xload.pblb
   PBLX    images/start_socfpga_socrates_xload.pblx
invalid magic
/mnt/lindata/work/abbotti/ptxdist/projects/testproject/platform-EBV-Socrates/build-target/barebox_mlo-2017.08.0/images/Makefile:77: recipe for target 'images/start_socfpga_socrates_xload.pblx' failed
make[2]: *** [images/start_socfpga_socrates_xload.pblx] Error 1
Makefile:501: recipe for target 'images' failed
make[1]: *** [images] Error 2
make[1]: Leaving directory '/mnt/lindata/work/abbotti/ptxdist/projects/testproject/platform-EBV-Socrates/build-target/barebox_mlo-2017.08.0' /mnt/lindata/work/abbotti/ptxdist/ptxdist/releases/ptxdist-2017.07.0/rules/post/ptxd_make_world_compile.make:21: recipe for target '/home/abbotti/work/ptxdist/projects/testproject/platform-EBV-Socrates/state/barebox_mlo.compile' failed make: *** [/home/abbotti/work/ptxdist/projects/testproject/platform-EBV-Socrates/state/barebox_mlo.compile] Error 2


The "invalid magic" message comes from the "fix_size" program executed by "images/Makefile". It seems to be caused by the presence of a ".note.gnu-build-id" section before the the ".text" section in the "start_socfpga_socrates_xload.pbl" file, as shown by "arm-v7a-linux-gnueabihf-objdump -h start_socfpga_socrates_xload.pbl":

start_socfpga_socrates_xload.pbl:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
   0 .note.gnu.build-id 000001f8  00000000  00000000  00008000  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   1 .text         0000322c  000001f8  000001f8  000081f8  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, CODE
   2 .rodata       00000d31  00003424  00003424  0000b424  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   3 .interp       00000011  00004155  00004155  0000c155  2**0
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   4 .dynamic      00000080  00004670  00004670  0000c670  2**2
                   CONTENTS, ALLOC, LOAD, DATA
   5 .dynsym       00000150  000048cc  000048cc  0000c8cc  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   6 .dynstr       000000f4  00004166  00004166  0000c166  2**0
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   7 .gnu.hash     00000050  0000425c  0000425c  0000c25c  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   8 .data         000003c4  000042ac  000042ac  0000c2ac  2**2
                   CONTENTS, ALLOC, LOAD, DATA
   9 .got.plt      0000000c  000046f0  000046f0  0000c6f0  2**2
                   CONTENTS, ALLOC, LOAD, DATA
  10 .rel.dyn      000001d0  000046fc  000046fc  0000c6fc  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
  11 .bss          00000020  00004a1c  00004a1c  0000ca1c  2**2
                   ALLOC
  12 .image_end    00000004  00004a3c  00004a3c  0000ca3c  2**2
                   CONTENTS, ALLOC, LOAD, DATA
  13 .comment      00000028  00000000  00000000  0000ca40  2**0
                   CONTENTS, READONLY
  14 .ARM.attributes 0000002f  00000000  00000000  0000ca68  2**0
                   CONTENTS, READONLY


(In a working build, the ".text" section starts at offset 00008000 and there is no ".note.gnu.build-id" section.)

For comparison, here are the section headers for ptxdist-2017.07.0 with OSELAS.Toolchain-2016.06.1. Notice that the ".note.gnu.build-id" section is in a different place. Also the initial file offset has changed from 00008000 to 00010000:

start_socfpga_socrates_xload.pbl:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000031f4  00000000  00000000  00010000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rodata       00000d31  000031f4  000031f4  000131f4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynamic      00000088  0000444c  0000444c  0001444c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  3 .dynsym       00000150  000046a8  000046a8  000146a8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynstr       000000f4  00003f25  00003f25  00013f25  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.hash     0000006c  0000401c  0000401c  0001401c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .data         000003c4  00004088  00004088  00014088  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .got.plt      0000000c  000044d4  000044d4  000144d4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  8 .rel.dyn      000001c8  000044e0  000044e0  000144e0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .note.gnu.build-id 00000120  000047f8  000047f8  000147f8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .bss          00000020  00004918  00004918  00014918  2**2
                  ALLOC
 11 .image_end    00000004  00004938  00004938  00014938  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 12 .comment      00000028  00000000  00000000  0001493c  2**0
                  CONTENTS, READONLY
 13 .ARM.attributes 0000002f  00000000  00000000  00014964  2**0
                  CONTENTS, READONLY

The contents of the ".note.gnu.build-id" section from the .pbl file gets copied into the .pblb file, then into the .pblx file, the .pblx.socfpgaimg file, and finally into the .img file.


Anyway, I think I know the cause of the problem. Commit 56b1e28fdbf78 ("Debugging: add support for 'build-id's") added general support for build-ids, but blacklisted build-ids for "kernel" and "barebox". (A subsequent commit blacklisted build-ids for "grub".) So the solution is to blacklist build-ids for the "barebox_mlo" package.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

_______________________________________________
ptxdist mailing list
[email protected]

Reply via email to