This repository was archived by the owner on Mar 22, 2024. It is now read-only.
afl-clang-fast: modify edit_params() to handle '-r' parameters for partial linking#143
Open
QinlinChen wants to merge 1 commit intogoogle:masterfrom
Open
afl-clang-fast: modify edit_params() to handle '-r' parameters for partial linking#143QinlinChen wants to merge 1 commit intogoogle:masterfrom
QinlinChen wants to merge 1 commit intogoogle:masterfrom
Conversation
…rtial linking There is a case that AFL cannot compile busybox. It is because the building system of busybox uses the partial linking feature of ld while the afl-clang-fast cannot handle such case. More specifically, the building system of busybox first merges several relocatable object file into a new relocatable file using the '-r' option, where the afl-llvm-rt.o added by afl-clang-fast is also merged, so the new relocatable file contains the symbols from afl-llvm-rt.o. At the final linking step, the new relocatable file is linked with afl-llvm-rt.o (added again by afl-clang-fast) into the executable file, but both files contain the definitions of the symbols from afl-llvm-rt.o. As a result, the compiler complains that and stop the building process. I fix this by restraining afl-clang-fast from adding the 'afl-llvm-rt.o' parameter when seeing the '-r', '-Wl,-r', or '-Wl,-i' in the cmd line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a case that AFL cannot compile busybox. It is because the
building system of busybox uses the partial linking feature of ld
while the afl-clang-fast cannot handle such case.
More specifically, the building system of busybox first merges several
relocatable object file into a new relocatable file using the '-r'
option, where the afl-llvm-rt.o added by afl-clang-fast is also merged,
so the new relocatable file contains the symbols from afl-llvm-rt.o.
At the final linking step, the new relocatable file is linked with
afl-llvm-rt.o (added again by afl-clang-fast) into the executable file,
but both files contain the definitions of the symbols from afl-llvm-rt.o.
As a result, the compiler complains that and stop the building process.
I fix this by restraining afl-clang-fast from adding the 'afl-llvm-rt.o'
parameter when seeing the '-r', '-Wl,-r', or '-Wl,-i' in the cmd line.
I see that AFLplusplus handles partial linking just now, but it ignores the '-r'
parameter though handling the '-Wl,-r' and '-Wl,-i'. Therefore, it still cannot
compile the busybox.