8000 extend visibility of nibble_to_hex_upper and nibble_to_hex_lower by tvieira · Pull Request #3188 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

extend visibility of nibble_to_hex_upper and nibble_to_hex_lower #3188

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

Closed
wants to merge 1 commit into from
Closed

extend visibility of nibble_to_hex_upper and nibble_to_hex_lower #3188

wants to merge 1 commit into from

Conversation

tvieira
Copy link
@tvieira tvieira commented Jul 22, 2020

This fixes the error of multiple definition that I've been finding during linking process.

@tvieira
Copy link
Author
tvieira commented Jul 22, 2020

The errors I've been getting on a Fedora 32 while compiling mpy-cross are:

/usr/bin/ld: build/py/parse.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/parse.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/persistentcode.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/persistentcode.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/runtime.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/runtime.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/obj.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/obj.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objarray.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objarray.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objexcept.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objexcept.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objint.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objint.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objnamedtuple.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objnamedtuple.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objstr.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objstr.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objstrunicode.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objstrunicode.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objstringio.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objstringio.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/objtype.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/objtype.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/stream.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/stream.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/builtinimport.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/builtinimport.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/modbuiltins.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/modbuiltins.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/py/modsys.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/py/modsys.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/extmod/modure.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/extmod/modure.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
/usr/bin/ld: build/extmod/vfs.o:(.rodata.nibble_to_hex_lower+0x0): multiple definition of `nibble_to_hex_lower'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_lower+0x0): first defined here
/usr/bin/ld: build/extmod/vfs.o:(.rodata.nibble_to_hex_upper+0x0): multiple definition of `nibble_to_hex_upper'; build/py/gc_long_lived.o:(.rodata.nibble_to_hex_upper+0x0): first defined here
collect2: error: ld returned 1 exit status

My compiler version is:

➜ gcc --version
gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@tvieira
Copy link
Author
tvieira commented Jul 22, 2020

Could it be this patch is unnecessary through the quest of solving this issue #3179?

@tannewt
Copy link
Member
tannewt commented Jul 22, 2020

Ya, I think so. Can you just always add extern? That's what I did with my gcc10 changes. https://github.com/tannewt/circuitpython/tree/gcc10

@jepler
Copy link
jepler commented Jul 22, 2020

Normally, you would make the declaration site be extern:

extern const char nibble_to_hex_upper[16];
extern const char nibble_to_hex_lower[16];

and in the one source file which defines them,

const char nibble_to_hex_upper[16];
const char nibble_to_hex_lower[16];

By doing this, the somewhat magic preprocessor macro EXTERN is not required.

@tvieira
Copy link
Author
tvieira commented Jul 24, 2020

@tannewt did the work with #3194

@tvieira tvieira closed this Jul 24, 2020
@tvieira tvieira deleted the mpycross-compilation branch July 24, 2020 18:39
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

Successfully merging this pull request may close these issues.

3 participants
0