~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to scripts/mod/modpost.c

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <string.h>
18
18
#include <limits.h>
19
19
#include <stdbool.h>
 
20
#include <errno.h>
20
21
#include "modpost.h"
21
22
#include "../../include/linux/license.h"
22
23
#include "../../include/linux/export.h"
36
37
/* How a symbol is exported */
37
38
static int sec_mismatch_count = 0;
38
39
static int sec_mismatch_verbose = 1;
 
40
/* ignore missing files */
 
41
static int ignore_missing_files;
39
42
 
40
43
enum export {
41
44
        export_plain,      export_unused,     export_gpl,
160
163
        unsigned int vmlinux:1;    /* 1 if symbol is defined in vmlinux */
161
164
        unsigned int kernel:1;     /* 1 if symbol is from kernel
162
165
                                    *  (only for external modules) **/
163
 
        unsigned int preloaded:1;  /* 1 if symbol from Module.symvers */
 
166
        unsigned int preloaded:1;  /* 1 if symbol from Module.symvers, or crc */
164
167
        enum export  export;       /* Type of export */
165
168
        char name[0];
166
169
};
328
331
{
329
332
        struct symbol *s = find_symbol(name);
330
333
 
331
 
        if (!s)
 
334
        if (!s) {
332
335
                s = new_symbol(name, mod, export);
 
336
                /* Don't complain when we find it later. */
 
337
                s->preloaded = 1;
 
338
        }
333
339
        s->crc = crc;
334
340
        s->crc_valid = 1;
335
341
}
406
412
 
407
413
        hdr = grab_file(filename, &info->size);
408
414
        if (!hdr) {
 
415
                if (ignore_missing_files) {
 
416
                        fprintf(stderr, "%s: %s (ignored)\n", filename,
 
417
                                strerror(errno));
 
418
                        return 0;
 
419
                }
409
420
                perror(filename);
410
421
                exit(1);
411
422
        }
598
609
        else
599
610
                export = export_from_sec(info, get_secindex(info, sym));
600
611
 
 
612
        /* CRC'd symbol */
 
613
        if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
 
614
                crc = (unsigned int) sym->st_value;
 
615
                sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
 
616
                                export);
 
617
        }
 
618
 
601
619
        switch (sym->st_shndx) {
602
620
        case SHN_COMMON:
603
621
                warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
604
622
                break;
605
 
        case SHN_ABS:
606
 
                /* CRC'd symbol */
607
 
                if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
608
 
                        crc = (unsigned int) sym->st_value;
609
 
                        sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
610
 
                                        export);
611
 
                }
612
 
                break;
613
623
        case SHN_UNDEF:
614
624
                /* undefined symbol */
615
625
                if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
1852
1862
        buf_printf(b, "\n");
1853
1863
        buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
1854
1864
        buf_printf(b, "\n");
1855
 
        buf_printf(b, "struct module __this_module\n");
 
1865
        buf_printf(b, "__visible struct module __this_module\n");
1856
1866
        buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
1857
1867
        buf_printf(b, "\t.name = KBUILD_MODNAME,\n");
1858
1868
        if (mod->has_init)
2118
2128
        struct ext_sym_list *extsym_iter;
2119
2129
        struct ext_sym_list *extsym_start = NULL;
2120
2130
 
2121
 
        while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:")) != -1) {
 
2131
        while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) {
2122
2132
                switch (opt) {
2123
2133
                case 'i':
2124
2134
                        kernel_read = optarg;
2138
2148
                case 'm':
2139
2149
                        modversions = 1;
2140
2150
                        break;
 
2151
                case 'n':
 
2152
                        ignore_missing_files = 1;
 
2153
                        break;
2141
2154
                case 'o':
2142
2155
                        dump_write = optarg;
2143
2156
                        break;