[PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

Lei Zhang thestig@chromium.org
Tue Jul 2 18:40:00 GMT 2019


On Tue, Jun 18, 2019 at 5:04 PM Mark Wielaard <mark@klomp.org> wrote:
> My apologies if you tried to upstream this and I missed it. But I think
> the patch below is a more complete fix. If you could test it in your
> setup that would be great.

Hi Mark,

I'm not sure if we tried to upstream the patch. So no worries there.

I tested and found some problems. My test procedure is to:
- Build elfutils at commit 31c8b3f098b0654db8f573b2a15d5b6d07d4d3b0
- Replace Chromium's buildtools/third_party/eu-strip/bin/eu-strip with
the newly built strip binary.
- Do an "official" Chromium build, with the following Chromium GN build config:

is_debug = false
is_official_build = true
strip_absolute_paths_from_debug_symbols = true
use_goma = true

This generates a 5.4 GB binary named "chrome" and then splits it into
"chrome.debug" and "chrome.stripped" using the strip command. Running
"objdump -x chrome.debug", I see the following in the "Dynamic
Section" output:

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       0000001c  00000000000002e0  00000000000002e0  000002e0  2**0
                 ALLOC, READONLY
...
 40 .debug_loc    22f253c9  0000000000000000  0000000000000000  c8e11f1b  2**0
                 CONTENTS, READONLY, DEBUGGING
41 .debug_str    3176443a  0000000000000000  0000000000000000  ebd372e4  2**0
                 CONTENTS, READONLY, DEBUGGING
42 .debug_ranges 053cdc00  0000000000000000  0000000000000000  1d49b71e  2**0
                 CONTENTS, READONLY, DEBUGGING
43 .debug_macinfo 000064fb  0000000000000000  0000000000000000  2286931e  2**0
                 CONTENTS, READONLY, DEBUGGING
44 .debug_frame  011dfe98  0000000000000000  0000000000000000  2286f820  2**3
                 CONTENTS, READONLY, DEBUGGING
45 .gdb_index    24d27f19  0000000000000000  0000000000000000  23a4f6b8  2**0
                 CONTENTS, READONLY, DEBUGGING

Here, section 42 has the wrong file offset. It should be 0x11d49b71e,
since the file offset and size of section 41 is 0xebd372e4 +
0x3176443a. If I restore buildtools/third_party/eu-strip/bin/eu-strip
back to the original, and rebuild, then that generates the right
chrome.debug output.



More information about the Elfutils-devel mailing list