Bug 32082 - gas arm aarch64: missing mapping symbols $d in the absence of alignment directives
Summary: gas arm aarch64: missing mapping symbols $d in the absence of alignment direc...
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-14 06:11 UTC by Fangrui Song
Modified: 2024-08-14 12:05 UTC (History)
2 users (show)

See Also:
Host:
Target: arm*-*-* aarch64-*-*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2024-08-14 06:11:29 UTC
Data sections without alignment directives (excluding
BSS) might lack '$d' symbols, and mixing data and text sections can
introduce state transition problems.

The relevant code was modified by 
https://sourceware.org/pipermail/binutils/2015-March/088214.html 


% cat x.c
char var = 1;
char arr[2] = {1};
% arm-linux-gnueabi-gcc -c -fdata-sections x.c && objdump -t x.o  #
aarch64-linux-gnu-gcc is similar

x.o:     file format elf32-little

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 x.c
00000000 l    d  .text  00000000 .text
00000000 l    d  .data  00000000 .data
00000000 l    d  .bss   00000000 .bss
00000000 l    d  .data.var      00000000 .data.var
00000000 l    d  .data.arr      00000000 .data.arr
00000000 l       .data.arr      00000000 $d
...

LLVM integrated assembler's AArch32 port doesn't insert '$d' unless
code is present, which could lead to similar issues.
(https://reviews.llvm.org/D30724)

% clang -c --target=armv7-linux-gnueabi -fdata-sections x.c && objdump -t x.o

x.o:     file format elf32-little

SYMBOL TABLE:
00000000 l    df *ABS*  00000000 x.c
00000000 g     O .data.var      00000001 var
00000000 g     O .data.arr      00000002 arr