Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'extern' to all declarations to allow -fno-common option #220

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions metal_header/device.c++
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,15 @@ std::string Device::platform_define_offset(node n, std::string suffix) {
* "__metal_" namespace */
void Device::emit_struct_decl(std::string type, const node &n) {
emit_comment(n);
os << "struct __metal_driver_" << type << " __metal_dt_" << n.handle()
<< ";\n\n";
os << "extern /* hello */ struct __metal_driver_" << type << " __metal_dt_"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the /* hello */ for?

<< n.handle() << ";\n\n";
}

void Device::emit_struct_decl(std::string type, std::string suffix,
const node &n) {
emit_comment(n);
os << "struct __metal_driver_" << type << "_" << suffix << " __metal_dt_"
<< n.handle() << "_" << suffix << ";\n\n";
os << "extern /* hello */ struct __metal_driver_" << type << "_" << suffix
<< " __metal_dt_" << n.handle() << "_" << suffix << ";\n\n";
}

void Device::emit_struct_begin(std::string type, const node &n) {
Expand Down
2 changes: 1 addition & 1 deletion metal_header/memory.c++
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void memory::include_headers() { os << "#include <metal/memory.h>\n"; }

void memory::declare_structs() {
auto declare = [&](node n) {
os << "struct metal_memory __metal_dt_mem_" << n.handle() << ";\n\n";
os << "extern struct metal_memory __metal_dt_mem_" << n.handle() << ";\n\n";
};

dtb.match(std::regex("sifive,sram0"), declare, std::regex("sifive,testram0"),
Expand Down
2 changes: 1 addition & 1 deletion metal_header/riscv_cpu_intc.c++
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ string riscv_cpu_intc::handle(node n) {

void riscv_cpu_intc::declare_structs() {
dtb.match(std::regex(compat_string), [&](node n) {
os << "struct __metal_driver_riscv_cpu_intc __metal_dt_" << handle(n)
os << "extern struct __metal_driver_riscv_cpu_intc __metal_dt_" << handle(n)
<< ";\n\n";
});
}
Expand Down
2 changes: 1 addition & 1 deletion metal_header/sifive_buserror0.c++
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void sifive_buserror0::define_inlines() {
void sifive_buserror0::declare_structs() {
dtb.match(std::regex(compat_string), [&](node n) {
emit_comment(n);
os << "struct metal_buserror"
os << "extern struct metal_buserror"
" __metal_dt_"
<< n.handle() << ";\n\n";
});
Expand Down
4 changes: 2 additions & 2 deletions metal_header/sifive_rtc0.c++
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ void sifive_rtc0::define_inlines() {
void sifive_rtc0::declare_structs() {
dtb.match(std::regex(compat_string), [&](node n) {
emit_comment(n);
os << "struct __metal_driver_sifive_rtc0 __metal_dt_rtc_" << n.instance()
<< ";\n\n";
os << "extern struct __metal_driver_sifive_rtc0 __metal_dt_rtc_"
<< n.instance() << ";\n\n";
});
}

Expand Down