Skip to content
New issue

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

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

Already on GitHub? # to your account

ppci-ld: linker imports too many modules from the libraries #102

Open
tstreiff opened this issue Jun 29, 2020 · 0 comments
Open

ppci-ld: linker imports too many modules from the libraries #102

tstreiff opened this issue Jun 29, 2020 · 0 comments

Comments

@tstreiff
Copy link
Contributor

I have been using the --library option of the linker for several weeks.
I sometimes got unexpected errors "Multiple defined symbol" (most often "errno") I failed to explain.
I noticed that the linker sometimes merges library object files that only uses unresolved symboles but do not define them. This sometimes leads to attempt to merge several times the same object file, hence the error reports.

When it tries to complete unresolved references with library object files, the linker merges an object file if at least one program unresolved symbol is listed in this object file. But it does not check that this symbol is defined in this object file, the symbol can be only be used.

In linker.py/add_missing_symbols_from_libraries() checks if an object file should be merged as follows:

has_sym = any(map(obj.has_symbol, undefined_symbols))

it should also test that the symbol is global and defined.

tstreiff added a commit to tstreiff/ppci-mirror that referenced this issue Jun 30, 2020
…e to merge: select only objectfiles defining globally at least one yet unresolved symbol
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant