View Single Post
Old 06-09-2014, 10:16 AM   #9
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
PatchElf for I386 - Details

No way out of it - this is a "must have" utility.
Until Buildroot can create a host-patchelf utility, here is a hand built version.

This build passes all of its own self-tests.

Ref:
http://nixos.org/patchelf.html
https://github.com/NixOS/patchelf/archive/0.8.zip

Repo:
git clone https://github.com/NixOS/patchelf.git patchelf.git

Short description:
Code:
core2quad src $ file /usr/local/bin/patchelf
/usr/local/bin/patchelf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
Archive contents (you need to sudo the unpacking in /usr/local):
Code:
cd /usr/local
tar --create --gzip --file=patchelf-0.8.tar.gz \
share/doc/patchelf/README \
share/man/man1/patchelf.1 \
bin/patchelf
More than you ever wanted to know:
Spoiler:

Code:
core2quad src $ readelf -dlh patchelf
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - GNU
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x804a0a8
  Start of program headers:          52 (bytes into file)
  Start of section headers:          577336 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         9
  Size of section headers:           40 (bytes)
  Number of section headers:         39
  Section header string table index: 36

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4
  INTERP         0x000154 0x08048154 0x08048154 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x16da0 0x16da0 R E 0x1000
  LOAD           0x016ef0 0x0805fef0 0x0805fef0 0x00208 0x002e4 RW  0x1000
  DYNAMIC        0x016f08 0x0805ff08 0x0805ff08 0x000e8 0x000e8 RW  0x4
  NOTE           0x000168 0x08048168 0x08048168 0x00044 0x00044 R   0x4
  GNU_EH_FRAME   0x014534 0x0805c534 0x0805c534 0x0039c 0x0039c R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4
  GNU_RELRO      0x016ef0 0x0805fef0 0x0805fef0 0x00110 0x00110 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .gcc_except_table 
   03     .init_array .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 
   04     .dynamic 
   05     .note.ABI-tag .note.gnu.build-id 
   06     .eh_frame_hdr 
   07     
   08     .init_array .ctors .dtors .jcr .dynamic .got 

Dynamic section at offset 0x16f08 contains 24 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x8048e44
 0x0000000d (FINI)                       0x805ae2c
 0x00000019 (INIT_ARRAY)                 0x805fef0
 0x0000001b (INIT_ARRAYSZ)               4 (bytes)
 0x6ffffef5 (GNU_HASH)                   0x80481ac
 0x00000005 (STRTAB)                     0x804862c
 0x00000006 (SYMTAB)                     0x80481ec
 0x0000000a (STRSZ)                      1270 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x805fff4
 0x00000002 (PLTRELSZ)                   480 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x8048c64
 0x00000011 (REL)                        0x8048c4c
 0x00000012 (RELSZ)                      24 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x8048bac
 0x6fffffff (VERNEEDNUM)                 3
 0x6ffffff0 (VERSYM)                     0x8048b22
 0x00000000 (NULL)                       0x0


Find the most recent build attached at post #1 of this thread.

Last edited by knc1; 06-09-2014 at 10:20 AM.
knc1 is offline   Reply With Quote