anjiahao1 opened a new pull request, #22527:
URL: https://github.com/apache/nuttx/pull/22527
## Summary
Handle archive members that share a name.
ar x silently overwrites members that share a name, so a library that
contains two members with the same name loses one of them before the
sections and symbols are renamed, and the result is linked from an
archive with a missing member. Extract every member with
ar xN <instance>, number the duplicates as they are extracted, and
rebuild the archive from the original member list; members that appear
once keep their name. Only relocatable objects are processed, as
before.
## Impact
* Is new feature added? NO - build tool fix.
* Impact on user: NO
* Impact on build: NO - archives without duplicate members produce the
same result as before.
* Impact on hardware: NO
* Impact on documentation: NO
* Impact on security: NO
* Impact on compatibility: NO
## Testing
Build host: Linux x86_64, GNU binutils 2.42.
```
gcc -c a.c -o a.o
ar rcs lib1.a a.o && ar q lib1.a a.o # two members named a.o
tools/symbolprefix.sh lib1.a out1.a pre_
ar t out1.a # a.o.1 a.o.2
nm out1.a # pre_foo twice, both members preserved
ar rcs lib2.a b.o # single member
tools/symbolprefix.sh lib2.a out2.a pre_
ar t out2.a # b.o
nm out2.a # pre_bar
```
The single-member case keeps the original member name; only duplicate
members receive a numbered suffix. All symbols are prefixed correctly
in both cases.
## PR verification
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation.
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]