[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26580] New: Size and alignment from as-needed shared library bss
From: |
amodra at gmail dot com |
Subject: |
[Bug ld/26580] New: Size and alignment from as-needed shared library bss symbols affect commons |
Date: |
Tue, 08 Sep 2020 02:35:20 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26580
Bug ID: 26580
Summary: Size and alignment from as-needed shared library bss
symbols affect commons
Product: binutils
Version: 2.36 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: amodra at gmail dot com
Target Milestone: ---
An as-needed shared library that isn't needed can affect common symbol size and
alignment.
cat > a.c <<\EOF
#include <stdio.h>
extern void __attribute__ ((weak)) foo (void);
char x, y, z;
long
lowest_align (void *a, void *b, void *c)
{
unsigned long bits = (long) a | (long) b | (long) c;
return bits & -bits;
}
int
main (void)
{
printf ("library %sloaded\n", &foo ? "" : "not ");
printf ("alignment %ld\n", lowest_align (&x, &y, &z));
return 0;
}
EOF
cat > b.c <<\EOF
long long x, y, z;
void foo (void) {}
EOF
gcc -O2 -fpic -fcommon -shared -o libb.so b.c
gcc -O2 -fpic -fcommon -o y1 a.c -Wl,--no-as-needed,-R,. libb.so
./y1
library loaded
alignment 8
gcc -O2 -fpic -fcommon -o y2 a.c -Wl,--as-needed,-R,. libb.so
./y2
library not loaded
alignment 8
gcc -O2 -fpic -fcommon -o y3 a.c
./y3
library not loaded
alignment 1
I reckon y2 and y3 should print the same result.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/26580] New: Size and alignment from as-needed shared library bss symbols affect commons,
amodra at gmail dot com <=
- [Bug ld/26580] Size and alignment from as-needed shared library bss symbols affect commons, amodra at gmail dot com, 2020/09/07
- [Bug ld/26580] Size and alignment from as-needed shared library bss symbols affect commons, cvs-commit at gcc dot gnu.org, 2020/09/08
- [Bug ld/26580] Size and alignment from as-needed shared library bss symbols affect commons, amodra at gmail dot com, 2020/09/09
- [Bug ld/26580] Size and alignment from as-needed shared library bss symbols affect commons, nickc at redhat dot com, 2020/09/09
- [Bug ld/26580] Size and alignment from as-needed shared library bss symbols affect commons, amodra at gmail dot com, 2020/09/09
- [Bug ld/26580] Size and alignment from as-needed shared library bss symbols affect commons, cvs-commit at gcc dot gnu.org, 2020/09/10