accepting __attribute__((section("__ksymtab_strings"))) on mach-o
| Bugzilla Link | 10417 |
| Resolution | INVALID |
| Resolved on | Jul 19, 2011 20:05 |
| Version | trunk |
| OS | All |
| CC | @efriedma-quic |
Extended Description
llvm-gcc/gcc accepts this code from 2006-07-31-#854 .c:
struct kernel_symbol { unsigned long value; }; unsigned long loops_per_jiffy = (1<<12); static const char __kstrtab_loops_per_jiffy[] attribute((section("__ksymtab_strings"))) = "loops_per_jiffy"; static const struct kernel_symbol __ksymtab_loops_per_jiffy attribute((used)) attribute((section("__ksymtab"))) = { (unsigned long)&loops_per_jiffy, __kstrtab_loops_per_jiffy };
Excellent. I seemed to recall a time when it didn't I think is the reason. I'll close this though.
You may be able to convince gcc to print it, but the Darwin assembler rejects it.
Mmmm.. actually just gcc-4.2:
[yendi:~] echristo% gcc-4.2 foo.c -S -o - .globl _loops_per_jiffy .data .align 3 _loops_per_jiffy: .quad 4096 .section __ksymtab_strings ___kstrtab_loops_per_jiffy: .ascii "loops_per_jiffy\0" foo.c:9: warning: excess elements in struct initializer foo.c:9: warning: (near initialization for ‘__ksymtab_loops_per_jiffy’) .no_dead_strip ___ksymtab_loops_per_jiffy .section __ksymtab .align 3 ___ksymtab_loops_per_jiffy: .quad _loops_per_jiffy .subsections_via_symbols
Err, it does? There's no way that's valid on Darwin.