Git Product home page Git Product logo

Comments (6)

nagisa avatar nagisa commented on May 4, 2024

The usual addresses are something like 0x40_0000 and up, whereas "RAM" sections are placed at addresses in the 0x2000_0000 range.

from bloaty.

haberman avatar haberman commented on May 4, 2024

Is this for ELF or Mach-O?

It would be really helpful to see the listing of sections and segments from the binary.

from bloaty.

nagisa avatar nagisa commented on May 4, 2024

ELF. The following listing has the sections present in the binary. Are segments something else?

file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 A6 rw         0000208f  00400000  00400000  00000278  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 A0 rw         00000148  00404000  00404000  00002308  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 P1 ro         00001db0  00404148  00404148  00002450  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 A2 rw         00000004  00405efc  00405efc  00004200  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 P1 ro_2       00000100  00405f00  00405f00  00004204  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  5 A4 rw         00000004  00406000  00406000  00004304  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 P1 ro_3       00011b98  00406004  00406004  0000430c  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  7 A3 rw         0000000c  00417ba0  00417ba0  00015ea4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 P1 ro_4       00031078  00417bac  00417bac  00015eb0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  9 A1 rw         00000008  00448c28  00448c28  00046f28  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 P1 ro_5       00016d94  00448c30  00448c30  00046f30  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 A5 rw         00000004  0045fffc  0045fffc  0005dcc4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 A7 rw         0000f70c  00460000  00460000  0005dcc8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 13 A8 rw         0000f70c  00470000  00470000  0006d3d8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 14 P2 rw         00000f02  20004900  20004900  00000000  2**3
                  ALLOC, CODE
 15 P2 zi         0001c370  20005804  20005804  00000000  2**3
                  ALLOC, CODE
 16 P2 ui         00003000  20021b78  20021b78  00000000  2**3
                  ALLOC
 17 .iar.debug_frame 00007ac4  00000000  00000000  0007d128  2**0
                  CONTENTS, READONLY
 18 .iar.debug_line 00067455  00000000  00000000  00084bec  2**0
                  CONTENTS, READONLY
 19 .comment      00083ff2  00000000  00000000  000ec041  2**0
                  CONTENTS, READONLY
 20 .iar.rtmodel  00000061  00000000  00000000  00170033  2**0
                  CONTENTS, READONLY
 21 .ARM.attributes 0000002e  00000000  00000000  00170094  2**0
                  CONTENTS, READONLY
 22 Fill1         00000004  00405ef8  00405ef8  0007cae4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 23 Fill2         00000004  00417b9c  00417b9c  0007cae8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 24 Fill3         00000004  00448c24  00448c24  0007caec  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 25 Fill4         00000638  0045f9c4  0045f9c4  0007caf0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

from bloaty.

haberman avatar haberman commented on May 4, 2024

To see segments, try readelf -l.

Also what address is printed with the error message?

from bloaty.

nagisa avatar nagisa commented on May 4, 2024
$ readelf -l
Elf file type is EXEC (Executable file)
Entry point 0x446b17
There are 18 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000278 0x00400000 0x00400000 0x0208f 0x0208f R   0x8
  LOAD           0x002308 0x00404000 0x00404000 0x00148 0x00148 R   0x4
  LOAD           0x002450 0x00404148 0x00404148 0x01db0 0x01db0 R E 0x4
  LOAD           0x004200 0x00405efc 0x00405efc 0x00004 0x00004 R   0x4
  LOAD           0x004204 0x00405f00 0x00405f00 0x00100 0x00100 R E 0x4
  LOAD           0x004304 0x00406000 0x00406000 0x00004 0x00004 R   0x4
  LOAD           0x00430c 0x00406004 0x00406004 0x11b98 0x11b98 R E 0x8
  LOAD           0x015ea4 0x00417ba0 0x00417ba0 0x0000c 0x0000c R   0x4
  LOAD           0x015eb0 0x00417bac 0x00417bac 0x31078 0x31078 R E 0x4
  LOAD           0x046f28 0x00448c28 0x00448c28 0x00008 0x00008 R   0x8
  LOAD           0x046f30 0x00448c30 0x00448c30 0x16d94 0x16d94 R E 0x4
  LOAD           0x05dcc4 0x0045fffc 0x0045fffc 0x00004 0x00004 R   0x4
  LOAD           0x05dcc8 0x00460000 0x00460000 0x0f70c 0x0f70c R   0x8
  LOAD           0x06d3d8 0x00470000 0x00470000 0x0f70c 0x0f70c R   0x8
  LOAD           0x07cae4 0x00405ef8 0x00405ef8 0x00004 0x00004 R E 0
  LOAD           0x07cae8 0x00417b9c 0x00417b9c 0x00004 0x00004 R E 0
  LOAD           0x07caec 0x00448c24 0x00448c24 0x00004 0x00004 R E 0
  LOAD           0x07caf0 0x0045f9c4 0x0045f9c4 0x00638 0x00638 R E 0

 Section to Segment mapping:
  Segment Sections...
   00     A6 rw
   01     A0 rw
   02     P1 ro
   03     A2 rw
   04     P1 ro_2
   05     A4 rw
   06     P1 ro_3
   07     A3 rw
   08     P1 ro_4
   09     A1 rw
   10     P1 ro_5
   11     A5 rw
   12     A7 rw
   13     A8 rw
   14     Fill1
   15     Fill2
   16     Fill3
   17     Fill4
$ bloaty file.elf
bloaty: Tried to add range that is not covered by base map.

but does not print anything else. Running verbosely seems to start working on P2 rw before failing:

$ bloaty -vvv file.elf
<snip>
  added entry: [6d3d8, 7cae4] (size=f70c): A8 rw, other_start=470000
0x7f53b0000d50 AddDualRange([47f70c, 0], ffffffffffffffff, A8 rw)
0x7f53b0000d80 AddDualRange([7cae4, 0], ffffffffffffffff, A8 rw)
[sections, elf_section] AddRange(P2 rw, 20004900, f02, ffff80ac4994c000, 0)
bloaty: Tried to add range that is not covered by base map.

from bloaty.

jameyhicks avatar jameyhicks commented on May 4, 2024

I'm running into this also with an ELF file produced by Cypress PSoC Creator. It uses GCC but the final build step adds section .cyloadermeta, which seems to have the offending region.

I figured I would use objcopy to produce an ELF without it:
arm-none-eabi-objcopy: fixed.elf: warning: allocated section `.cyloadermeta' not in segment

Without that section, bloaty is happy with the ELF.

If it is helpful, I can build an ELF from one of the sample projects and share that.

from bloaty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.