CLEVELAND (AP) -- Jeff Samardzija, perhaps pitching for the final time in a Chicago uniform, allowed one run in eight innings and Melky Cabrera homered from both sides of the plate, leading the White Sox to an 8-1 victory over the Cleveland Indians on Thursday night.

Samardzija (7-5), who has been the subject of trade rumors with the July 31 deadline approaching, held the Indians to four hits, struck out three and didn't walk a batter.

Cabrera hit a leadoff homer in the fourth off right-hander Trevor Bauer to break a scoreless tie. He added a two-run shot off left-hander Kyle Crockett in the seventh. Cabrera has homered from both sides of the plate twice in his career, the first time on July 28, 2014, against Boston.

More from FoxSports

Alexei Ramirez hit a three-run homer in the fourth while Adam Eaton homered to lead off the fifth and Chicago snapped a four-game losing streak.

Trevor Bauer (8-7) allowed six runs, including three homers, in six-plus innings.

Samardzija has lasted at least seven innings in nine straight starts and has allowed six earned runs in 31 2-3 innings in his last four. The right-hander was traded from the Cubs to Oakland at last season's trade deadline and the White Sox acquired from the Athletics in December.

The White Sox, who had lost six of seven, jumped on Bauer in the fourth. Cabrera's homer to right was followed by singles by Jose Abreu and Avisail Garcia. Ramirez then homered into the bleachers in left-center.