Commit Graph

75 Commits

Author SHA1 Message Date
Ed Maste
b6c03f2122 kldxref: bump MAXSEGS to 3
ld.bfd generates two PT_LOAD segments, but certain linkers or linker
configurations generate three PT_LOAD segments (one additional for
RELRO).

PR:		216975
Reported by:	Shawn Webb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2017-02-10 19:17:10 +00:00
Ed Maste
d65b2f7ed6 kldxref: s/sections/segments/ in warning message
The message refers to program header segments, not sections.

PR:		216975
2017-02-10 19:11:33 +00:00
Marcelo Araujo
bf6911cd08 Use roundup2() from sys/param.h. 2016-08-23 13:43:43 +00:00
Marcelo Araujo
1dcace5ba0 Use NULL instead of 0 for pointers.
MFC after:	2 weeks.
2016-05-16 01:12:56 +00:00
Andrew Turner
f5e45e53f9 Add support for relocating AArch64 modules to kldxref. This fixes an error
message where it fails to read the module as the unrelocated addresses
are zero.

Sponsored by:	ABT Systems Ltd
2016-01-13 21:34:15 +00:00
Warner Losh
493b2041d6 Augment kldxref to find the new MODULE_PNP_INFO records now in
modules, simplify them into a more normal form and write them to
linker.hints.

Differential Review: https://reviews.freebsd.org/D3461
2015-12-11 05:27:55 +00:00
Ed Maste
113a1a2139 Add debug file extension to kldxref(8) after r288176
After r288176 kernel debug files have the extension .debug.  They also
moved to /usr/lib/debug/boot/kernel by default so in the normal case
kldxref does not encounter them.  A src.conf(5) setting may be used to
continue installing them in /boot/kernel though, so have kldxref skip
.debug files in addition to .symbols files.

Reported by:	fabient
Sponsored by:	The FreeBSD Foundation
2015-10-02 13:16:06 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Warner Losh
b03747e983 Reserve and ignore the a new module metadata type MDT_PNP_INFO for
associating an optional PNP hint table with this module. In the
future, when these are added, these changes will silently ignore the
new type they would otherwise warn about. It will always be safe to
ignore this data. Get this into the builds today for some future
proofing.

MFC After: 3 days
2015-01-15 00:46:30 +00:00
Warner Losh
e808299c02 Bump the largest record we can cope with from 1k to 8k. Other users of
the hints file don't have any real limits, and longer records will
need to be written shortly.
2014-12-19 18:45:52 +00:00
Warner Losh
8bc65725c7 Remove -fno-strict-alias, as it is no longer needed. 2014-12-18 16:57:19 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Ed Maste
2bd7b9e5cc kldxref: Clean up error reporting
Omit "too many sections" warnings if the ELF file is not dynamically
linked (and is therefore skipped anyway), and otherwise output it only
once.  An errant core file would previously cause kldxref to output a
number of warnings.

Also introduce a MAXSEGS #define and replace literal 2 with it, to make
comparisons clear.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
2014-04-30 18:11:53 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Jilles Tjoelker
5d452cea64 kldxref: Add static keyword to the new function only used in the same file.
The WARNS level is not such that the omission broke the build.

Reported by:	mdf
2013-10-16 20:04:06 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Jilles Tjoelker
6d9cb20bd7 kldxref: Do not depend on the directory order.
Sort the filenames to get a consistent result between machines of the same
architecture.

Also, sort FTS_D entries after other entries so kldxref -R works properly in
the uncommon case that a directory contains both subdirectories and modules.
Previously, this may have happened to work, depending on the order of files
in the directory.

PR:		bin/182098
Submitted by:	Derek Schrock (original version)
Tested by:	Derek Schrock
Approved by:	re (delphij)
MFC after:	1 week
2013-10-04 21:25:55 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Xin LI
c84739b210 Use calloc().
MFC after:	2 weeks
2013-06-05 21:56:29 +00:00
Xin LI
ac8e13960d Remove unneeded reference to link.h (sys/link_elf.h).
MFC after:	2 weeks
2013-06-05 21:55:20 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Tim Kientzle
5db4d6779f Clarify a warning message. 2012-10-29 03:31:22 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Eitan Adler
7e22d9ed96 Remove variables which are initialized but never used thereafter reported by gcc46 warning
Approved by:	cperciva
MFC After:	3 days
2012-06-19 06:10:34 +00:00
Ulrich Spörlein
f76b319989 Reencode files to UTF-8. Drop CP1252 em-dash. 2011-12-30 00:59:08 +00:00
Nathan Whitehorn
b12277d1d4 Repair some build breakage introduced in r211725 and garbage collect some
code made obsolete in the same commit.
2010-08-28 15:03:11 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +00:00
Luigi Rizzo
9cb138bb35 various cleanups including:
+ check a possible buffer overflow when creating a temp file,
  submitted by Christoph Mallon
