103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#! /bin/sh
203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# Copyright (C) 2013 Red Hat, Inc.
303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# This file is part of elfutils.
403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# This file is free software; you can redistribute it and/or modify
603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# it under the terms of the GNU General Public License as published by
703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# the Free Software Foundation; either version 3 of the License, or
803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# (at your option) any later version.
903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
1003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# elfutils is distributed in the hope that it will be useful, but
1103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# WITHOUT ANY WARRANTY; without even the implied warranty of
1203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# GNU General Public License for more details.
1403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
1503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# You should have received a copy of the GNU General Public License
1603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
1803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes. $srcdir/test-subr.sh
1903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
2003333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestfiles testfile-dwfl-report-elf-align-shlib.so
2103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
2203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# /proc/PID/maps when the process was running:
2303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# 7f3560c92000-7f3560c93000 r-xp 00000000 fd:02 25037063 testfile-dwfl-report-elf-align-shlib.so
2403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# 7f3560c93000-7f3560e92000 ---p 00001000 fd:02 25037063 testfile-dwfl-report-elf-align-shlib.so
2503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# 7f3560e92000-7f3560e93000 rw-p 00000000 fd:02 25037063 testfile-dwfl-report-elf-align-shlib.so
2603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# testfile-dwfl-report-elf-align-shlib.so:
2703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# Program Headers:
2803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#   Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
2903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#   LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x00065c 0x00065c R E 0x200000
3003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#   LOAD           0x000660 0x0000000000200660 0x0000000000200660 0x0001f0 0x000200 RW  0x200000
3103333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# Symbol table '.dynsym' contains 12 entries:
3203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#    Num:    Value          Size Type    Bind   Vis      Ndx Name
3303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#      8: 000000000000057c    11 FUNC    GLOBAL DEFAULT   11 shlib
3403333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# GDB output showing proper relocation:
3503333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# #1  0x00007f3560c92585 in shlib () from ./testfile-dwfl-report-elf-align-shlib.so
3603333823c75a1c1887e923828113a1b0fd12020cElliott Hughes#
3703333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# 0x7f3560c92000 is VMA address of first byte of testfile-dwfl-report-elf-align-shlib.so.
3803333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# 0x7f3560c92585 = 0x7f3560c92000 + 0x585
3903333823c75a1c1887e923828113a1b0fd12020cElliott Hughes# where 0x585 is any address inside the shlib function: 0x57c .. 0x57c + 11 -1
4003333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
4103333823c75a1c1887e923828113a1b0fd12020cElliott Hughestestrun ${abs_builddir}/dwfl-report-elf-align ./testfile-dwfl-report-elf-align-shlib.so \
4203333823c75a1c1887e923828113a1b0fd12020cElliott Hughes				0x7f3560c92000 0x7f3560c92585 shlib
4303333823c75a1c1887e923828113a1b0fd12020cElliott Hughes
4403333823c75a1c1887e923828113a1b0fd12020cElliott Hughesexit 0
45