Gentoo Archives: gentoo-portage-dev

From: "Anthony G. Basile" <basile@××××××××××××××.edu>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Generate soname dependency metadata (282639)
Date: Sat, 31 Jan 2015 16:02:33
Message-Id: 54CCFD1C.7030201@opensource.dyc.edu
In Reply to: Re: [gentoo-portage-dev] [PATCH] Generate soname dependency metadata (282639) by Zac Medico
1 On 01/30/15 18:19, Zac Medico wrote:
2 > On 01/30/2015 03:01 PM, Anthony G. Basile wrote:
3 >> On 01/29/15 21:02, Zac Medico wrote:
4 >>>>> +# hppa_{32,64}
5 >>>>> +# ia_{32,64}
6 >>>>> +# m68k_{32,64}
7 >>>>> +# mips_{eabi32,eabi64,n32,n64,o32,o64}
8 >>>>> +# ppc_{32,64}
9 >>>>> +# s390_{32,64}
10 >>>>> +# sh_{32,64}
11 >>>>> +# sparc_{32,64}
12 >>>>> +# x86_{32,64,x32}
13 >>>>> +#
14 >>>>> +# NOTES:
15 >>>>> +#
16 >>>>> +# * The ABIs referenced by some of the above *_32 and *_64 categories
17 >>>>> +# may be imaginary, but they are listed anyway, since the goal is to
18 >>>>> +# establish a naming convention that is as consistent and uniform as
19 >>>>> +# possible.
20 >>>>> +#
21 >>>>> +# * The Elf header's e_ident[EI_OSABI] byte is completely ignored,
22 >>>>> +# since OS-independence is one of the goals. The assumption is that,
23 >>>>> +# for given installation, we are only interested in tracking
24 >>>>> multilib
25 >>>>> +# ABIs for a single OS.
26 >>>>
27 >>>> If you run readelf -h on (say) bash in any of our stage3's tarballs you
28 >>>> always get "OS/ABI: UNIX - System V" irrespective of arch and abi. I
29 >>>> don't know what you would get on BSD, but the field is totally
30 >>>> irrelevant for our purposes despite the name. As far as I can tell, it
31 >>>> is totally invariant across arches and abis.
32 >>>>
33 >>>> You can even unpack the the stage3's on an amd64 host and run readelf
34 >>>> form the host on the chroot target and you'll get the elf header, so you
35 >>>> don't need access to native hardware.
36 >>>>
37 >>>> The comment suggests that there might be some interesting information
38 >>>> there, but there isn't. Maybe I'm just reading too much into it.
39 >>>
40 >>> Well, a quick google search seems to indicate that FreeBSD uses
41 >>> EI_OSABI. I was specifically thinking about FreeBSD when I wrote that
42 >>> comment, because I was aware that Gentoo/FBSD was using ELF, and I just
43 >>> assumed that they would have a different EI_OSABI than Linux.
44 >>
45 >> Even there you'll get "UNIX - System V". I don't have a freebsd system
46 >> ready to go, but here's what i get from my openbsd system:
47 >>
48 >> # uname -a
49 >> OpenBSD obi.dis 5.6 GENERIC.MP#333 amd64
50 >> # readelf -h /bin/sh
51 >> ELF Header:
52 >> Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
53 >> Class: ELF64
54 >> Data: 2's complement, little endian
55 >> Version: 1 (current)
56 >> OS/ABI: UNIX - System V
57 >> ABI Version: 0
58 >> Type: EXEC (Executable file)
59 >> Machine: Advanced Micro Devices X86-64
60 >> Version: 0x1
61 >> Entry point address: 0x400260
62 >> Start of program headers: 64 (bytes into file)
63 >> Start of section headers: 442512 (bytes into file)
64 >> Flags: 0x0
65 >> Size of this header: 64 (bytes)
66 >> Size of program headers: 56 (bytes)
67 >> Number of program headers: 7
68 >> Size of section headers: 64 (bytes)
69 >> Number of section headers: 17
70 >> Section header string table index: 16
71 >>
72 >>
73 >> I have *never* seen the OS/ABI be anything different. That's what
74 >> struck me about your comment. Anyhow, we're far afield.
75 >>
76 >> I might install freebsd later in a vm just to have one handy and check.
77 >
78 > I just loop-mounted a GhostBSD iso, and here's what I found:
79 >
80 > # readelf -h /media/iso/bin/sh
81 > ELF Header:
82 > Magic: 7f 45 4c 46 01 01 01 09 00 00 00 00 00 00 00 00
83 > Class: ELF32
84 > Data: 2's complement, little endian
85 > Version: 1 (current)
86 > OS/ABI: UNIX - FreeBSD
87 > ABI Version: 0
88 > Type: EXEC (Executable file)
89 > Machine: Intel 80386
90 > Version: 0x1
91 > Entry point address: 0x804a100
92 > Start of program headers: 52 (bytes into file)
93 > Start of section headers: 119888 (bytes into file)
94 > Flags: 0x0
95 > Size of this header: 52 (bytes)
96 > Size of program headers: 32 (bytes)
97 > Number of program headers: 8
98 > Size of section headers: 40 (bytes)
99 > Number of section headers: 28
100 > Section header string table index: 27
101 >
102
103 Yeah I just confirmed that. I installed amd64 fbsd 10.1. I've used
104 obsd for years and noticed the "UNIX - System V" and just thought it was
105 the same for all *bsd systems. This is the only time I've seen a
106 different OS/ABI.
107
108 Anyhow, I did some perf testing. Concentrating on www-apps/moodle (which
109 is a huge package of some 19000 files but no elfs), and
110 app-emulation/wine (which has 11000 elf objects) and I found no
111 appreciable performance hit.
112
113 Other tests show that PROVIDES, REQUIRES and NEEDED.ELF.2 are correctly
114 being generated.
115
116 Once committed, I'll rebuild @system and see if we get the correct
117 linkage graph. I have scripts do build such a graph from readelf -d and
118 so I can compare.
119
120 --
121 Anthony G. Basile, Ph. D.
122 Chair of Information Technology
123 D'Youville College
124 Buffalo, NY 14201
125 (716) 829-8197

Replies