From 466353d34a79d4d0e9ee249600e9424f3bc90d9f Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 28 Oct 1995 12:27:20 +0000 Subject: symorder appears to have been designed to run on executable files only, as it payes no attention to the relocation table (which references the symbols). As a result, running "symorder -c" to clean up the visibility of a LKM ".o" file (as is done in the new bsd.kmod.mk) totally screws up the relocation table, making the LKM file unloadable. (ld: bogus relocation record) This is a pretty crude fix - I've changed symorder so that when running in "cleanup" mode, it disables the reordering which was screwing up the relocation table. I'm sure there is a better fix, but I didn't have the energy. Feel free to fix this hack, probably by renumbering the symbol indexes in the relocation table. --- usr.bin/symorder/symorder.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/symorder/symorder.c b/usr.bin/symorder/symorder.c index 5c709b6..4a1b79f 100644 --- a/usr.bin/symorder/symorder.c +++ b/usr.bin/symorder/symorder.c @@ -185,15 +185,19 @@ main(argc, argv) strtabsize - sizeof(int)) badfmt("corrupted string table"); - newtab = (struct nlist *)malloc(n); - if (newtab == (struct nlist *)NULL) - error(NULL); - memset(newtab, 0, n); - i = n / sizeof(struct nlist); - reorder(symtab, newtab, i); - free((void *)symtab); - symtab = newtab; + if (!clean) { + newtab = (struct nlist *)malloc(n); + if (newtab == (struct nlist *)NULL) + error(NULL); + memset(newtab, 0, n); + + reorder(symtab, newtab, i); + free((void *)symtab); + symtab = newtab; + } else { + symfound = symkept = i; + } newstrings = malloc(strtabsize); if (newstrings == NULL) -- cgit v1.1