This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Add --allow-multiple-definition option.
ClosedPublic

Authored by ruiu on Mar 27 2014, 9:42 PM.

Details

Summary

If --allow-multiple-definition option is given, LLD does not treat duplicate
symbol error as a fatal error. GNU LD supports this option.

Diff Detail

Event Timeline

shankarke requested changes to this revision.Mar 28 2014, 6:10 AM

You would need to correct error to a warning if allow multiple definition option is used.

actually infact, there is no warning even shown with gnu, you might want the errors that is displayed to the user when there is a multiple definition.

Testcase with Gnu :-

cat > 1.c << \!
int foo = 10;
!
+ cat

cat > 2.c << \!
int foo = 10;
!
+ cat

gcc -c 1.c 2.c
+ gcc -c 1.c 2.c
ld 1.o 2.o --allow-multiple-definition
+ ld 1.o 2.o --allow-multiple-definition
ld: warning: cannot find entry symbol _start; defaulting to 00000000004000b0

ruiu added a comment.Mar 28 2014, 9:28 AM

Thanks. Modified not to print out warning messages if the option is given.

ruiu closed this revision.Mar 28 2014, 9:34 AM

Closed by commit rL205015 (authored by @ruiu).