+ remove stale struct definitions
+ clarify the use of dflag and remove useless checks

MFC after:	3 days
2009-01-06 14:23:38 +00:00
Luigi Rizzo
14560a3610 fix a couple of innocuous compiler warnings
MFC after:	3 days
2009-01-06 14:21:17 +00:00
Luigi Rizzo
16c6e0979c correct description of how a string is stored, fix a few
typos and reference the kernel file which processes this info.

All in all, the content of this file should be moved to kldxref.c
or to the kld(4) manpage.

MFC after:	3 days
2009-01-06 14:10:30 +00:00
Luigi Rizzo
ddce581880 Make the linker.hints file have mode 644 instead of 600.
There is nothing secret in the file, and the missing read
permission breaks diskless operation.

MFC after:	4 weeks
2008-11-30 14:20:08 +00:00
John Birrell
0aad0f2282 These are the things that the tinderbox has problems with because it
doesn't use the default CFLAGS which contain -fno-strict-aliasing.

Until the code is cleaned up, just add -fno-strict-aliasing to the
CFLAGS of these for the tinderboxes' sake, allowing the rest of the
tree to have -Werror enabled again.
2007-11-20 02:07:30 +00:00
Warner Losh
2fdfd0fee2 Use safe strlcpy rather than unsafe strncpy. After marcel's last fix,
there was still one overflow possible.  strlcpy is faster anyway
because it doesn't unexpectedly zero the entire length of the string
when copying short strings....
2006-08-05 18:22:11 +00:00
Marcel Moolenaar
b1bc6755d1 Build shared on PowerPC now that the bug has been found and fixed. 2006-08-04 21:29:39 +00:00
Marcel Moolenaar
77a6f8ac6f Fix (static) buffer overflow bug. The dest buffer is of size MAXPATHLEN,
so dest[MAXPATHLEN] falls outside the buffer.  This bug corrupted
arenas[0] defined in libc's malloc.c on PowerPC when kldxref is shared,
which triggered a delayed SIGSERV.
2006-08-04 21:28:42 +00:00
Marcel Moolenaar
acdb66fce6 Use NO_SHARED=YES to force a static link.
Pointed out by: ru@
2006-07-30 20:51:41 +00:00
Marcel Moolenaar
259d74ed53 Link kldxref(8) static on PowerPC to work around a SIGSEGV that
cannot easily be analyzed due to there being no debugger yet.
The SIGSEGV only happens when kldxref is linked shared.
Since kldxref(8) is needed for a release build, having it not
dump core is important.
2006-07-29 19:43:26 +00:00
Marcel Moolenaar
9ceddbd532 Change maketempfile() to return a FILE* so as to eliminate the fopen()
that immediately follows the only call to it. maketempfile() uses
mkstemp(), so the temporary file has already been opened and using
fopen() again just opens the file twice. This also fixes the invalid
mode used on the fopen().
While here, assign NULL to fxref after fclose() because we test for
fxref being !NULL to determine if we have the (temporary) hints file
open.
2006-07-29 19:39:03 +00:00
Jason Evans
609c1c6c22 Use posix_memalign() rather than assuming that malloc() provides adequate
alignment.

Approved by:	markm (mentor)
2006-01-12 08:01:38 +00:00
Marcel Moolenaar
757686b115 Make our ELF64 type definitions match standards. In particular this
means:
o  Remove Elf64_Quarter,
o  Redefine Elf64_Half to be 16-bit,
o  Redefine Elf64_Word to be 32-bit,
o  Add Elf64_Xword and Elf64_Sxword for 64-bit entities,
o  Use Elf_Size in MI code to abstract the difference between
   Elf32_Word and Elf64_Word.
o  Add Elf_Ssize as the signed counterpart of Elf_Size.

MFC after: 2 weeks
2005-12-18 04:52:37 +00:00
Marcel Moolenaar
55dfaa9163 Explicitly cast ELF_R_TYPE() to the right type. 2005-12-18 01:38:26 +00:00
Ruslan Ermilov
9f5529b45a Skip .symbols files. 2005-11-11 08:13:18 +00:00