[PATCH] Don't attempt to place symbols into a discarded .dynsym

Egeyar Bagcioglu egeyar.bagcioglu@oracle.com
Wed Oct 3 21:27:00 GMT 2018


Hello,

I would like to propose a patch to fix an error we see while linking the 
kernel.

To meet the needs of different tools, we are compiling the kernel with 
-ffunction-sections -fdata-sections and link it with --emit-relocs. That 
increases the total number of sections. As a result, we trigger the 
error within check_dynsym, regarding dynamic symbols in sections with 
indices higher than 64K. However, I believe the error is invalid because 
the kernel already discards .dynsym in its linker script.

The attached patch prevents putting dynamic symbols into a discarded 
.dynsym; therefore, it avoids the error message regarding dynamic 
symbols when .dynsym is discarded. The resulting linker can build the 
kernel under the above-mentioned conditions.

This patch does not intend to change the output of previously-successful 
linker runs: a) If the .dynsym is not discarded, the patch does not take 
effect. b) When it's discarded, the contents of the .dynsym are not 
output either way. Therefore, the changes made by this patch is not 
visible in the output.

The patch is tested on x86_64-pc-linux-gnu and aarch64-unknown-linux-gnu 
and introduced no regressions. Although, I doubt if there's a test case 
where .dynsym is discarded.

The following is the proposed bfd/ChangeLog entry:

2018-10-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

     * elflink.c (elf_link_output_extsym): Do not attempt to place symbols
     into a discarded .dynsym.


Please take a look and apply if legitimate.

Regards,
Egeyar

-------------- next part --------------
A non-text attachment was scrubbed...
Name: discarded_dynsym.patch
Type: text/x-patch
Size: 841 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20181003/437b884a/attachment.bin>


More information about the Binutils mailing list