send2vinnie / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

[Code Review] ObjectLinker normalization algorithm #153

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Dear Peter,

I review the normalization algorithm, and the appended file is my result.
Although current implementation can get the right result, but the semantics of 
the code may not correct as what we want.

Branch name: master
When reviewing my code changes, please focus on:
The condition of unrecognized input file.

Original issue reported on code.google.com by LubaTang on 24 Jul 2013 at 9:43

Attachments:

GoogleCodeExporter commented 9 years ago
With the patch, the error code for unrecognized input would never be reached in 
the real world case.

There is no standard format for a linker script file, so currently any input 
other than regular object, dso, and archive would be read as a linker script 
file.

Original comment by pete.c...@gmail.com on 25 Jul 2013 at 1:34

GoogleCodeExporter commented 9 years ago
The current code has major issues if the input is a valid object for a 
different architecture. In that case it is still parsed as linker script, 
making it explode in terms of memory usage.

I think the correct way to handle this is to distinguish three cases for 
isMyFormat:
(1) The input is recognized and valid.
(2) The input is recognized, but not valid.
(3) The input is not recognized.

The processing in normalize() should stop for (1) and (2).

Original comment by joerg.sonnenberger@googlemail.com on 5 Aug 2013 at 6:56

GoogleCodeExporter commented 9 years ago
Attached is a possible patch. This is still not optimal, since valid, but not 
matching, ELF objects should be ignored.

Original comment by joerg.sonnenberger@googlemail.com on 5 Aug 2013 at 9:44

Attachments:

GoogleCodeExporter commented 9 years ago
Applied Joerg's patch in commit 9f484abd0a

Original comment by pete.c...@gmail.com on 18 Sep 2013 at 5:23