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

« back to all changes in this revision

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