Of course, you can’t execute “mercenaries” on sight.
People are confused here. If you’re a soldier in a recognized army you can’t be charged with a crime for carrying out legitimate acts of war. A legitimate soldier wearing uniform who attacks an enemy camp and kills sleeping enemy soldiers has not committed a crime according to the Geneva convention. You can shoot at that soldier and kill him, you can capture that soldier and hold him as a POW, but you can’t capture him and charge him with murder.
But the same is not true for an ununiformed guy who isn’t a member of a legitimate military group. If said ununiformed guy sneaks into an enemy camp and kills sleeping enemy soldiers, then you can shoot at him and kill him, and you can capture him. But you don’t need to treat him as a POW, you can charge him with murder, and if found guilty of murder he could get the death penalty if the law allows the death penalty. The same thing would happen if I walked into a military base here in the US and started shooting people. I wouldn’t be treated as an enemy soldier, I’d be treated as a murderer, and I’d be charged with murder and sent to jail and possibly face the death penalty.
So a “mercenary” can’t be shot on sight by enemy troops, any more than any other civilian in a war zone can be shot on sight. However, civilians who pick up guns and start shooting at enemy soldiers can be charged with murder if they are caught doing so, this is why resistance fighters were executed after capture in WWII. (Note that there are exceptions during invasionsA British pilot who dropped a bomb on a German school and killed 50 schoolkids and then bailled out and was captured can’t be charged with a crime, only held as a POW. A french resistance fighter who shoots a German soldier guarding a bridge can be charged with murder, and will face a firing squad. Of course, this all assumes that these people would survive to be captured rather than being shot out of hand. But shooting a surrendering British pilot would be a war crime, shooting a surrendering french resistance fighter would be a regular crime. But a german soldier who saw a downed British pilot walking around after a crash could legally simply shoot that pilot, same as the pilot could bomb the soldier if the pilot were in his airplane. It’s only when the pilot attempts to surrender that the soldier can’t legally shoot him.
So a civilian in Iraq who carries around a gun and shoots at people can be charged with various crimes, depending on exactly who they shot at, and why, and how. But if it would be legal for a regular old civilian to shoot at someone, it would be likewise legal for a “mercenary” to shoot at someone. Basically a mercenary would be treated just like any other civilian. Regular civilians have the right to use force to defend themselves in certain situations.
And of course, this all assumes that the mercenaries would be fighting against an army that recognizes the Geneva conventions, which of course the fighters in Iraq do not. They aren’t going to hold a trial and legally execute mercenaries for murder, any more than they are going to hold US soldiers as POWs.