Deleted Added
full compact
ldd.c (256281) ldd.c (291268)
1/*
2 * Copyright (c) 1993 Paul Kranenburg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1993 Paul Kranenburg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/10/usr.bin/ldd/ldd.c 254018 2013-08-07 00:28:17Z markj $");
32__FBSDID("$FreeBSD: stable/10/usr.bin/ldd/ldd.c 291268 2015-11-24 23:04:03Z jkim $");
33
34#include <sys/wait.h>
35
36#include <machine/elf.h>
37
38#include <arpa/inet.h>
39
40#include <a.out.h>

--- 331 unchanged lines hidden (view full) ---

372 }
373 }
374
375 if (!dynamic) {
376 warnx("%s: not a dynamic ELF executable", fname);
377 return (0);
378 }
379 if (hdr.elf.e_type == ET_DYN) {
33
34#include <sys/wait.h>
35
36#include <machine/elf.h>
37
38#include <arpa/inet.h>
39
40#include <a.out.h>

--- 331 unchanged lines hidden (view full) ---

372 }
373 }
374
375 if (!dynamic) {
376 warnx("%s: not a dynamic ELF executable", fname);
377 return (0);
378 }
379 if (hdr.elf.e_type == ET_DYN) {
380 if (hdr.elf.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) {
380 switch (hdr.elf.e_ident[EI_OSABI]) {
381 case ELFOSABI_FREEBSD:
381 *is_shlib = 1;
382 return (1);
382 *is_shlib = 1;
383 return (1);
384#ifdef __ARM_EABI__
385 case ELFOSABI_NONE:
386 if (hdr.elf.e_machine != EM_ARM)
387 break;
388 if (((hdr.elf.e_flags & 0xff000000) >> 24) < 4)
389 break;
390 *is_shlib = 1;
391 return (1);
392#endif
383 }
384 warnx("%s: not a FreeBSD ELF shared object", fname);
385 return (0);
386 }
387
388 return (1);
389 }
390
391 warnx("%s: not a dynamic executable", fname);
392 return (0);
393}
393 }
394 warnx("%s: not a FreeBSD ELF shared object", fname);
395 return (0);
396 }
397
398 return (1);
399 }
400
401 warnx("%s: not a dynamic executable", fname);
402 return (0);
403}