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

Multiple definitions in libmetal.a #229

Open
Mel-Chen opened this issue Feb 11, 2020 · 4 comments
Open

Multiple definitions in libmetal.a #229

Mel-Chen opened this issue Feb 11, 2020 · 4 comments
Assignees

Comments

@Mel-Chen
Copy link

I'm trying GCC 10 now. When I use GCC 10 toolchain to build libmetal, there are a lot of ld fail.

/work/melc/riscv64-unknown-elf-gcc-10.0.0-20200203/bin/../lib/gcc/riscv64-unknown-elf/10.0.1/../../../../riscv64-unknown-elf/bin/ld: /scratch/melc/workspace/build/product-coreip-sifive/e76mc/freedom-e-sdk/bsp/e76mc/install/lib/release//libmetal.a(libriscv__mmachine__e76mc_a-tty.o):(.bss.__metal_dt_cpu_3_interrupt_controller+0x0): multiple definition of `__metal_dt_cpu_3_interrupt_controller'; /scratch/melc/workspace/build/product-coreip-sifive/e76mc/freedom-e-sdk/bsp/e76mc/install/lib/release//libmetal.a(libriscv__mmachine__e76mc_a-timer.o):(.bss.__metal_dt_cpu_3_interrupt_controller+0x0): first defined here

After GCC 10, -fno-common is default enable, so that the definitions in metal.h will be placed at .bss. .bss not allow multiple definition.
You can use toolchain /work/melc/riscv64-unknown-elf-gcc-10.0.0-20200203, or GCC 8.3 toolchain with -fno-common option, to reproduce this issue.

bsousi5 added a commit that referenced this issue Apr 8, 2020
@issuehsu
Copy link
Contributor

issuehsu commented May 7, 2020

Hi @bsousi5 does this issue be resolved?

@keith-packard
Copy link
Contributor

I've submitted a PR to freedom-devicetree-tools that fixes the machine.h header problem. That's got my test build working.

@issuehsu
Copy link
Contributor

issuehsu commented May 8, 2020

OK, thanks Keith.

@issuehsu
Copy link
Contributor

issuehsu commented May 15, 2020

I am integrating gcc-10 with freedom-e-sdk, and it seems the PR is still not merged, so I cherry-pick this patch for local test. And I still see multiple definition errors.

Following is the build command:
make PROGRAM=minimal-boot TARGET=qemu-sifive-e31 CONFIGURATION=release RISCV_LIBC=nano clean software

One of the error message:
/freedom-e-sdk/bsp/freedom-e310-arty/install/lib/release//libmetal.a(tty.o):(.bss.__metal_dt_spi_10014000+0x0): multiple definition of `__metal_dt_spi_10014000'; /freedom-e-sdk/bsp/freedom-e310-arty/install/lib/release//libmetal.a(synchronize_harts.o):(.bss.__metal_dt_spi_10014000+0x0): first defined here

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants