Import RHEL's regression test for #531269

This commit is contained in:
Václav Kadlčík 2021-05-04 12:54:49 +02:00 committed by mcermak
parent 1f73172fe0
commit 14a74d027d
6 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,59 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE bar.c foo.c
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Michal Nowak <mnowak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: ld fails to merge different visibility for the same symbol in distinct object files" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: binutils binutils220" >> $(METADATA)
@echo "Requires: binutils binutils220 gcc44 gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 531269" >> $(METADATA)
@echo "Architectures: i386 x86_64" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,19 @@
int foo __attribute__ ((section (".gnu.linkonce.d.1"),
visibility ("hidden"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1"), visibility ("hidden")))
bar ()
{
return 1;
}
int
get_foo ()
{
return foo;
}
int
get_bar ()
{
return bar ();
}

View File

@ -0,0 +1,7 @@
int foo __attribute__ ((section (".gnu.linkonce.d.1"))) = 1;
int
__attribute__ ((section (".gnu.linkonce.t.1")))
bar ()
{
return 1;
}

View File

@ -0,0 +1,19 @@
summary: ld fails to merge different visibility for the same symbol in distinct object
files
description: ''
contact: Michal Nowak <mnowak@redhat.com>
component:
- binutils
- binutils220
test: ./runtest.sh
framework: beakerlib
recommend:
- binutils
- binutils220
- gcc44
- gcc
duration: 5m
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=531269
extra-summary: /tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol
extra-task: /tools/binutils/Regressions/ld/531269-ld-fails-to-merge-different-visibility-for-the-same-symbol

View File

@ -0,0 +1,57 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author: Michal Nowak <mnowak@redhat.com>
#
# Include rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="binutils"
# Choose the compiler.
GCC=${GCC:-gcc}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlShowPackageVersion $PACKAGE
rlShowRunningKernel
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
cp foo.c bar.c $TmpDir
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest "gcc=$GCC Testing"
rlRun "$GCC -fPIC -c -o foo.o foo.c" 0 "Compile foo.c => foo.o"
rlRun "$GCC -fPIC -c -o bar.o bar.c" 0 "Compile bar.c => bar.o"
rlRun "ld -shared -o foobar.so foo.o bar.o" 0 "Link foo.o & bar.o => foobar.so"
rlAssertExists foobar.so
rm foobar.so foo.o bar.o
rlPhaseEnd
rlPhaseStartCleanup Cleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd